1 24 package org.objectweb.joram.client.jms; 25 26 import java.util.Vector ; 27 import java.util.Hashtable ; 28 29 import javax.jms.JMSException ; 30 import javax.jms.JMSSecurityException ; 31 import javax.naming.NamingException ; 32 33 import org.objectweb.joram.shared.client.TempDestDeleteRequest; 34 35 import org.objectweb.util.monolog.api.BasicLevel; 36 import org.objectweb.joram.shared.JoramTracing; 37 38 41 public class TemporaryQueue extends Queue implements javax.jms.TemporaryQueue { 42 private final static String TMP_QUEUE_TYPE = "queue.tmp"; 43 44 public static boolean isTemporaryQueue(String type) { 45 return Destination.isAssignableTo(type, TMP_QUEUE_TYPE); 46 } 47 48 49 private Connection cnx; 50 51 public TemporaryQueue() {} 53 54 61 public TemporaryQueue(String agentId, Connection cnx) { 62 super(agentId, TMP_QUEUE_TYPE); 63 this.cnx = cnx; 64 } 65 66 67 public String toString() 68 { 69 return "TempQueue:" + agentId; 70 } 71 72 78 public void delete() throws JMSException 79 { 80 if (cnx == null) 81 throw new JMSSecurityException ("Forbidden call as this TemporaryQueue" 82 + " does not belong to this connection."); 83 84 if (JoramTracing.dbgClient.isLoggable(BasicLevel.DEBUG)) 85 JoramTracing.dbgClient.log(BasicLevel.DEBUG, "--- " + this 86 + ": deleting..."); 87 88 cnx.checkConsumers(agentId); 90 91 cnx.syncRequest(new TempDestDeleteRequest(agentId)); 93 94 if (JoramTracing.dbgClient.isLoggable(BasicLevel.DEBUG)) 95 JoramTracing.dbgClient.log(BasicLevel.DEBUG, this + ": deleted."); 96 } 97 98 102 public Connection getCnx() 103 { 104 return cnx; 105 } 106 } 107 | Popular Tags |