Experiment to fix possible race condition that allows confusion over the
use of request ids.
Change-Id: I61862c52b6157d1c489fb5eda26865537b845d7d
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/Request.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/Request.java
index 1b8b793..be62265 100644
--- a/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/Request.java
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/Request.java
@@ -9,7 +9,6 @@
package org.eclipse.ecf.provider.remoteservice.generic;
import java.io.Serializable;
-
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.remoteservice.IRemoteCallListener;
@@ -33,6 +32,12 @@
transient IRemoteCallListener listener = null;
+ private synchronized static long getNextRequestId() {
+ long result = nextRequestId;
+ nextRequestId = (nextRequestId == Long.MAX_VALUE) ? 0L : nextRequestId + 1;
+ return result;
+ }
+
public Request(ID requestContainerID, long serviceId, RemoteCallImpl call) {
this(requestContainerID, serviceId, call, null);
}
@@ -41,7 +46,7 @@
this.requestContainerID = requestContainerID;
this.serviceId = serviceId;
this.call = call;
- this.requestId = nextRequestId++;
+ this.requestId = getNextRequestId();
this.listener = listener;
}