1 24 package org.objectweb.joram.mom.dest; 25 26 import java.util.Properties ; 27 28 import org.objectweb.joram.mom.notifications.AckJoinQueueCluster; 29 import org.objectweb.joram.mom.notifications.JoinQueueCluster; 30 import org.objectweb.joram.mom.notifications.LBCycleLife; 31 import org.objectweb.joram.mom.notifications.LBMessageGive; 32 import org.objectweb.joram.mom.notifications.LBMessageHope; 33 import org.objectweb.joram.mom.notifications.LeaveQueueCluster; 34 import org.objectweb.joram.mom.notifications.ReceiveRequest; 35 import org.objectweb.joram.mom.notifications.SetRightQueueCluster; 36 import org.objectweb.joram.mom.notifications.WakeUpNot; 37 import org.objectweb.joram.shared.JoramTracing; 38 import org.objectweb.util.monolog.api.BasicLevel; 39 40 import fr.dyade.aaa.agent.AgentId; 41 import fr.dyade.aaa.agent.Notification; 42 43 49 public class ClusterQueue extends Queue { 50 53 protected ClusterQueue() {} 54 55 61 public DestinationImpl createsImpl(AgentId adminId, Properties prop) { 62 ClusterQueueImpl queueImpl = new ClusterQueueImpl(getId(), adminId, prop); 63 return queueImpl; 64 } 65 66 70 public void react(AgentId from, Notification not) 71 throws Exception { 72 73 if (JoramTracing.dbgDestination.isLoggable(BasicLevel.DEBUG)) 74 JoramTracing.dbgDestination.log(BasicLevel.DEBUG, "--- " + this + 75 " react(" + from + "," + not + ")"); 76 77 if (not instanceof AckJoinQueueCluster) 78 ((ClusterQueueImpl) destImpl).ackJoinQueueCluster((AckJoinQueueCluster) not); 79 else if (not instanceof JoinQueueCluster) 80 ((ClusterQueueImpl) destImpl).joinQueueCluster((JoinQueueCluster) not); 81 else if (not instanceof LeaveQueueCluster) 82 ((ClusterQueueImpl) destImpl).removeQueueCluster(((LeaveQueueCluster) not).removeQueue); 83 else if (not instanceof ReceiveRequest) { 84 super.react(from, not); 85 ((ClusterQueueImpl) destImpl).receiveRequest((ReceiveRequest) not); 86 } else if (not instanceof LBMessageGive) 87 ((ClusterQueueImpl) destImpl).lBMessageGive(from, (LBMessageGive) not); 88 else if (not instanceof LBMessageHope) 89 ((ClusterQueueImpl) destImpl).lBMessageHope(from, (LBMessageHope) not); 90 else if (not instanceof LBCycleLife) 91 ((ClusterQueueImpl) destImpl).lBCycleLife(from, (LBCycleLife) not); 92 else if (not instanceof WakeUpNot) { 93 super.react(from, not); 94 ((ClusterQueueImpl) destImpl).wakeUpNot((WakeUpNot) not); 95 } else if (not instanceof SetRightQueueCluster) 96 ((ClusterQueueImpl) destImpl).setRightQueueCluster((SetRightQueueCluster) not); 97 else 98 super.react(from, not); 99 } 100 } 101 | Popular Tags |