Search in sources :

Example 6 with ISharedObjectContext

use of org.eclipse.ecf.core.sharedobject.ISharedObjectContext in project ecf by eclipse.

the class RemoteAgent method unsubscribe.

public void unsubscribe(ID requestorID) {
    synchronized (subscriptionMutex) {
        if (subscribers == null)
            return;
        subscribers.remove(requestorID);
        if (subscribers.isEmpty()) {
            ISharedObjectContext ctx = config.getContext();
            try {
                ctx.sendMessage(config.getHomeContainerID(), new UnsubscribeMessage());
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            ctx.getSharedObjectManager().removeSharedObject(config.getSharedObjectID());
        }
    }
}
Also used : UnsubscribeMessage(org.eclipse.ecf.pubsub.impl.UnsubscribeMessage) ISharedObjectContext(org.eclipse.ecf.core.sharedobject.ISharedObjectContext) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)6 ISharedObjectContext (org.eclipse.ecf.core.sharedobject.ISharedObjectContext)6 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)4 IPublishedService (org.eclipse.ecf.pubsub.IPublishedService)4 Map (java.util.Map)3 PlatformObject (org.eclipse.core.runtime.PlatformObject)3 PublishedServiceDescriptor (org.eclipse.ecf.pubsub.PublishedServiceDescriptor)3 ID (org.eclipse.ecf.core.identity.ID)2 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ReplicaSharedObjectDescription (org.eclipse.ecf.core.sharedobject.ReplicaSharedObjectDescription)1 SubscribeMessage (org.eclipse.ecf.pubsub.impl.SubscribeMessage)1 UnsubscribeMessage (org.eclipse.ecf.pubsub.impl.UnsubscribeMessage)1