01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jboss.mq.il.uil2;
23:
24: import java.io.Serializable;
25:
26: import org.jboss.logging.Logger;
27: import org.jboss.mq.ReceiveRequest;
28: import org.jboss.mq.SpyDestination;
29: import org.jboss.mq.il.ClientIL;
30: import org.jboss.mq.il.uil2.msgs.MsgTypes;
31: import org.jboss.mq.il.uil2.msgs.DeleteTemporaryDestMsg;
32: import org.jboss.mq.il.uil2.msgs.PingMsg;
33: import org.jboss.mq.il.uil2.msgs.ReceiveRequestMsg;
34:
35: /** UILClient is the server side interface for callbacks into the client. It
36: * is created on the client and sent to the server via the ConnectionToken.
37: *
38: * @author Scott.Stark@jboss.org
39: * @version $Revision: 57198 $
40: */
41: public class UILClientIL implements ClientIL, MsgTypes, Serializable {
42: static final long serialVersionUID = -2667733986731260459L;
43:
44: static Logger log = Logger.getLogger(UILClientIL.class);
45:
46: private transient SocketManager socketMgr;
47:
48: public void close() throws Exception {
49: if (socketMgr != null)
50: socketMgr.stop();
51: }
52:
53: public void deleteTemporaryDestination(SpyDestination dest)
54: throws Exception {
55: DeleteTemporaryDestMsg msg = new DeleteTemporaryDestMsg(dest);
56: socketMgr.sendReply(msg);
57: }
58:
59: public void pong(long serverTime) throws Exception {
60: PingMsg msg = new PingMsg(serverTime, false);
61: msg.getMsgID();
62: socketMgr.sendReply(msg);
63: }
64:
65: public void receive(ReceiveRequest messages[]) throws Exception {
66: ReceiveRequestMsg msg = new ReceiveRequestMsg(messages);
67: // We send this one way and don't wait for a response
68: socketMgr.sendReply(msg);
69: }
70:
71: protected void setSocketMgr(SocketManager socketMgr) {
72: this.socketMgr = socketMgr;
73: }
74: }
|