[jboss-remoting-commits] JBoss Remoting SVN: r6224 - remoting2/branches/2.2/src/main/org/jboss/remoting.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Tue Jan 25 23:54:17 EST 2011
Author: ron.sigal at jboss.com
Date: 2011-01-25 23:54:17 -0500 (Tue, 25 Jan 2011)
New Revision: 6224
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/Lease.java
remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java
Log:
JBREM-1144: Adding a unique id to Lease.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/Lease.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/Lease.java 2011-01-26 04:50:00 UTC (rev 6223)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/Lease.java 2011-01-26 04:54:17 UTC (rev 6224)
@@ -23,6 +23,7 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.util.TimerUtil;
+import org.jboss.util.id.GUID;
import java.util.Collection;
import java.util.HashMap;
@@ -59,6 +60,9 @@
private static final Logger log = Logger.getLogger(Lease.class);
private static final boolean isTraceEnabled = log.isTraceEnabled();
+
+ /** Used by ConnectionValidator to detect a change of server. **/
+ protected String leaseId = new GUID().toString();
public Lease(String clientSessionId, long leasePeriod, String locatorurl, Map requestPayload,
ConnectionNotifier notifier, Map clientLeases)
@@ -355,6 +359,11 @@
{
return leasePingerId;
}
+
+ protected String getLeaseId()
+ {
+ return leaseId;
+ }
private void stopLease()
{
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2011-01-26 04:50:00 UTC (rev 6223)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2011-01-26 04:54:17 UTC (rev 6224)
@@ -798,19 +798,20 @@
if (invokerSessionId != null)
{
// 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);
+ String leaseId = checkForClientLease(invokerSessionId);
+ Boolean success = leaseId == null ? Boolean.FALSE : Boolean.TRUE;
+ if (trace) log.trace(this + " responding " + leaseId + " to $PING$ for invoker sessionId " + invokerSessionId);
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);
+ responseMap.put(Remoting.SERVER_ID, leaseId);
+ if (trace) log.trace(this + " returning leaseId: " + leaseId);
+ return new InvocationResponse(invocation.getSessionId(), success, false, responseMap);
}
else
{
- if (trace) log.trace(this + " not returning serverId: " + serverId);
- return new Boolean(response);
+ if (trace) log.trace(this + " not returning leaseId: " + leaseId);
+ return success;
}
}
else
@@ -1902,7 +1903,7 @@
}
}
- private boolean checkForClientLease(String invokerSessionId)
+ private String checkForClientLease(String invokerSessionId)
{
if(leaseManagement && invokerSessionId != null)
{
@@ -1912,16 +1913,16 @@
if(clientLease == null)
{
if(trace) { log.trace("No lease established for invoker session id (" + invokerSessionId + ")"); }
- return false;
+ return null;
}
else
{
if(trace) { log.trace("Found lease for invoker session id (" + invokerSessionId + ")"); }
- return true;
+ return clientLease.getLeaseId();
}
}
- return false;
+ return null;
}
/**
More information about the jboss-remoting-commits
mailing list