Search in sources :

Example 1 with UnsubscribeMessage

use of org.eclipse.ecf.pubsub.impl.UnsubscribeMessage 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)1 ISharedObjectContext (org.eclipse.ecf.core.sharedobject.ISharedObjectContext)1 UnsubscribeMessage (org.eclipse.ecf.pubsub.impl.UnsubscribeMessage)1