KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mq > il > uil2 > UILClientIL


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * 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 JavaDoc;
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: 45305 $
40  */

41 public class UILClientIL
42    implements ClientIL, MsgTypes, Serializable JavaDoc
43 {
44    static final long serialVersionUID = -2667733986731260459L;
45    
46    static Logger log = Logger.getLogger(UILClientIL.class);
47
48    private transient SocketManager socketMgr;
49
50    public void close()
51           throws Exception JavaDoc
52    {
53       if (socketMgr != null)
54          socketMgr.stop();
55    }
56
57    public void deleteTemporaryDestination(SpyDestination dest)
58           throws Exception JavaDoc
59    {
60       DeleteTemporaryDestMsg msg = new DeleteTemporaryDestMsg(dest);
61       socketMgr.sendReply(msg);
62    }
63
64    public void pong(long serverTime)
65           throws Exception JavaDoc
66    {
67       PingMsg msg = new PingMsg(serverTime, false);
68       msg.getMsgID();
69       socketMgr.sendReply(msg);
70    }
71
72    public void receive(ReceiveRequest messages[])
73           throws Exception JavaDoc
74    {
75       ReceiveRequestMsg msg = new ReceiveRequestMsg(messages);
76       // We send this one way and don't wait for a response
77
socketMgr.sendReply(msg);
78    }
79
80    protected void setSocketMgr(SocketManager socketMgr)
81    {
82       this.socketMgr = socketMgr;
83    }
84 }
85
Popular Tags