Author: ron.sigal(a)jboss.com
Date: 2009-05-05 04:22:05 -0400 (Tue, 05 May 2009)
New Revision: 5130
Modified:
remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Client.java
Log:
JBREM-1112 (and others to be named): Renamed and rewrote disconnectAndNotify().
Modified:
remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Client.java
===================================================================
---
remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Client.java 2009-05-05
01:54:59 UTC (rev 5129)
+++
remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Client.java 2009-05-05
08:22:05 UTC (rev 5130)
@@ -396,6 +396,7 @@
// synchronized (connectionValidatorLock)
// {
+ log.debug(this + " in addConnectionListener()");
if (connectionValidator == null)
{
Map map = new HashMap(configuration);
@@ -553,6 +554,7 @@
*/
public void connect(ConnectionListener listener, Map metadata) throws Exception
{
+ log.debug(this + ".connect(" + listener + ")");
if (isConnected())
return;
@@ -574,6 +576,7 @@
connect(invoker, listener, metadata);
connected = true;
+ log.debug(this + " is connected");
}
/**
@@ -1638,15 +1641,45 @@
// Package protected
----------------------------------------------------------------------------
- synchronized void disconnectAndNotify()
+ synchronized void notifyAndDisconnect()
{
// synchronized (connectionValidatorLock)
{
- disconnect();
+// disconnect();
if (connectionValidator != null)
{
+ log.debug(this + " calling
connectionValidator.notifyListeners()");
connectionValidator.notifyListeners(new Exception("Could not connect to
server!"));
+ Iterator it = connectionListeners.iterator();
+ while (it.hasNext())
+ {
+ ConnectionListener listener = (ConnectionListener) it.next();
+ connectionValidator.removeConnectionListener(this, listener);
+ }
+ if (connectionValidator.isStopped())
+ {
+ connectionValidators.remove(connectionValidatorKey);
+ log.debug(this + " removed from static map: " +
connectionValidator);
+ }
+ else
+ {
+ log.debug(this + ": " + connectionValidator + " is not
stopped");
+ }
+
+ connectionValidator = null;
+ connectionValidatorKey = null;
}
+
+ if (invoker != null)
+ {
+ // Need to remove myself from registry so will not keep reference to me since
I am of no
+ // use now. Will have to create a new one.
+
+ InvokerRegistry.destroyClientInvoker(invoker.getLocator(), configuration);
+ invoker = null;
+ }
+
+ connected = false;
}
}
@@ -1769,6 +1802,7 @@
}
temp.put(CLIENT, this);
temp.put(CONNECTION_LISTENER, listener);
+ log.debug(this + " calling
MicroRemoteClientInvoker.establishLease()");
invoker.establishLease(sessionId, temp, leasePeriod);
}
else if (listener != null)
Show replies by date