diff options
5 files changed, 29 insertions, 3 deletions
diff --git a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/Activator.java b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/Activator.java index 3f74dee68..a6934b726 100644 --- a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/Activator.java +++ b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/Activator.java @@ -20,6 +20,9 @@ public class Activator implements BundleActivator { private ServiceRegistration identityServiceRegistration; private BundleContext context; + IDocumentSynchronizationStrategyFactory identity; + IDocumentSynchronizationStrategyFactory cola; + public static Activator getDefault() { return bundle; } @@ -31,16 +34,18 @@ public class Activator implements BundleActivator { public void start(BundleContext ctxt) throws Exception { bundle = this; this.context = ctxt; + this.identity = new IdentitySynchronizationStrategyFactory(); + this.cola = new ColaSynchronizationStrategyFactory(); // Register identity synchronizer service final Dictionary identityServiceProps = new Properties(); identityServiceProps.put(IServiceConstants.SYNCSTRATEGY_TYPE_PROPERTY, IdentitySynchronizationStrategyFactory.SYNCHSTRATEGY_TYPE); identityServiceProps.put(IServiceConstants.SYNCSTRATEGY_PROVIDER_PROPETY, IdentitySynchronizationStrategyFactory.SYNCHSTRATEGY_PROVIDER); - identityServiceRegistration = this.context.registerService(IDocumentSynchronizationStrategyFactory.class.getName(), new IdentitySynchronizationStrategyFactory(), identityServiceProps); + identityServiceRegistration = this.context.registerService(IDocumentSynchronizationStrategyFactory.class.getName(), this.identity, identityServiceProps); // Register cola synchronizer service final Dictionary colaServiceProps = new Properties(); colaServiceProps.put(IServiceConstants.SYNCSTRATEGY_TYPE_PROPERTY, ColaSynchronizationStrategyFactory.SYNCHSTRATEGY_TYPE); colaServiceProps.put(IServiceConstants.SYNCSTRATEGY_PROVIDER_PROPETY, ColaSynchronizationStrategyFactory.SYNCHSTRATEGY_PROVIDER); - colaServiceRegistration = this.context.registerService(IDocumentSynchronizationStrategyFactory.class.getName(), new ColaSynchronizationStrategyFactory(), colaServiceProps); + colaServiceRegistration = this.context.registerService(IDocumentSynchronizationStrategyFactory.class.getName(), this.cola, colaServiceProps); } /* @@ -56,6 +61,14 @@ public class Activator implements BundleActivator { identityServiceRegistration.unregister(); identityServiceRegistration = null; } + if (this.identity != null) { + this.identity.dispose(); + this.identity = null; + } + if (this.cola != null) { + this.cola.dispose(); + this.cola = null; + } this.context = null; bundle = null; } diff --git a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java index 822532982..05cd95a39 100644 --- a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java +++ b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java @@ -39,7 +39,7 @@ public class ColaSynchronizationStrategy implements IModelSynchronizationStrateg private long localOperationsCount; private long remoteOperationsCount; - // <DocShare, ColaSynchronizationStrategy> + // <ID, ColaSynchronizationStrategy> private static Map sessionStrategies = new HashMap(); private ColaSynchronizationStrategy(boolean isInitiator) { @@ -60,6 +60,10 @@ public class ColaSynchronizationStrategy implements IModelSynchronizationStrateg sessionStrategies.remove(client); } + public static void dispose() { + sessionStrategies.clear(); + } + public DocumentChangeMessage registerOutgoingMessage(DocumentChangeMessage localMsg) { Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_ENTERING, this.getClass(), "registerOutgoingMessage", localMsg); //$NON-NLS-1$ final ColaDocumentChangeMessage colaMsg = new ColaDocumentChangeMessage(localMsg, localOperationsCount, remoteOperationsCount); diff --git a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategyFactory.java b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategyFactory.java index 54dc553a9..1a2ade662 100644 --- a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategyFactory.java +++ b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategyFactory.java @@ -36,4 +36,8 @@ public class ColaSynchronizationStrategyFactory implements IDocumentSynchronizat return ColaSynchronizationStrategy.getInstanceFor(uniqueID, isInitiator); } + public void dispose() { + ColaSynchronizationStrategy.dispose(); + } + } diff --git a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/identity/IdentitySynchronizationStrategyFactory.java b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/identity/IdentitySynchronizationStrategyFactory.java index 77576f6d6..fcd314c31 100644 --- a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/identity/IdentitySynchronizationStrategyFactory.java +++ b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/identity/IdentitySynchronizationStrategyFactory.java @@ -35,4 +35,7 @@ public class IdentitySynchronizationStrategyFactory implements IDocumentSynchron return new IdentitySynchronizationStrategy(); } + public void dispose() { + + } } diff --git a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/sync/doc/IDocumentSynchronizationStrategyFactory.java b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/sync/doc/IDocumentSynchronizationStrategyFactory.java index ca68a7e33..2d3770bd1 100644 --- a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/sync/doc/IDocumentSynchronizationStrategyFactory.java +++ b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/sync/doc/IDocumentSynchronizationStrategyFactory.java @@ -37,4 +37,6 @@ public interface IDocumentSynchronizationStrategyFactory { * @param uniqueID the ID of the */ public void disposeSynchronizationStrategy(ID uniqueID); + + public void dispose(); } |