diff --git a/src/main/java/org/taktik/CHANGELOG.md b/src/main/java/org/taktik/CHANGELOG.md index 0c286235..a841946c 100644 --- a/src/main/java/org/taktik/CHANGELOG.md +++ b/src/main/java/org/taktik/CHANGELOG.md @@ -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. diff --git a/src/main/java/org/taktik/mpegts/sources/AbstractMTSSource.java b/src/main/java/org/taktik/mpegts/sources/AbstractMTSSource.java index 0c6e6cde..a7c81a69 100644 --- a/src/main/java/org/taktik/mpegts/sources/AbstractMTSSource.java +++ b/src/main/java/org/taktik/mpegts/sources/AbstractMTSSource.java @@ -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; }