From 8a06beaf242ef88b2585f0744077b9d95f575673 Mon Sep 17 00:00:00 2001 From: Michael Christen Date: Tue, 4 Oct 2022 20:12:47 +0200 Subject: [PATCH] removed finalize() methods, deprecated --- .../src/SevenZip/Archive/SevenZip/Handler.java | 4 ---- .../federate/solr/connector/EmbeddedSolrConnector.java | 5 ----- .../cora/federate/solr/instance/EmbeddedInstance.java | 5 ----- source/net/yacy/crawler/data/NoticedURL.java | 8 -------- source/net/yacy/document/content/dao/ImportDump.java | 5 ----- source/net/yacy/document/content/dao/PhpBB3Dao.java | 5 ----- source/net/yacy/document/parser/html/ContentScraper.java | 4 ---- source/net/yacy/kelondro/blob/Heap.java | 5 ----- source/net/yacy/kelondro/blob/HeapModifier.java | 5 ----- source/net/yacy/kelondro/blob/HeapReader.java | 5 ----- source/net/yacy/kelondro/blob/MapHeap.java | 5 ----- source/net/yacy/kelondro/blob/Stack.java | 5 ----- source/net/yacy/kelondro/blob/Stacks.java | 5 ----- source/net/yacy/kelondro/io/BufferedRecords.java | 5 ----- source/net/yacy/kelondro/io/CachedFileReader.java | 5 ----- source/net/yacy/kelondro/io/CachedFileWriter.java | 5 ----- source/net/yacy/kelondro/io/RandomAccessIO.java | 5 ----- source/net/yacy/kelondro/table/Table.java | 5 ----- source/net/yacy/peers/NewsDB.java | 5 ----- source/net/yacy/peers/NewsQueue.java | 5 ----- 20 files changed, 101 deletions(-) diff --git a/libbuild/J7Zip-modified/src/SevenZip/Archive/SevenZip/Handler.java b/libbuild/J7Zip-modified/src/SevenZip/Archive/SevenZip/Handler.java index 141fd896d..26e304a43 100644 --- a/libbuild/J7Zip-modified/src/SevenZip/Archive/SevenZip/Handler.java +++ b/libbuild/J7Zip-modified/src/SevenZip/Archive/SevenZip/Handler.java @@ -150,10 +150,6 @@ public class Handler implements IInArchive { } } - protected void finalize() throws Throwable { - close(); - } - public void close() throws IOException { if (_inStream != null) _inStream.close(); _inStream = null; diff --git a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java index 5839541ee..b0fc28696 100644 --- a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java +++ b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java @@ -155,11 +155,6 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo return this.core == null || this.core.isClosed(); } - @Override - protected void finalize() throws Throwable { - this.close(); - } - @Override public synchronized void close() { if (this.core != null && !this.core.isClosed()) try {this.commit(false);} catch (final Throwable e) {ConcurrentLog.logException(e);} diff --git a/source/net/yacy/cora/federate/solr/instance/EmbeddedInstance.java b/source/net/yacy/cora/federate/solr/instance/EmbeddedInstance.java index 5f10da685..e9b6cd9c3 100644 --- a/source/net/yacy/cora/federate/solr/instance/EmbeddedInstance.java +++ b/source/net/yacy/cora/federate/solr/instance/EmbeddedInstance.java @@ -235,11 +235,6 @@ public class EmbeddedInstance implements SolrInstance { return c; } - @Override - protected void finalize() throws Throwable { - this.close(); - } - @Override public synchronized void close() { for (final SolrCore core: this.cores.values()) core.close(); diff --git a/source/net/yacy/crawler/data/NoticedURL.java b/source/net/yacy/crawler/data/NoticedURL.java index 0e188d602..8ce8c8ac2 100644 --- a/source/net/yacy/crawler/data/NoticedURL.java +++ b/source/net/yacy/crawler/data/NoticedURL.java @@ -127,14 +127,6 @@ public class NoticedURL { } } - @Override - protected void finalize() throws Throwable { - if ((this.coreStack != null) || (this.limitStack != null) || (this.remoteStack != null)) { - ConcurrentLog.warn("plasmaCrawlNURL", "NURL stack closed by finalizer"); - this.close(); - } - } - public int size() { return ((this.coreStack == null) ? 0 : this.coreStack.size()) + ((this.limitStack == null) ? 0 : this.limitStack.size()) + ((this.remoteStack == null) ? 0 : this.remoteStack.size()); } diff --git a/source/net/yacy/document/content/dao/ImportDump.java b/source/net/yacy/document/content/dao/ImportDump.java index 1dbd11b9c..93956616c 100644 --- a/source/net/yacy/document/content/dao/ImportDump.java +++ b/source/net/yacy/document/content/dao/ImportDump.java @@ -92,11 +92,6 @@ public class ImportDump { if (statement != null) try {statement.close();} catch (final SQLException e) {} } } - - @Override - protected void finalize() throws Throwable { - close(); - } public synchronized void close() { this.conn.close(); diff --git a/source/net/yacy/document/content/dao/PhpBB3Dao.java b/source/net/yacy/document/content/dao/PhpBB3Dao.java index 64304b29b..1c46d9524 100644 --- a/source/net/yacy/document/content/dao/PhpBB3Dao.java +++ b/source/net/yacy/document/content/dao/PhpBB3Dao.java @@ -67,11 +67,6 @@ public class PhpBB3Dao implements Dao { this.users = new HashMap(); } - @Override - protected void finalize() throws Throwable { - close(); - } - @Override public Date first() { Statement stmt = null; diff --git a/source/net/yacy/document/parser/html/ContentScraper.java b/source/net/yacy/document/parser/html/ContentScraper.java index b4c532b0e..0cb462c43 100644 --- a/source/net/yacy/document/parser/html/ContentScraper.java +++ b/source/net/yacy/document/parser/html/ContentScraper.java @@ -172,10 +172,6 @@ public class ContentScraper extends AbstractScraper implements Scraper { this.content = null; } @Override - public void finalize() { - this.close(); - } - @Override public String toString() { return "<" + name + " " + opts + ">" + content + ""; } diff --git a/source/net/yacy/kelondro/blob/Heap.java b/source/net/yacy/kelondro/blob/Heap.java index cd8b3eea5..a54de2b3d 100644 --- a/source/net/yacy/kelondro/blob/Heap.java +++ b/source/net/yacy/kelondro/blob/Heap.java @@ -311,11 +311,6 @@ public final class Heap extends HeapModifier implements BLOB { this.close(true); } - @Override - public void finalize() { - this.close(); - } - public int getBuffermax() { return this.buffermax; } diff --git a/source/net/yacy/kelondro/blob/HeapModifier.java b/source/net/yacy/kelondro/blob/HeapModifier.java index 1e0d14a20..7862a94f2 100644 --- a/source/net/yacy/kelondro/blob/HeapModifier.java +++ b/source/net/yacy/kelondro/blob/HeapModifier.java @@ -87,11 +87,6 @@ public class HeapModifier extends HeapReader implements BLOB { close(true); } - @Override - public void finalize() { - this.close(); - } - /** * remove a BLOB * @param key the primary key diff --git a/source/net/yacy/kelondro/blob/HeapReader.java b/source/net/yacy/kelondro/blob/HeapReader.java index 48be3f801..d610e9787 100644 --- a/source/net/yacy/kelondro/blob/HeapReader.java +++ b/source/net/yacy/kelondro/blob/HeapReader.java @@ -664,11 +664,6 @@ public class HeapReader { close(true); } - @Override - public void finalize() { - this.close(); - } - /** * ask for the length of the primary key * @return the length of the key diff --git a/source/net/yacy/kelondro/blob/MapHeap.java b/source/net/yacy/kelondro/blob/MapHeap.java index 743a2e7a0..8b1932c1c 100644 --- a/source/net/yacy/kelondro/blob/MapHeap.java +++ b/source/net/yacy/kelondro/blob/MapHeap.java @@ -466,11 +466,6 @@ public class MapHeap implements Map> { if (this.blob != null) this.blob.close(true); } - @Override - public void finalize() { - close(); - } - protected class FullMapIterator extends LookAheadIterator>> implements Iterator>> { // enumerates Map-Type elements // the key is also included in every map that is returned; it's key is 'key' diff --git a/source/net/yacy/kelondro/blob/Stack.java b/source/net/yacy/kelondro/blob/Stack.java index 5442987ed..7b61a63d4 100644 --- a/source/net/yacy/kelondro/blob/Stack.java +++ b/source/net/yacy/kelondro/blob/Stack.java @@ -253,9 +253,4 @@ public class Stack { public synchronized void close() { this.stack.close(true); } - - @Override - public void finalize() { - this.close(); - } } diff --git a/source/net/yacy/kelondro/blob/Stacks.java b/source/net/yacy/kelondro/blob/Stacks.java index e716a6b08..12d1917c0 100644 --- a/source/net/yacy/kelondro/blob/Stacks.java +++ b/source/net/yacy/kelondro/blob/Stacks.java @@ -261,9 +261,4 @@ public class Stacks { se.stack.close(); } } - - @Override - public void finalize() { - this.close(); - } } diff --git a/source/net/yacy/kelondro/io/BufferedRecords.java b/source/net/yacy/kelondro/io/BufferedRecords.java index ff658171b..e17595dda 100644 --- a/source/net/yacy/kelondro/io/BufferedRecords.java +++ b/source/net/yacy/kelondro/io/BufferedRecords.java @@ -93,11 +93,6 @@ public final class BufferedRecords { if (this.efs != null) this.efs.close(); } - @Override - protected final synchronized void finalize() { - if (this.efs != null) close(); - } - public final void get(final long index, final byte[] b, final int start) throws IOException { final Long idx = Long.valueOf(index); final byte[] bb; diff --git a/source/net/yacy/kelondro/io/CachedFileReader.java b/source/net/yacy/kelondro/io/CachedFileReader.java index b7107ebdd..521743bf5 100644 --- a/source/net/yacy/kelondro/io/CachedFileReader.java +++ b/source/net/yacy/kelondro/io/CachedFileReader.java @@ -89,9 +89,4 @@ public final class CachedFileReader extends AbstractReader implements Reader { this.cache = null; } - @Override - protected void finalize() throws Throwable { - this.close(); - } - } diff --git a/source/net/yacy/kelondro/io/CachedFileWriter.java b/source/net/yacy/kelondro/io/CachedFileWriter.java index e57aa30f6..835222152 100644 --- a/source/net/yacy/kelondro/io/CachedFileWriter.java +++ b/source/net/yacy/kelondro/io/CachedFileWriter.java @@ -170,9 +170,4 @@ public final class CachedFileWriter extends AbstractWriter implements Writer { this.cachelen = 0; } - @Override - protected final void finalize() throws Throwable { - this.close(); - } - } diff --git a/source/net/yacy/kelondro/io/RandomAccessIO.java b/source/net/yacy/kelondro/io/RandomAccessIO.java index 1672c928b..ea323a118 100644 --- a/source/net/yacy/kelondro/io/RandomAccessIO.java +++ b/source/net/yacy/kelondro/io/RandomAccessIO.java @@ -144,11 +144,6 @@ public final class RandomAccessIO { if (this.ra != null) this.ra.close(); } - @Override - protected final void finalize() throws Throwable { - if (this.ra != null) this.close(); - } - public final void deleteOnExit() { this.ra.deleteOnExit(); } diff --git a/source/net/yacy/kelondro/table/Table.java b/source/net/yacy/kelondro/table/Table.java index f2ef7f455..d2720c48f 100644 --- a/source/net/yacy/kelondro/table/Table.java +++ b/source/net/yacy/kelondro/table/Table.java @@ -593,11 +593,6 @@ public class Table implements Index, Iterable { if (tablefile != null) tableTracker.remove(tablefile); } - @Override - protected void finalize() { - if (this.file != null) close(); - } - @Override public String filename() { return this.file.filename().toString(); diff --git a/source/net/yacy/peers/NewsDB.java b/source/net/yacy/peers/NewsDB.java index 044530903..4ff6e8deb 100644 --- a/source/net/yacy/peers/NewsDB.java +++ b/source/net/yacy/peers/NewsDB.java @@ -129,11 +129,6 @@ public class NewsDB { this.news = null; } - @Override - protected void finalize() { - close(); - } - public int size() { return this.news.size(); } diff --git a/source/net/yacy/peers/NewsQueue.java b/source/net/yacy/peers/NewsQueue.java index 6d37ed7f9..ab6da6201 100644 --- a/source/net/yacy/peers/NewsQueue.java +++ b/source/net/yacy/peers/NewsQueue.java @@ -103,11 +103,6 @@ public class NewsQueue implements Iterable { this.queueStack = null; } - @Override - protected void finalize() { - close(); - } - public int size() { return this.queueStack.size(); }