Author: ron.sigal(a)jboss.com
Date: 2010-12-15 18:22:31 -0500 (Wed, 15 Dec 2010)
New Revision: 6171
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java
Log:
JBREM-1144: Added useServerConnectionIdentity variable, which determines if a unique
serverId is created.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2010-12-15
23:21:50 UTC (rev 6170)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2010-12-15
23:22:31 UTC (rev 6171)
@@ -38,6 +38,7 @@
import org.jboss.remoting.transport.PortUtil;
import org.jboss.remoting.util.LocalHostUtil;
import org.jboss.remoting.serialization.ClassLoaderUtility;
+import org.jboss.util.id.GUID;
import org.jboss.util.threadpool.BasicThreadPool;
import org.jboss.util.threadpool.BlockingMode;
import org.jboss.util.threadpool.ThreadPool;
@@ -265,6 +266,10 @@
protected boolean registerCallbackListeners = true;
protected boolean useClientConnectionIdentity;
+ protected boolean useServerConnectionIdentity;
+
+ /** Used by ConnectionValidator to detect a change of server. **/
+ protected String serverId = new GUID().toString();
// Constructors
---------------------------------------------------------------------------------
@@ -720,6 +725,16 @@
this.useClientConnectionIdentity = useClientConnectionIdentity;
}
+ public boolean isUseServerConnectionIdentity()
+ {
+ return useServerConnectionIdentity;
+ }
+
+ public void setUseServerConnectionIdentity(boolean useServerConnectionIdentity)
+ {
+ this.useServerConnectionIdentity = useServerConnectionIdentity;
+ }
+
public Object invoke(Object invoke) throws IOException
{
InvocationRequest request = null;
@@ -785,8 +800,29 @@
// Comes from ConnectionValidator configured to tie validation with
lease.
boolean response = checkForClientLease(invokerSessionId);
if (trace) log.trace(this + " responding " + response +
" to $PING$ for invoker sessionId " + invokerSessionId);
- return new Boolean(response);
+ if (metadata.get(Remoting.USE_SERVER_CONNECTION_IDENTITY) != null)
+ {
+ Map responseMap = new HashMap();
+ responseMap.put(Remoting.SERVER_ID, serverId);
+ if (trace) log.trace(this + " returning serverId: " +
serverId);
+ return new InvocationResponse(invocation.getSessionId(), new
Boolean(response), false, responseMap);
+ }
+ else
+ {
+ if (trace) log.trace(this + " not returning serverId: " +
serverId);
+ return new Boolean(response);
+ }
}
+ else
+ {
+ if (metadata.get(Remoting.USE_SERVER_CONNECTION_IDENTITY) != null)
+ {
+ Map responseMap = new HashMap();
+ responseMap.put(Remoting.SERVER_ID, serverId);
+ if (trace) log.trace(this + " returning serverId: " +
serverId);
+ return new InvocationResponse(invocation.getSessionId(), null,
false, responseMap);
+ }
+ }
}
if (leaseManagement)
@@ -1182,6 +1218,13 @@
useClientConnectionIdentity =
Boolean.valueOf(useClientConnectionIdentityString).booleanValue();
}
+ // config for useServerConnectionIdentity
+ String useServerConnectionIdentityString =
(String)config.get(Remoting.USE_SERVER_CONNECTION_IDENTITY);
+ if(useServerConnectionIdentityString != null)
+ {
+ useServerConnectionIdentity =
Boolean.valueOf(useServerConnectionIdentityString).booleanValue();
+ }
+
// Inject ConnectionListener
String connectionListener = (String)config.get(CONNECTION_LISTENER);
if (connectionListener != null)
Show replies by date