Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis@composent.com2010-10-17 19:14:23 +0000
committerslewis@composent.com2010-10-17 19:14:23 +0000
commit0b941f0af799e88f15b941ae217fea5c3f145720 (patch)
tree6df9dfc28876532619c135f8fd0202f4d06a1568 /providers
parentfd639fc23cf7fb4ee56bbd3bcfe4c192cfc66c17 (diff)
downloadorg.eclipse.ecf-0b941f0af799e88f15b941ae217fea5c3f145720.tar.gz
org.eclipse.ecf-0b941f0af799e88f15b941ae217fea5c3f145720.tar.xz
org.eclipse.ecf-0b941f0af799e88f15b941ae217fea5c3f145720.zip
Partial fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=327919
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/.settings/org.eclipse.pde.api.tools.prefs185
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java116
2 files changed, 176 insertions, 125 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice/.settings/org.eclipse.pde.api.tools.prefs b/providers/bundles/org.eclipse.ecf.provider.remoteservice/.settings/org.eclipse.pde.api.tools.prefs
index bac7ed80c..6525bfd7e 100644
--- a/providers/bundles/org.eclipse.ecf.provider.remoteservice/.settings/org.eclipse.pde.api.tools.prefs
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice/.settings/org.eclipse.pde.api.tools.prefs
@@ -1,91 +1,94 @@
-#Thu Feb 12 13:10:24 PST 2009
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Ignore
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Ignore
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
+#Sun Oct 17 11:34:32 PDT 2010
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Ignore
+LEAK_METHOD_RETURN_TYPE=Ignore
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
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 8b84581d9..6f13ba37f 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
@@ -34,6 +34,8 @@ import org.eclipse.osgi.framework.eventmgr.*;
import org.osgi.framework.*;
public class RegistrySharedObject extends BaseSharedObject implements IRemoteServiceContainerAdapter {
+
+ private static final boolean DEBUG = false;
/**
* registry impl for local remote service registrations
*/
@@ -394,13 +396,9 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
} else if (arg0 instanceof IContainerEjectedEvent) {
handleContainerEjectedEvent((IContainerEjectedEvent) arg0);
} else if (arg0 instanceof ISharedObjectActivatedEvent) {
- if (isConnected()) {
- // We're already connected, so add existing members
- // to expected set and send request for update
- addPendingContainers(getGroupMemberIDs());
- sendRegistryUpdateRequest();
- setRegistryConnected(true);
- }
+ // If it's us that's being activated, then we do something about it
+ if (getID().equals(((ISharedObjectActivatedEvent) arg0).getActivatedID()))
+ handleRegistryActivatedEvent();
}
return false;
}
@@ -409,6 +407,35 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
}
/**
+ * @since 3.4
+ */
+ protected void handleRegistryActivatedEvent() {
+ // Only do something with this if we're already connected
+ ID[] members = getGroupMemberIDs();
+ ID localContainerID = getLocalContainerID();
+ ID connectedID = getConnectedID();
+ if (DEBUG) {
+ System.out.println("handleRegistryActivatedEvent localContainerID=" + getLocalContainerID() + ",members=" + Arrays.asList(members)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ // Only do this if we've already been connected
+ if (isConnected()) {
+ for (int i = 0; i < members.length; i++) {
+ // Don't do this for us
+ if (!members[i].equals(localContainerID)) {
+ // Add the target to the set of pending update containers. These are the ones we expect
+ // to hear from about their registry contents
+ addPendingContainers(new ID[] {members[i]});
+ // And send a registry update to the given target
+ sendRegistryUpdate(members[i]);
+ // If we are now connected, then set our registry connected
+ if (connectedID.equals(members[i]))
+ setRegistryConnected(true);
+ }
+ }
+ }
+ }
+
+ /**
* @since 3.3
*/
protected void handleContainerEjectedEvent(IContainerEjectedEvent arg0) {
@@ -483,8 +510,15 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
private boolean removePendingContainers(ID id) {
if (id == null)
return false;
+ ID localContainerID = getLocalContainerID();
+ if (localContainerID.equals(id))
+ return false;
synchronized (pendingUpdateContainers) {
Object result = pendingUpdateContainers.remove(id);
+ if (DEBUG) {
+ if (result != null)
+ System.out.println("removePendingContainers localContainerID=" + getLocalContainerID() + ",REMOVED=" + result + ",pendingUpdateContainers=" + pendingUpdateContainers); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
Trace.trace(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.DEBUG, this.getClass(), getLocalContainerID() + ".removePendingContainers", "removed containerID=" + id + ",pendingUpdateContainer=" + pendingUpdateContainers); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
pendingUpdateContainers.notify();
return result != null;
@@ -520,22 +554,27 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
}
protected void handleContainerConnectedEvent(IContainerConnectedEvent event) {
- Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), "handleContainerConnectedEvent", event); //$NON-NLS-1$
- // If we're a group manager or the newly connected container is the
- // group manager
- ID targetID = event.getTargetID();
+ handleTargetConnected(event.getTargetID());
+ }
+
+ /**
+ * @since 3.4
+ */
+ protected void handleTargetConnected(ID targetID) {
+ if (DEBUG) {
+ System.out.println("handleTargetConnected localContainerID=" + getLocalContainerID() + ",targetID=" + targetID); //$NON-NLS-1$ //$NON-NLS-2$
+ }
// Add the target to the set of pending update containers. These are the ones we expect
// to hear from about their registry contents
addPendingContainers(new ID[] {targetID});
// And send a registry update to the given target
sendRegistryUpdate(targetID);
// If we are now connected, then set our registry connected
- ID connectedID = getConnectedID();
- if (connectedID != null && connectedID.equals(targetID))
+ if (getConnectedID().equals(targetID))
setRegistryConnected(true);
- Trace.exiting(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_EXITING, this.getClass(), "handleContainerConnectedEvent"); //$NON-NLS-1$
}
+ // generic
private Request createRequest(RemoteServiceRegistrationImpl remoteRegistration, IRemoteCall call, IRemoteCallListener listener) {
final RemoteServiceReferenceImpl refImpl = (RemoteServiceReferenceImpl) remoteRegistration.getReference();
return new Request(this.getLocalContainerID(), remoteRegistration.getServiceId(), RemoteCallImpl.createRemoteCall(refImpl.getRemoteClass(), call.getMethod(), call.getParameters(), call.getTimeout()), listener);
@@ -902,6 +941,9 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
* @since 3.3
*/
protected void sendAddRegistrations(ID receiver, Integer requestId, RemoteServiceRegistrationImpl[] regs) {
+ if (DEBUG) {
+ System.out.println("sendAddRegistrations localContainerID=" + getLocalContainerID() + ",remoteContainerID=" + receiver + ",requestId=" + requestId + ",registrations=" + Arrays.asList(regs)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), "sendAddRegistrations", new Object[] {receiver, requestId, regs}); //$NON-NLS-1$
try {
sendSharedObjectMsgTo(receiver, SharedObjectMsg.createMsg(null, ADD_REGISTRATIONS, getLocalContainerID(), requestId, regs));
@@ -936,13 +978,17 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
* @since 3.3
*/
protected void handleAddRegistrations(ID remoteContainerID, Integer requestId, final RemoteServiceRegistrationImpl[] registrations) {
+ if (DEBUG) {
+ System.out.println("handleAddRegistrations localContainerID=" + getLocalContainerID() + ",remoteContainerID=" + remoteContainerID + ",requestId=" + requestId + ",registrations=" + Arrays.asList(registrations)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), ADD_REGISTRATIONS, new Object[] {remoteContainerID, registrations});
ID localContainerID = getLocalContainerID();
if (remoteContainerID == null || localContainerID == null || localContainerID.equals(remoteContainerID)) {
return;
}
List addedRegistrations = new ArrayList();
- if (registrations != null && registrations.length > 0) {
+ if (registrations != null) {
synchronized (remoteRegistrys) {
// Find registry for remoteContainer
RemoteServiceRegistryImpl registry = getRemoteRegistry(remoteContainerID);
@@ -962,9 +1008,6 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
}
}
}
- // Outside synchronized block do notification
- if (requestId != null)
- notifyAddRegistrationResponse(remoteContainerID, requestId, null);
// remove pending containers
removePendingContainers(remoteContainerID);
@@ -976,6 +1019,9 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
}
protected void handleAddRegistration(ID remoteContainerID, Integer requestId, final RemoteServiceRegistrationImpl registration) {
+ if (DEBUG) {
+ System.out.println("handleAddRegistration localContainerID=" + getLocalContainerID() + ",requestId=" + requestId + ",registration=" + registration); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), ADD_REGISTRATION, new Object[] {remoteContainerID, registration});
ID localContainerID = getLocalContainerID();
if (remoteContainerID == null || localContainerID == null || localContainerID.equals(remoteContainerID)) {
@@ -1302,26 +1348,28 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), "sendUnregister", new Object[] {serviceRegistration}); //$NON-NLS-1$
synchronized (localRegistry) {
localRegistry.unpublishService(serviceRegistration);
- final ID containerID = serviceRegistration.getContainerID();
- final Long serviceId = new Long(serviceRegistration.getServiceId());
- // Get targetIds from serviceRegistration properties
- ID[] targetIds = getTargetsFromProperties(serviceRegistration.properties);
- // If none/null, then send unregister message to all group members
- if (targetIds == null) {
- try {
- this.sendSharedObjectMsgTo(null, SharedObjectMsg.createMsg(UNREGISTER, new Object[] {containerID, serviceId}));
- } catch (final IOException e) {
- log(UNREGISTER_ERROR_CODE, UNREGISTER_ERROR_MESSAGE, e);
- }
- } else
- // Send an unregister message to all targetIds
- for (int i = 0; i < targetIds.length; i++) {
+ if (isConnected()) {
+ final ID containerID = serviceRegistration.getContainerID();
+ final Long serviceId = new Long(serviceRegistration.getServiceId());
+ // Get targetIds from serviceRegistration properties
+ ID[] targetIds = getTargetsFromProperties(serviceRegistration.properties);
+ // If none/null, then send unregister message to all group members
+ if (targetIds == null) {
try {
- this.sendSharedObjectMsgTo(targetIds[i], SharedObjectMsg.createMsg(UNREGISTER, new Object[] {containerID, serviceId}));
+ this.sendSharedObjectMsgTo(null, SharedObjectMsg.createMsg(UNREGISTER, new Object[] {containerID, serviceId}));
} catch (final IOException e) {
log(UNREGISTER_ERROR_CODE, UNREGISTER_ERROR_MESSAGE, e);
}
- }
+ } else
+ // Send an unregister message to all targetIds
+ for (int i = 0; i < targetIds.length; i++) {
+ try {
+ this.sendSharedObjectMsgTo(targetIds[i], SharedObjectMsg.createMsg(UNREGISTER, new Object[] {containerID, serviceId}));
+ } catch (final IOException e) {
+ log(UNREGISTER_ERROR_CODE, UNREGISTER_ERROR_MESSAGE, e);
+ }
+ }
+ }
}
fireRemoteServiceListeners(createUnregisteredEvent(serviceRegistration));
Trace.exiting(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_EXITING, this.getClass(), "sendUnregister"); //$NON-NLS-1$

Back to the top