Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2010-08-29 19:20:13 +0000
committerslewis2010-08-29 19:20:13 +0000
commit668a23e059144b23a045b5f3d4acc1f663769b74 (patch)
treecfd64a9317177adc0e80fe6e316bad78a6fb0810 /providers
parent2079a88cd7d25dc17807312f227a34934816f2b0 (diff)
downloadorg.eclipse.ecf-668a23e059144b23a045b5f3d4acc1f663769b74.tar.gz
org.eclipse.ecf-668a23e059144b23a045b5f3d4acc1f663769b74.tar.xz
org.eclipse.ecf-668a23e059144b23a045b5f3d4acc1f663769b74.zip
Fix for ambiguity in handling of remote services when the connect target is not the same client ID as the service host.
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java
index ec86d1347..e51fe8ce2 100644
--- a/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java
@@ -230,16 +230,19 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
// This code cannot be reentrant.
synchronized (rsConnectLock) {
ISharedObjectContext context = getContext();
- // If we don't have a context we can't connect and we're outta here
+ // If we don't have a context we can't connect and we throw a container connect exception
if (context == null)
throw new ContainerConnectException("Cannot connect without context"); //$NON-NLS-1$
ID connectedID = context.getConnectedID();
- // If we're already connected to something then we don't need to connect
+ // If we're already connected to something then we don't need to connect...and we return
if (connectedID != null)
return;
// else we just try to connect to target
context.connect(targetID, connectContext);
+ // wait to receive connected event
waitForConnectedEvent(context, targetID);
+ // Wait for pending registry updates after connect
+ waitForPendingUpdatesAfterConnect(getAddRegistrationRequestTimeout());
}
}
@@ -267,8 +270,9 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
public IRemoteServiceReference[] getRemoteServiceReferences(ID[] idFilter, String clazz, String filter) throws InvalidSyntaxException {
Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), "getRemoteServiceReferences", new Object[] {idFilter, clazz, filter}); //$NON-NLS-1$
final IRemoteFilter remoteFilter = (filter == null) ? null : new RemoteFilterImpl(filter);
- // Wait for pending updates from containers in idFilter
- waitForPendingUpdates(idFilter, getAddRegistrationRequestTimeout());
+ // If the idFilter is not null, then wait for updates from listed IDs given in idFilter
+ if (idFilter != null)
+ waitForPendingUpdates(idFilter, getAddRegistrationRequestTimeout());
// Lookup from remote registrys...add to given references List
final List references = new ArrayList();
addReferencesFromRemoteRegistrys(idFilter, clazz, remoteFilter, references);
@@ -497,6 +501,10 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
return false;
}
+ private void waitForPendingUpdatesAfterConnect(long timeout) {
+ waitForPendingUpdates(null, timeout);
+ }
+
private void waitForPendingUpdates(ID[] containerIDs, long timeout) {
Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), getLocalContainerID() + ".waitForPendingUpdates", new Object[] {containerIDs, new Long(timeout), pendingUpdateContainers}); //$NON-NLS-1$
long startTime = System.currentTimeMillis();
@@ -804,7 +812,7 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
/**
* @since 3.3
*/
- protected static final int ADD_REGISTRATION_REQUEST_TIMEOUT = new Integer(System.getProperty("ecf.addregistrationrequest.timeout", "5000")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
+ protected static final int ADD_REGISTRATION_REQUEST_TIMEOUT = new Integer(System.getProperty("ecf.addregistrationrequest.timeout", "7000")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
protected void sendRegistryUpdateRequest() {
Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), "sendRegistryUpdateRequest"); //$NON-NLS-1$

Back to the top