summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/ThreadPool.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/IceInternal/ThreadPool.java')
-rw-r--r--java/src/IceInternal/ThreadPool.java67
1 files changed, 33 insertions, 34 deletions
diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java
index dafe47b8a21..3a2585c33cf 100644
--- a/java/src/IceInternal/ThreadPool.java
+++ b/java/src/IceInternal/ThreadPool.java
@@ -127,40 +127,6 @@ public final class ThreadPool
throws Throwable
{
IceUtil.Assert.FinalizerAssert(_destroyed);
-
- /**
- * For compatibility with C#, we do not invoke methods on other objects
- * in a finalizer.
- *
- try
- {
- if(_selector != null)
- {
- _selector.close();
- }
-
- if(_fdIntrWrite != null)
- {
- _fdIntrWrite.close();
- }
-
- if(_fdIntrRead != null)
- {
- _fdIntrRead.close();
- }
- }
- catch(java.io.IOException ex)
- {
- java.io.StringWriter sw = new java.io.StringWriter();
- java.io.PrintWriter pw = new java.io.PrintWriter(sw);
- ex.printStackTrace(pw);
- pw.flush();
- String s = "exception in `" + _prefix + "' while calling close():\n" + sw.toString();
- _instance.logger().error(s);
- }
- */
-
- super.finalize();
}
public synchronized void
@@ -296,6 +262,39 @@ public final class ThreadPool
}
}
}
+
+ //
+ // Cleanup the selector, and the socket pair.
+ //
+ try
+ {
+ if(_selector != null)
+ {
+ _selector.close();
+ _selector = null;
+ }
+
+ if(_fdIntrWrite != null)
+ {
+ _fdIntrWrite.close();
+ _fdIntrWrite = null;
+ }
+
+ if(_fdIntrRead != null)
+ {
+ _fdIntrRead.close();
+ _fdIntrRead = null;
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ String s = "exception in `" + _prefix + "' while calling close():\n" + sw.toString();
+ _instance.logger().error(s);
+ }
}
public String