Search in sources :

Example 1 with SubscribeMessage

use of org.eclipse.ecf.pubsub.impl.SubscribeMessage in project ecf by eclipse.

the class LocalAgent method subscribe.

public void subscribe(ID containerID, ID requestorID) {
    synchronized (subscriptionMutex) {
        if (subscriptions == null)
            subscriptions = new HashSet();
        ISharedObjectContext ctx = config.getContext();
        try {
            if (subscriptions.add(containerID)) {
                ctx.sendCreate(containerID, createRemoteAgentDescription(requestorID));
            } else {
                SubscribeMessage msg = new SubscribeMessage(requestorID);
                ctx.sendMessage(containerID, SerializationUtil.serialize(msg));
            }
        } catch (IOException e) {
            // TODO Log me!
            e.printStackTrace();
        }
    }
}
Also used : SubscribeMessage(org.eclipse.ecf.pubsub.impl.SubscribeMessage) ISharedObjectContext(org.eclipse.ecf.core.sharedobject.ISharedObjectContext) IOException(java.io.IOException) HashSet(java.util.HashSet)

Aggregations

IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 ISharedObjectContext (org.eclipse.ecf.core.sharedobject.ISharedObjectContext)1 SubscribeMessage (org.eclipse.ecf.pubsub.impl.SubscribeMessage)1