KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mq > il > rmi > RMIClientIL


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.rmi;
23
24 import javax.jms.IllegalStateException JavaDoc;
25 import javax.jms.JMSException JavaDoc;
26
27 import org.jboss.mq.Connection;
28 import org.jboss.mq.ReceiveRequest;
29 import org.jboss.mq.SpyDestination;
30
31 /**
32  * The RMI implementation of the ConnectionReceiver object
33  *
34  * @author Norbert Lataille (Norbert.Lataille@m4x.org)
35  * @author Hiram Chirino (Cojonudo14@hotmail.com)
36  * @version $Revision: 37459 $
37  * @created August 16, 2001
38  */

39 public class RMIClientIL extends java.rmi.server.UnicastRemoteObject JavaDoc implements RMIClientILRemote
40 {
41
42    /** The serialVersionUID */
43    private static final long serialVersionUID = -2587261916187410219L;
44
45    // A reference to the connection
46
Connection connection;
47    // Are we running
48
boolean stopped = true;
49
50    public RMIClientIL(Connection c)
51           throws java.rmi.RemoteException JavaDoc
52    {
53       connection = c;
54    }
55
56    /**
57     * #Description of the Method
58     *
59     * @exception Exception Description of Exception
60     */

61    public void close()
62           throws Exception JavaDoc
63    {
64       if (stopped)
65       {
66          throw new IllegalStateException JavaDoc("The client IL is stopped");
67       }
68       connection.asynchClose();
69    }
70
71    //One TemporaryDestination has been deleted
72
/**
73     * #Description of the Method
74     *
75     * @param dest Description of Parameter
76     * @exception JMSException Description of Exception
77     */

78    public void deleteTemporaryDestination(SpyDestination dest)
79           throws JMSException JavaDoc
80    {
81       if (stopped)
82       {
83          throw new IllegalStateException JavaDoc("The client IL is stopped");
84       }
85       connection.asynchDeleteTemporaryDestination(dest);
86    }
87
88    /**
89     * #Description of the Method
90     *
91     * @param messages Description of Parameter
92     * @exception Exception Description of Exception
93     */

94    public void receive(ReceiveRequest messages[])
95           throws Exception JavaDoc
96    {
97       if (stopped)
98       {
99          throw new IllegalStateException JavaDoc("The client IL is stopped");
100       }
101       connection.asynchDeliver(messages);
102    }
103
104    /**
105     * pong method comment.
106     *
107     * @param serverTime Description of Parameter
108     * @exception JMSException Description of Exception
109     */

110    public void pong(long serverTime)
111           throws JMSException JavaDoc
112    {
113       if (stopped)
114       {
115          throw new IllegalStateException JavaDoc("The client IL is stopped");
116       }
117       connection.asynchPong(serverTime);
118    }
119 }
120
Popular Tags