コード例 #1
0
 /*
  * (non-Javadoc)
  *
  * @see
  * cz.cuni.mff.d3s.deeco.knowledge.ShadowKnowledgeManagerRegistry#unregister(cz.cuni
  * .mff.d3s.deeco.model.runtime.api.Trigger,
  * cz.cuni.mff.d3s.deeco.knowledge.ShadowsTriggerListener)
  */
 @Override
 public void unregister(Trigger trigger, ShadowsTriggerListener triggerListener) {
   // Remove from memory
   if (triggerListeners.containsKey(trigger)) {
     triggerListeners.get(trigger).remove(triggerListener);
   }
   // Unregister from kms
   for (KnowledgeManagerTriggerListener tListener :
       listenerToTriggerListeners.get(triggerListener))
     tListener.getKnowledgeManager().unregister(trigger, tListener);
   listenerToTriggerListeners.remove(triggerListener);
 }
コード例 #2
0
 /*
  * (non-Javadoc)
  *
  * @see
  * cz.cuni.mff.d3s.deeco.knowledge.ReplicaListener#replicaRemoved(cz.cuni
  * .mff.d3s.deeco.knowledge.KnowledgeManager)
  */
 @Override
 public void replicaUnregistered(KnowledgeManager km, KnowledgeManagerContainer container) {
   List<KnowledgeManagerTriggerListener> toRemove = new LinkedList<>();
   for (List<KnowledgeManagerTriggerListener> tListeners : listenerToTriggerListeners.values()) {
     toRemove.clear();
     for (KnowledgeManagerTriggerListener tListener : tListeners)
       if (tListener.getKnowledgeManager().equals(km)) {
         km.unregister(tListener.getTrigger(), tListener);
         toRemove.add(tListener);
       }
     tListeners.removeAll(toRemove);
   }
 }