001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.mq.il.rmi;
023:
024: import javax.jms.IllegalStateException;
025: import javax.jms.JMSException;
026:
027: import org.jboss.mq.Connection;
028: import org.jboss.mq.ReceiveRequest;
029: import org.jboss.mq.SpyDestination;
030:
031: /**
032: * The RMI implementation of the ConnectionReceiver object
033: *
034: * @author Norbert Lataille (Norbert.Lataille@m4x.org)
035: * @author Hiram Chirino (Cojonudo14@hotmail.com)
036: * @version $Revision: 57198 $
037: * @created August 16, 2001
038: */
039: public class RMIClientIL extends java.rmi.server.UnicastRemoteObject
040: implements RMIClientILRemote {
041:
042: /** The serialVersionUID */
043: private static final long serialVersionUID = -2587261916187410219L;
044:
045: // A reference to the connection
046: Connection connection;
047: // Are we running
048: boolean stopped = true;
049:
050: public RMIClientIL(Connection c) throws java.rmi.RemoteException {
051: connection = c;
052: }
053:
054: /**
055: * #Description of the Method
056: *
057: * @exception Exception Description of Exception
058: */
059: public void close() throws Exception {
060: if (stopped) {
061: throw new IllegalStateException("The client IL is stopped");
062: }
063: connection.asynchClose();
064: }
065:
066: //One TemporaryDestination has been deleted
067: /**
068: * #Description of the Method
069: *
070: * @param dest Description of Parameter
071: * @exception JMSException Description of Exception
072: */
073: public void deleteTemporaryDestination(SpyDestination dest)
074: throws JMSException {
075: if (stopped) {
076: throw new IllegalStateException("The client IL is stopped");
077: }
078: connection.asynchDeleteTemporaryDestination(dest);
079: }
080:
081: /**
082: * #Description of the Method
083: *
084: * @param messages Description of Parameter
085: * @exception Exception Description of Exception
086: */
087: public void receive(ReceiveRequest messages[]) throws Exception {
088: if (stopped) {
089: throw new IllegalStateException("The client IL is stopped");
090: }
091: connection.asynchDeliver(messages);
092: }
093:
094: /**
095: * pong method comment.
096: *
097: * @param serverTime Description of Parameter
098: * @exception JMSException Description of Exception
099: */
100: public void pong(long serverTime) throws JMSException {
101: if (stopped) {
102: throw new IllegalStateException("The client IL is stopped");
103: }
104: connection.asynchPong(serverTime);
105: }
106: }
|