Skip to content

Commit a4bee65

Browse files
Eliminate finalize() overrides (#976)
1 parent 2027e02 commit a4bee65

2 files changed

Lines changed: 5 additions & 27 deletions

File tree

ms2/src/org/labkey/ms2/SpectrumImporter.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public class SpectrumImporter
4646
private static final Logger _systemLog = LogManager.getLogger(SpectrumImporter.class);
4747
private static final int SQL_BATCH_SIZE = 100;
4848

49-
private Logger _log;
50-
private MS2Importer.MS2Progress _progress;
51-
private Set<Integer> _scans;
49+
private final Logger _log;
50+
private final MS2Importer.MS2Progress _progress;
51+
private final Set<Integer> _scans;
5252
private final int _fractionId;
5353
private SimpleScanIterator _scanIterator;
5454
private FileLike _file = null;
@@ -262,10 +262,7 @@ private void importSpectra()
262262
_systemLog.error(e);
263263
}
264264

265-
if (null != conn)
266-
{
267-
schema.getScope().releaseConnection(conn);
268-
}
265+
schema.getScope().releaseConnection(conn);
269266
}
270267
}
271268

@@ -278,16 +275,6 @@ private void close()
278275
_scanIterator = null;
279276
}
280277

281-
282-
@Override
283-
protected void finalize() throws Throwable
284-
{
285-
super.finalize();
286-
287-
assert null == _scanIterator;
288-
}
289-
290-
291278
public FileLike getFile()
292279
{
293280
return _file;

ms2/src/org/labkey/ms2/reader/TarIterator.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class TarIterator implements SimpleScanIterator
4242
private static final Logger _log = LogManager.getLogger(TarIterator.class);
4343
private static final int STREAM_BUFFER_SIZE = 128 * 1024;
4444

45-
private String _dtaFileNamePrefix;
45+
private final String _dtaFileNamePrefix;
4646
private InputStream _is;
4747
private GZIPInputStream _gzInputStream;
4848
private TarArchiveInputStream _tis;
@@ -165,15 +165,6 @@ public void close()
165165
}
166166
}
167167

168-
@Override
169-
protected void finalize() throws Throwable
170-
{
171-
super.finalize();
172-
173-
assert null == _is && null == _gzInputStream && null == _tis;
174-
}
175-
176-
177168
private static byte[] realloc(int size, byte[] buf)
178169
{
179170
if (null == buf || buf.length < size)

0 commit comments

Comments
 (0)