1 22 package org.jboss.mq.il.jvm; 23 24 import javax.jms.IllegalStateException ; 25 import javax.jms.JMSException ; 26 27 import org.jboss.mq.Connection; 28 import org.jboss.mq.ReceiveRequest; 29 import org.jboss.mq.SpyDestination; 30 import org.jboss.mq.il.ClientIL; 31 32 40 public class JVMClientIL implements ClientIL 41 { 42 43 Connection connection; 45 boolean stopped = true; 47 48 JVMClientIL(Connection c) 49 { 50 connection = c; 51 } 52 53 58 public void close() 59 throws Exception 60 { 61 if (stopped) 62 { 63 throw new IllegalStateException ("The client IL is stopped"); 64 } 65 connection.asynchClose(); 66 } 67 68 75 public void deleteTemporaryDestination(SpyDestination dest) 76 throws JMSException 77 { 78 if (stopped) 79 { 80 throw new IllegalStateException ("The client IL is stopped"); 81 } 82 connection.asynchDeleteTemporaryDestination(dest); 83 } 84 85 91 public void receive(ReceiveRequest messages[]) 92 throws Exception 93 { 94 if (stopped) 95 { 96 throw new IllegalStateException ("The client IL is stopped"); 97 } 98 99 for (int i = 0; i < messages.length; i++) 101 { 102 messages[i].message = messages[i].message.myClone(); 103 } 104 105 connection.asynchDeliver(messages); 106 } 107 108 114 public void pong(long serverTime) 115 throws IllegalStateException 116 { 117 if (stopped) 118 { 119 throw new IllegalStateException ("The client IL is stopped"); 120 } 121 connection.asynchPong(serverTime); 122 } 123 } 124 | Popular Tags |