Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2010-12-21 16:35:00 +0000
committerslewis2010-12-21 16:35:00 +0000
commit2feb5a0dda238b630d289c3fbed4c1a1468ef770 (patch)
treec0f11a8c01dfe022b8fe5c2d2dfd16ba5abac95e /incubation
parent0a21d56783558a5abbd8186ba0c714774857d65f (diff)
downloadorg.eclipse.ecf-2feb5a0dda238b630d289c3fbed4c1a1468ef770.tar.gz
org.eclipse.ecf-2feb5a0dda238b630d289c3fbed4c1a1468ef770.tar.xz
org.eclipse.ecf-2feb5a0dda238b630d289c3fbed4c1a1468ef770.zip
rsa simplifications
Diffstat (limited to 'incubation')
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportReference.java1
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportRegistration.java83
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportReference.java3
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportRegistration.java30
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java7
5 files changed, 49 insertions, 75 deletions
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportReference.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportReference.java
index ee42149b6..33361a946 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportReference.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportReference.java
@@ -36,7 +36,6 @@ public class ExportReference implements
this.endpointDescription = null;
}
- @Override
public synchronized String toString() {
return "ExportReference[serviceReference=" + serviceReference
+ ", endpointDescription=" + endpointDescription + "]";
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportRegistration.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportRegistration.java
index 97038fc50..df0d71711 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportRegistration.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ExportRegistration.java
@@ -19,78 +19,65 @@ public class ExportRegistration implements
private IRemoteServiceRegistration rsRegistration;
private ExportReference exportReference;
- private Throwable throwable;
-
- private final Object closeLock = new Object();
+ private ServiceReference serviceReference;
+ private Throwable exception;
public ExportRegistration(IRemoteServiceRegistration rsRegistration,
- ServiceReference serviceReference,
+ ServiceReference proxyServiceReference,
EndpointDescription endpointDescription) {
Assert.isNotNull(rsRegistration);
this.rsRegistration = rsRegistration;
- this.exportReference = new ExportReference(serviceReference,
+ this.serviceReference = proxyServiceReference;
+ this.exportReference = new ExportReference(proxyServiceReference,
endpointDescription);
}
- public ExportRegistration(Throwable t) {
- this.throwable = t;
+ public ExportRegistration(ServiceReference serviceReference, Throwable t) {
+ this.serviceReference = serviceReference;
+ this.exception = t;
}
- public org.osgi.service.remoteserviceadmin.ExportReference getExportReference() {
- synchronized (closeLock) {
- Throwable t = getException();
- if (t != null)
- throw new IllegalStateException(
- "Cannot get export reference as registration not properly initialized",
- t);
- return exportReference;
- }
+ public synchronized org.osgi.service.remoteserviceadmin.ExportReference getExportReference() {
+ Throwable t = getException();
+ if (t != null)
+ throw new IllegalStateException(
+ "Cannot get export reference as registration not properly initialized",
+ t);
+ return exportReference;
}
- public boolean matchesServiceReference(ServiceReference serviceReference) {
+ public synchronized boolean matchesServiceReference(
+ ServiceReference serviceReference) {
if (serviceReference == null)
return false;
- synchronized (closeLock) {
- if (exportReference == null)
- return false;
- ServiceReference sr = exportReference.getExportedService();
- if (sr.equals(serviceReference))
- return true;
- else
- return false;
- }
+ return (this.serviceReference.equals(serviceReference));
}
- public IRemoteServiceRegistration getRemoteServiceRegistration() {
+ public synchronized IRemoteServiceRegistration getRemoteServiceRegistration() {
return rsRegistration;
}
- public void close() {
- synchronized (closeLock) {
- if (rsRegistration != null) {
- rsRegistration.unregister();
- rsRegistration = null;
- }
- if (exportReference != null) {
- exportReference.close();
- exportReference = null;
- }
- throwable = null;
+ public synchronized void close() {
+ if (rsRegistration != null) {
+ rsRegistration.unregister();
+ rsRegistration = null;
}
+ if (exportReference != null) {
+ exportReference.close();
+ exportReference = null;
+ }
+ exception = null;
}
- public Throwable getException() {
- synchronized (closeLock) {
- return throwable;
- }
+ public synchronized Throwable getException() {
+ return exception;
}
- public String toString() {
- synchronized (closeLock) {
- return "ExportRegistration[rsRegistration=" + rsRegistration
- + ", exportReference=" + exportReference + ", throwable="
- + throwable + "]";
- }
+ public synchronized String toString() {
+ return "ExportRegistration[rsRegistration=" + rsRegistration
+ + ", exportReference=" + exportReference
+ + ", serviceReference=" + serviceReference + ", exception="
+ + exception + "]";
}
}
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportReference.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportReference.java
index e04c956a5..b733876e6 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportReference.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportReference.java
@@ -36,8 +36,7 @@ public class ImportReference implements
this.endpointDescription = null;
}
- @Override
- public String toString() {
+ public synchronized String toString() {
return "ImportReference[importedServiceReference="
+ importedServiceReference + ", endpointDescription="
+ endpointDescription + "]";
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportRegistration.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportRegistration.java
index 9fcbfe0ee..77c2abce7 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportRegistration.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/ImportRegistration.java
@@ -25,9 +25,8 @@ public class ImportRegistration implements
private ServiceRegistration importRegistration;
private ImportReference importReference;
private Throwable throwable;
- private final Object closeLock = new Object();
- protected ImportRegistration(IRemoteServiceContainer rsContainer,
+ public ImportRegistration(IRemoteServiceContainer rsContainer,
IRemoteServiceListener rsListener,
IRemoteServiceReference rsReference,
EndpointDescription endpointDescription,
@@ -47,36 +46,29 @@ public class ImportRegistration implements
rsContainer.getContainerAdapter().addRemoteServiceListener(rsListener);
}
- protected ImportRegistration(IRemoteServiceContainer rsContainer, Throwable t) {
+ public ImportRegistration(IRemoteServiceContainer rsContainer, Throwable t) {
this.rsContainer = rsContainer;
this.throwable = t;
}
- public IRemoteServiceReference getRemoteServiceReference() {
- synchronized (closeLock) {
+ public synchronized IRemoteServiceReference getRemoteServiceReference() {
return rsReference;
- }
}
- public IRemoteServiceContainer getRemoteServiceContainer() {
- synchronized (closeLock) {
+ public synchronized IRemoteServiceContainer getRemoteServiceContainer() {
return rsContainer;
- }
}
- public ImportReference getImportReference() {
- synchronized (closeLock) {
+ public synchronized ImportReference getImportReference() {
Throwable t = getException();
if (t != null)
throw new IllegalStateException(
"Cannot get import reference as registration not properly initialized",
t);
return importReference;
- }
}
- public void close() {
- synchronized (closeLock) {
+ public synchronized void close() {
if (importRegistration != null) {
importRegistration.unregister();
importRegistration = null;
@@ -95,20 +87,16 @@ public class ImportRegistration implements
importReference = null;
}
throwable = null;
- }
}
- public Throwable getException() {
- synchronized (closeLock) {
+ public synchronized Throwable getException() {
return throwable;
- }
}
- @Override
- public String toString() {
+ public synchronized String toString() {
return "ImportRegistration [rsReference=" + rsReference
+ ", importReference=" + importReference + ", throwable="
- + throwable + ", closeLock=" + closeLock + "]";
+ + throwable + "]";
}
}
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
index 1e348d4c2..207961bba 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
@@ -83,7 +83,7 @@ public class RemoteServiceAdmin extends AbstractRemoteServiceAdmin implements
+ serviceReference + " with properties="
+ properties + " rsContainerID="
+ rsContainers[i].getContainer().getID(), e);
- rsRegistration = new ExportRegistration(e);
+ rsRegistration = new ExportRegistration(serviceReference,e);
}
results.add(rsRegistration);
exportedRegistrations.add(rsRegistration);
@@ -300,12 +300,13 @@ public class RemoteServiceAdmin extends AbstractRemoteServiceAdmin implements
.add((EndpointDescription) endpointDescription);
}
}
- exportRegs[i].close();
- exportedRegistrations.remove(exportRegs[i]);
} catch (IllegalStateException e) {
// no export ref because ExportRegistration not
// initialized properly
}
+ // close and remove the export registration no matter what
+ exportRegs[i].close();
+ exportedRegistrations.remove(exportRegs[i]);
}
}
}

Back to the top