1 46 package org.mr.api.jms; 47 48 import javax.jms.Destination ; 49 import javax.jms.JMSException ; 50 import javax.jms.TemporaryQueue ; 51 52 import org.mr.MantaException; 53 import org.mr.core.util.byteable.Byteable; 54 import org.mr.core.util.byteable.ByteableInputStream; 55 import org.mr.core.util.byteable.ByteableRegistry; 56 57 import java.io.IOException ; 58 import java.io.Serializable ; 59 60 70 public class MantaTemporaryQueue extends MantaQueue implements Byteable, Destination , Serializable , TemporaryQueue { 71 72 private MantaConnection conn; 73 public MantaTemporaryQueue(String name,MantaConnection con){ 74 super(name); 75 conn=con; 76 } 78 79 86 public void delete() throws JMSException { 87 try { 88 conn.deleteTempQueue(this.destinationName); 89 } catch (MantaException e) { 90 throw new JMSException ("Delete failed "+e.getMessage()); 91 } 92 } 94 final static String objName = "MantaTempQueue"; 95 public String getByteableName() { 96 return objName; 97 } 98 99 public void registerToByteableRegistry() { 100 ByteableRegistry.registerByteableFactory(getByteableName() , this); 101 } 102 103 public static void register() throws JMSException { 104 MantaTemporaryQueue instance = new MantaTemporaryQueue("tmpQ",null); 105 instance.registerToByteableRegistry(); 106 } 107 108 109 public Byteable createInstance(ByteableInputStream in) throws IOException { 110 111 MantaTemporaryQueue cq = new MantaTemporaryQueue(in.readUTF(),null); 112 return cq; 113 } 114 } | Popular Tags |