1 7 package org.jboss.mq.il.oil2; 8 9 import java.io.IOException ; 10 11 import org.jboss.mq.ReceiveRequest; 12 import org.jboss.mq.SpyDestination; 13 import org.jboss.mq.il.ClientIL; 14 15 21 public final class OIL2ClientIL 22 implements ClientIL, 23 java.io.Serializable 24 { 25 static final long serialVersionUID = -2671278802714517625L; 26 transient OIL2ServerILService.RequestListner requestListner; 27 transient OIL2SocketHandler socketHandler; 28 29 public void setRequestListner(OIL2ServerILService.RequestListner requestListner) 30 { 31 this.requestListner = requestListner; 32 this.socketHandler = requestListner.getSocketHandler(); 33 } 34 35 40 public void close() 41 throws Exception 42 { 43 try { 44 45 OIL2Request request = new OIL2Request( 46 OIL2Constants.CLIENT_CLOSE, 47 null); 48 OIL2Response response = socketHandler.synchRequest(request); 49 response.evalThrowsException(); 50 51 } catch ( IOException ignore ) { 52 } 55 56 requestListner.close(); 61 } 62 63 69 public void deleteTemporaryDestination(SpyDestination dest) 70 throws Exception 71 { 72 73 OIL2Request request = new OIL2Request( 74 OIL2Constants.CLIENT_DELETE_TEMPORARY_DESTINATION, 75 new Object [] {dest}); 76 OIL2Response response = socketHandler.synchRequest(request); 77 response.evalThrowsException(); 78 } 79 80 86 public void pong(long serverTime) 87 throws Exception 88 { 89 OIL2Request request = new OIL2Request( 90 OIL2Constants.CLIENT_PONG, 91 new Object [] {new Long (serverTime)}); 92 OIL2Response response = socketHandler.synchRequest(request); 93 response.evalThrowsException(); 94 } 95 96 102 public void receive(ReceiveRequest messages[]) 103 throws Exception 104 { 105 106 OIL2Request request = new OIL2Request( 107 OIL2Constants.CLIENT_RECEIVE, 108 new Object [] {messages}); 109 OIL2Response response = socketHandler.synchRequest(request); 110 response.evalThrowsException(); 111 } 112 113 } 114 | Popular Tags |