Author: ron.sigal(a)jboss.com
Date: 2009-04-12 21:39:51 -0400 (Sun, 12 Apr 2009)
New Revision: 4976
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
Log:
JBREM-1083: (1) Made invokerDestructionTimer and invokerDestructionTimerLock static; (2)
made invoker reference in InvokerDesctructionTimerTask a WeakReference.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2009-04-12 07:24:18 UTC
(rev 4975)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2009-04-13 01:39:51 UTC
(rev 4976)
@@ -51,6 +51,7 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.StreamCorruptedException;
+import java.lang.ref.WeakReference;
import java.net.InetAddress;
import java.net.SocketTimeoutException;
import java.rmi.MarshalException;
@@ -172,6 +173,9 @@
private static final Logger log = Logger.getLogger(Client.class);
private static final long serialVersionUID = 5679279425009837934L;
+
+ private static Timer invokerDestructionTimer;
+ private static Object invokerDestructionTimerLock = new Object();
// Static
---------------------------------------------------------------------------------------
@@ -205,8 +209,6 @@
private boolean connected = false;
private int invokerDestructionDelay = 0;
- private Timer invokerDestructionTimer;
- private Object invokerDestructionTimerLock = new Object();
// Constructors
---------------------------------------------------------------------------------
@@ -1843,17 +1845,20 @@
// Inner classes
--------------------------------------------------------------------------------
class InvokerDestructionTimerTask extends TimerTask
{
- private ClientInvoker invoker;
+ private WeakReference ref;
public InvokerDestructionTimerTask(ClientInvoker invoker)
{
- this.invoker = invoker;
+ ref = new WeakReference(invoker);
}
public void run()
{
- log.trace("calling InvokerRegistry.destroyClientInvoker() for " +
invoker);
+ ClientInvoker invoker = (ClientInvoker) ref.get();
+ log.trace(this + " calling InvokerRegistry.destroyClientInvoker() for
" + invoker);
InvokerRegistry.destroyClientInvoker(invoker.getLocator(), configuration);
+ ref.clear();
+ ref = null;
}
}
}
Show replies by date