HCOLL-200 removed the isClosed ( and discussed with Roman why )

This commit is contained in:
Rob Austin
2014-11-11 15:45:37 +00:00
parent 13cf4e7c5c
commit 83e68add4e
4 changed files with 16 additions and 15 deletions
@@ -33,20 +33,17 @@ final class CloseablesManager implements Closeable {
private boolean isClosed = false;
private final Set<Closeable> closeables = new LinkedHashSet<Closeable>();
private void checkState() {
if (isClosed)
throw new IllegalStateException();
}
public synchronized void add(Closeable closeable) {
checkState();
if (closeable == null)
throw new NullPointerException();
closeables.add(closeable);
}
public synchronized void close(Closeable closeable) throws IOException {
checkState();
for (Iterator<Closeable> iterator = closeables.iterator(); iterator.hasNext(); ) {
if (iterator.next() == closeable)
iterator.remove();