User: chirino 
  Date: 01/06/21 21:04:43

  Added:       src/main/org/jbossmq/distributed/server
                        ConnectionReceiverINVM.java
                        DistributedJMSServerINVM.java
  Log:
  I have added an new "INVM" that can only be used when the JBossMQ server is
  running in the same machine as the client.  This INVM IL theoreticaly is the
  epitomy of performance since no serialization occurs and no threads are
  needs to poll for input.
  
  Revision  Changes    Path
  1.1                  
jbossmq/src/main/org/jbossmq/distributed/server/ConnectionReceiverINVM.java
  
  Index: ConnectionReceiverINVM.java
  ===================================================================
  /*
   * JBossMQ, the OpenSource JMS implementation
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jbossmq.distributed.server;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  
  
  
  
  
  
  
  
  import java.rmi.RemoteException; 
  import java.rmi.server.UnicastRemoteObject;
  
  import org.jbossmq.Log;
  import org.jbossmq.SpyConnection;
  import org.jbossmq.distributed.interfaces.ConnectionReceiver;
  import org.jbossmq.distributed.interfaces.ConnectionReceiverSetup;
  import org.jbossmq.ReceiveRequest;
  import org.jbossmq.SpyDestination;
  
  /**
   *    The RMI implementation of the ConnectionReceiver object
   *      
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   *    @author Hiram Chirino ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class ConnectionReceiverINVM implements ConnectionReceiver, 
ConnectionReceiverSetup
  {
        // Attributes ----------------------------------------------------
  
        //A link on my connection
        private SpyConnection connection;
        //Is my connection closed ?
        private boolean closed;
  
        // Constructor ---------------------------------------------------
           
        public ConnectionReceiverINVM() throws RemoteException 
        {
                super();
                closed=false;
        }
  
        // Public --------------------------------------------------------
  
        public void setConnection(SpyConnection connection)
        {
                this.connection=connection;
        }
        
        public void close() throws Exception
        {
                closed=true;            
        }
  
        //One TemporaryDestination has been deleted
        public void deleteTemporaryDestination(SpyDestination dest) throws JMSException
        {
                if (closed) throw new IllegalStateException("The connection is 
closed");        
  
                connection.deleteTemporaryDestination(dest);
        }
  
        public ConnectionReceiver createClient() throws JMSException
        {
                return this;
        }
        
        public void receive(ReceiveRequest messages[]) throws Exception {
                
                if (closed)
                        throw new IllegalStateException("The connection is closed");
  
                Log.log("ConnectionReceiver: Receive(ReceiveRequest[" + 
messages.length +"])");
  
                connection.deliver(messages);
  
        }
  }
  
  
  1.1                  
jbossmq/src/main/org/jbossmq/distributed/server/DistributedJMSServerINVM.java
  
  Index: DistributedJMSServerINVM.java
  ===================================================================
  /*
   * JBossMQ, the OpenSource JMS implementation
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jbossmq.distributed.server;
  
  import javax.jms.JMSException;
  import javax.jms.Destination;
  import javax.jms.Topic;
  import javax.jms.Queue;
  import javax.jms.TemporaryTopic;
  import javax.jms.TemporaryQueue;
  
  import java.rmi.server.UnicastRemoteObject;
  import java.rmi.RemoteException;
  
  
  
  
  
  
  
  
  
  
  
  import org.jbossmq.Log;
  import org.jbossmq.server.JMSServer;
  import org.jbossmq.TransactionRequest;
  import org.jbossmq.SpyMessage;
  import org.jbossmq.AcknowledgementRequest;
  import org.jbossmq.distributed.interfaces.DistributedJMSServerSetup;
  import org.jbossmq.SpyDestination;
  import org.jbossmq.distributed.interfaces.DistributedJMSServer;
  import org.jbossmq.SpyDistributedConnection;
  
  /**
   *    The RMI implementation of the DistributedJMSServer object
   *      
   *    @author Hiram Chirino ([EMAIL PROTECTED])
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class DistributedJMSServerINVM implements DistributedJMSServer, 
DistributedJMSServerSetup, DistributedJMSServerINVMMBean {
        // Attributes ----------------------------------------------------
  
        //The server implementation
        private JMSServer server;
        
        // Constructor ---------------------------------------------------
           
        public DistributedJMSServerINVM() throws RemoteException 
        {
                super();
        }
  
        // Public --------------------------------------------------------
        public String getID() throws JMSException
        {
                return server.getID();
        }
        
        public void addMessage(SpyDistributedConnection dc, SpyMessage val) throws 
JMSException
        {
                server.addMessage(dc, val);
        }
        
        public Topic createTopic(SpyDistributedConnection dc, String dest) throws 
JMSException
        {
                return server.createTopic(dc,dest);
        }
        
        public Queue createQueue(SpyDistributedConnection dc, String dest) throws 
JMSException
        {
                return server.createQueue(dc,dest);
        }
  
        public void deleteTemporaryDestination(SpyDistributedConnection dc, 
SpyDestination dest) throws JMSException
        {
                server.deleteTemporaryDestination(dc,dest);
        }
  
        public void checkID(String ID) throws JMSException
        {
                server.checkID(ID);
        }
  
        // --
        
        public DistributedJMSServer createClient()
        {
                return this;
        }       
  
  
        
        public void setSpyDistributedConnection(SpyDistributedConnection 
newSpyDistributedConnection) {
                // We cannot try to cache the dc since different dc's are going
                // to get the same object
        }
        
        public void connectionClosing(SpyDistributedConnection dc) throws JMSException
        {
                server.connectionClosing(dc);
        }       
        
        public TemporaryQueue getTemporaryQueue(SpyDistributedConnection dc) throws 
JMSException
        {
                return server.getTemporaryQueue(dc);
        }       
        
        public TemporaryTopic getTemporaryTopic(SpyDistributedConnection dc) throws 
JMSException
        {
                return server.getTemporaryTopic(dc);
        }       
        
  
  
        public void acknowledge(SpyDistributedConnection dc, AcknowledgementRequest 
item) throws Exception {
                server.acknowledge(dc, item);
        }
  
        public SpyMessage[] browse(SpyDistributedConnection dc, Destination dest, 
String selector) throws Exception {
                return server.browse(dc, dest, selector);
        }
  
        public void listenerChange(SpyDistributedConnection dc, int subscriberId, 
boolean state) throws Exception {
                server.listenerChange(dc,subscriberId,state);
        }
  
        public SpyMessage receive(SpyDistributedConnection dc, int subscriberId, long 
wait) throws Exception {
                return server.receive(dc,subscriberId,wait);
        }
  
        public void setEnabled(SpyDistributedConnection dc, boolean enabled) throws 
Exception {
                server.setEnabled( dc, enabled);        
        }
  
  
  
        public void unsubscribe(SpyDistributedConnection dc, int subscriptionId ) 
throws Exception{
                server.unsubscribe(dc, subscriptionId);
        }
  
        public String checkUser(String userName, String password) throws JMSException {
                return server.checkUser(userName, password);
        }
  
        public void subscribe(SpyDistributedConnection dc, org.jbossmq.Subscription s) 
throws Exception {
                server.subscribe(dc,s);
        }
  
        public void transact(org.jbossmq.SpyDistributedConnection dc, 
TransactionRequest t) throws JMSException {
                server.transact(dc,t);
        }
  
        public DistributedJMSServer internalClone() {
                return this;
        }
  
        public void init(JMSServer s, org.jbossmq.xml.XElement config)
        {
                server=s;
        }
  }
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to