Beispiel #1
0
 /**
  * Unsubscribe to a topic
  *
  * @param topicId
  * @return
  */
 public boolean unsubscribe(EventTopic et) {
   if (!eventTopicIds.contains(et.getId())) {
     return false;
   }
   eventTopicIds.remove(et.getId());
   // et.subscribersCount--;
   update();
   return true;
 }
Beispiel #2
0
 /**
  * Subscribe to a topic
  *
  * @param et
  * @return
  */
 public boolean subscribe(EventTopic et) {
   if (eventTopicIds.contains(et.getId())) {
     return false;
   }
   eventTopicIds.add(et.getId());
   Collections.sort(eventTopicIds);
   et.subscribersCount++;
   update();
   return true;
 }