1 22 package org.jboss.mq.server; 23 24 import javax.jms.JMSException ; 25 26 import org.jboss.mq.SpyDestination; 27 import org.jboss.mq.Subscription; 28 29 35 public class ExclusiveQueue 36 extends BasicQueue 37 { 38 Subscription exclusive; 39 boolean removed = false; 40 41 public ExclusiveQueue 42 ( 43 JMSDestinationManager server, 44 SpyDestination destination, 45 Subscription exclusive, 46 BasicQueueParameters parameters 47 ) 48 throws JMSException 49 { 50 super 51 ( 52 server, 53 destination.toString() + "." + exclusive.connectionToken.getClientID() + '.' + exclusive.subscriptionId, 54 parameters 55 ); 56 this.exclusive = exclusive; 57 } 58 59 public Subscription getExclusiveSubscription() 60 { 61 return exclusive; 62 } 63 64 public void addMessage(MessageReference mesRef, org.jboss.mq.pm.Tx txId) 65 throws JMSException 66 { 67 if (removed || exclusive.accepts(mesRef.getHeaders()) == false) 69 dropMessage(mesRef); 70 else 71 super.addMessage( mesRef, txId ); 72 } 73 74 public void restoreMessage(MessageReference mesRef) 75 { 76 if (removed) 77 dropMessage(mesRef); 78 else 79 super.restoreMessage(mesRef); 80 } 81 82 protected void nackMessage(MessageReference mesRef) 83 { 84 if (removed) 85 dropMessage(mesRef); 86 else 87 super.nackMessage(mesRef); 88 } 89 90 public void removeSubscriber(Subscription sub) 91 { 92 removed = true; 93 super.removeSubscriber(sub); 94 } 95 } 96 | Popular Tags |