Remove finalize method. It is deprecated in Java 9

This commit is contained in:
0xboobface 2018-11-14 14:15:52 +01:00
parent 59cd9cf699
commit 9bcf7523b1
2 changed files with 22 additions and 30 deletions

View File

@ -7,3 +7,4 @@ Changes made to mpegts-streamer for ctbrec
* Add BlockingMultiMTSSource, which can be used to add sources, after the streaming has been started
* Don't close the stream, if a packet can't be read in one go InputStreamMTSSource. Instead read from
the stream until the packet is complete
* Remove finalize method. It is deprecated in Java 9.

View File

@ -3,38 +3,29 @@ package org.taktik.mpegts.sources;
import org.taktik.mpegts.MTSPacket;
public abstract class AbstractMTSSource implements MTSSource {
private boolean closed;
private boolean closed;
@Override
public final MTSPacket nextPacket() throws Exception {
if (isClosed()) {
throw new IllegalStateException("Source is closed");
}
return nextPacketInternal();
}
@Override
public final MTSPacket nextPacket() throws Exception {
if (isClosed()) {
throw new IllegalStateException("Source is closed");
}
return nextPacketInternal();
}
@Override
public final void close() throws Exception {
try {
closeInternal();
} finally {
closed = true;
}
}
@Override
public final void close() throws Exception {
try {
closeInternal();
} finally {
closed = true;
}
}
protected boolean isClosed() {
return closed;
}
protected boolean isClosed() {
return closed;
}
protected abstract MTSPacket nextPacketInternal() throws Exception;
protected abstract void closeInternal() throws Exception;
@Override
protected void finalize() throws Throwable {
if (!closed) {
close();
}
super.finalize();
}
protected abstract MTSPacket nextPacketInternal() throws Exception;
protected abstract void closeInternal() throws Exception;
}