[jboss-cvs] JBoss Messaging SVN: r2465 - in trunk: src/main/org/jboss/jms/client/container and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 27 07:58:09 EST 2007


Author: timfox
Date: 2007-02-27 07:58:08 -0500 (Tue, 27 Feb 2007)
New Revision: 2465

Added:
   trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockRequest.java
   trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockResponse.java
Removed:
   trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockRequest.java
   trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockResponse.java
Modified:
   trunk/src/main/org/jboss/jms/client/FailoverCommandCenter.java
   trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
   trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java
   trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   trunk/src/main/org/jboss/jms/message/MessageIdGenerator.java
   trunk/src/main/org/jboss/jms/message/MessageIdGeneratorFactory.java
   trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java
   trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java
   trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
   trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
   trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java
   trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionFactoryAdvised.java
   trunk/src/main/org/jboss/jms/wireformat/PacketSupport.java
   trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultipleFailoverTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-898 - finish off incomplete fix



Modified: trunk/src/main/org/jboss/jms/client/FailoverCommandCenter.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/FailoverCommandCenter.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/client/FailoverCommandCenter.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -14,6 +14,7 @@
 import org.jboss.jms.client.remoting.JMSRemotingConnection;
 import org.jboss.jms.client.state.ConnectionState;
 import org.jboss.jms.delegate.ConnectionFactoryDelegate;
+import org.jboss.jms.message.MessageIdGenerator;
 import org.jboss.jms.server.endpoint.CreateConnectionResult;
 import org.jboss.logging.Logger;
 
@@ -106,7 +107,7 @@
          
          // generate a FAILOVER_STARTED event. The event must be broadcasted AFTER valve closure,
          // to insure the client-side stack is in a deterministic state
-         broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILOVER_STARTED, this));
+         broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILOVER_STARTED, this));        
          
          int failedNodeID = state.getServerID();
          ConnectionFactoryDelegate clusteredDelegate =
@@ -129,7 +130,7 @@
             ClientConnectionDelegate newDelegate = (ClientConnectionDelegate)res.getDelegate();
             
             state.getDelegate().synchronizeWith(newDelegate);
-            
+                           
             valve.open();
             valveOpened = true;
             

Modified: trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -204,7 +204,7 @@
          catch (MessagingNetworkFailureException e)
          {
             delegate = null;
-            log.warn("Exception captured on createConnection... hopping a new connection", e);
+            log.warn("Exception captured on createConnection... hopping to a new connection factory", e);
             //Currently hardcoded
             Thread.sleep(2000);
          }

Modified: trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -35,6 +35,7 @@
 import org.jboss.jms.client.state.ConnectionState;
 import org.jboss.jms.client.state.ProducerState;
 import org.jboss.jms.client.state.SessionState;
+import org.jboss.jms.delegate.ConnectionDelegate;
 import org.jboss.jms.delegate.SessionDelegate;
 import org.jboss.jms.message.JBossBytesMessage;
 import org.jboss.jms.message.JBossMapMessage;
@@ -166,7 +167,7 @@
       // Generate the message id
       ConnectionState connectionState = (ConnectionState)sessionState.getParent();
       
-      long id = connectionState.getIdGenerator().getId();
+      long id = connectionState.getIdGenerator().getId((ConnectionDelegate)connectionState.getDelegate());
     
       JBossMessage messageToSend;
       boolean foreign = false;

Modified: trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -81,8 +81,6 @@
 
    public Object handleCreateConnectionDelegate(Invocation inv) throws Throwable
    {
-      ConnectionFactoryDelegate cfd = (ConnectionFactoryDelegate)inv.getTargetObject();
-
       CreateConnectionResult res = (CreateConnectionResult)inv.invokeNext();
 
       ClientConnectionDelegate connectionDelegate = (ClientConnectionDelegate)res.getDelegate();
@@ -112,7 +110,7 @@
 
          // We have one message id generator per unique server
          MessageIdGenerator idGenerator =
-            MessageIdGeneratorFactory.instance.checkOutGenerator(serverID, cfd);
+            MessageIdGeneratorFactory.instance.checkOutGenerator(serverID);
 
          ConnectionState connectionState =
             new ConnectionState(serverID, connectionDelegate,

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -44,14 +44,16 @@
 import org.jboss.jms.wireformat.ClosingRequest;
 import org.jboss.jms.wireformat.ConnectionCreateSessionDelegateRequest;
 import org.jboss.jms.wireformat.ConnectionGetClientIDRequest;
+import org.jboss.jms.wireformat.ConnectionGetIDBlockRequest;
 import org.jboss.jms.wireformat.ConnectionGetPreparedTransactionsRequest;
 import org.jboss.jms.wireformat.ConnectionSendTransactionRequest;
 import org.jboss.jms.wireformat.ConnectionSetClientIDRequest;
 import org.jboss.jms.wireformat.ConnectionStartRequest;
 import org.jboss.jms.wireformat.ConnectionStopRequest;
 import org.jboss.jms.wireformat.RequestSupport;
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.plugin.IDBlock;
 import org.jboss.messaging.core.tx.MessagingXid;
-import org.jboss.logging.Logger;
 
 /**
  * The client-side Connection delegate class.
@@ -269,7 +271,14 @@
    {
       throw new IllegalStateException("This invocation should not be handled here!");
    }
+   
+   public IDBlock getIdBlock(int size) throws JMSException
+   {
+      RequestSupport req = new ConnectionGetIDBlockRequest(id, version, size);
 
+      return (IDBlock)doInvoke(client, req);
+   }
+
    // Public ---------------------------------------------------------------------------------------
 
    public void setRemotingConnection(JMSRemotingConnection conn)

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -39,9 +39,7 @@
 import org.jboss.jms.util.MessagingJMSException;
 import org.jboss.jms.wireformat.ConnectionFactoryCreateConnectionDelegateRequest;
 import org.jboss.jms.wireformat.ConnectionFactoryGetClientAOPStackRequest;
-import org.jboss.jms.wireformat.ConnectionFactoryGetIDBlockRequest;
 import org.jboss.jms.wireformat.ResponseSupport;
-import org.jboss.messaging.core.plugin.IDBlock;
 import org.jboss.remoting.Client;
 import org.jboss.remoting.InvokerLocator;
 
@@ -208,20 +206,6 @@
       return res;
    }
    
-   public IDBlock getIdBlock(int size) throws JMSException
-   {
-      Version version = getVersionToUse(serverVersion);
-      
-      byte v = version.getProviderIncrementingVersion();
-      
-      Client theClient = createClient();
-      
-      ConnectionFactoryGetIDBlockRequest req =
-         new ConnectionFactoryGetIDBlockRequest(id, v, size);
-      
-      return (IDBlock)doInvoke(theClient, req);    
-   }
-   
    public byte[] getClientAOPStack() throws JMSException
    {
       Version version = getVersionToUse(serverVersion);

Modified: trunk/src/main/org/jboss/jms/message/MessageIdGenerator.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/MessageIdGenerator.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/message/MessageIdGenerator.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -23,7 +23,7 @@
 
 import javax.jms.JMSException;
 
-import org.jboss.jms.delegate.ConnectionFactoryDelegate;
+import org.jboss.jms.server.endpoint.ConnectionEndpoint;
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.plugin.IDBlock;
 
@@ -53,28 +53,18 @@
    protected long nextID;
    protected int blockSize;
 
-   protected ConnectionFactoryDelegate cfd;
-
-   public ConnectionFactoryDelegate getDelegate()
-   {
-       return cfd;
-   }
-
    // Constructors --------------------------------------------------
 
-   public MessageIdGenerator(ConnectionFactoryDelegate cfd, int blockSize)  throws JMSException
+   public MessageIdGenerator(int blockSize)  throws JMSException
    {
-      this.cfd = cfd;
       this.blockSize = blockSize;
-
-      getNextBlock();
    }
 
    // Public --------------------------------------------------------
 
-   protected void getNextBlock() throws JMSException
+   protected void getNextBlock(ConnectionEndpoint connection) throws JMSException
    {
-      IDBlock block = cfd.getIdBlock(blockSize);
+      IDBlock block = connection.getIdBlock(blockSize);
 
       nextID = block.getLow();
       high = block.getHigh();
@@ -82,16 +72,18 @@
       if (trace) { log.trace("Got block of IDs from server, low=" + nextID + " high=" + high); }
    }
 
-   public synchronized long getId() throws JMSException
+   public synchronized long getId(ConnectionEndpoint connection) throws JMSException
    {
-      long id = nextID++;
-
       if (nextID == high)
       {
-         getNextBlock();
+         getNextBlock(connection);
       }
 
+      long id = nextID;
+      
       if (log.isTraceEnabled()) { log.trace("Getting next message id=" + id); }
+      
+      nextID++;
 
       return id;
    }

Modified: trunk/src/main/org/jboss/jms/message/MessageIdGeneratorFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/MessageIdGeneratorFactory.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/message/MessageIdGeneratorFactory.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -26,7 +26,6 @@
 
 import javax.jms.JMSException;
 
-import org.jboss.jms.delegate.ConnectionFactoryDelegate;
 import org.jboss.logging.Logger;
 
 /**
@@ -47,7 +46,7 @@
    public static MessageIdGeneratorFactory instance = new MessageIdGeneratorFactory();
 
    //TODO Make configurable
-   private static final int BLOCK_SIZE = 256;
+   private static final int BLOCK_SIZE = 512;
 
    // Static --------------------------------------------------------
 
@@ -69,8 +68,7 @@
       return holders.containsKey(new Integer(serverId));
    }
 
-   public synchronized MessageIdGenerator checkOutGenerator(int serverId,
-                                                            ConnectionFactoryDelegate cfd)
+   public synchronized MessageIdGenerator checkOutGenerator(int serverId)
       throws JMSException
    {
       Integer in = new Integer(serverId);
@@ -79,7 +77,7 @@
 
       if (h == null)
       {
-         h = new Holder(new MessageIdGenerator(cfd, BLOCK_SIZE));
+         h = new Holder(new MessageIdGenerator(BLOCK_SIZE));
          holders.put(in, h);
       }
       else

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -26,6 +26,7 @@
 import org.jboss.jms.client.Closeable;
 import org.jboss.jms.delegate.SessionDelegate;
 import org.jboss.jms.tx.TransactionRequest;
+import org.jboss.messaging.core.plugin.IDBlock;
 import org.jboss.messaging.core.tx.MessagingXid;
 
 
@@ -56,5 +57,7 @@
    void sendTransaction(TransactionRequest request, boolean checkForDuplicates) throws JMSException;
 
    MessagingXid[] getPreparedTransactions() throws JMSException; 
+   
+   IDBlock getIdBlock(int size) throws JMSException;
 }
 

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -23,8 +23,6 @@
 
 import javax.jms.JMSException;
 
-import org.jboss.messaging.core.plugin.IDBlock;
-
 /**
  * Represents the set of methods from the ConnectionFactoryDelegate that are handled on the server.
  * The rest of the methods are handled in the advice stack.
@@ -46,7 +44,7 @@
                                                    int failedNodeID)
       throws JMSException;
    
-   IDBlock getIdBlock(int size) throws JMSException;
+   //IDBlock getIdBlock(int size) throws JMSException;
    
    byte[] getClientAOPStack() throws JMSException;
 }

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -54,6 +54,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.message.Message;
 import org.jboss.messaging.core.message.MessageReference;
+import org.jboss.messaging.core.plugin.IDBlock;
 import org.jboss.messaging.core.plugin.contract.MessageStore;
 import org.jboss.messaging.core.plugin.contract.PostOffice;
 import org.jboss.messaging.core.tx.MessagingXid;
@@ -503,6 +504,18 @@
       }
    }
    
+   public IDBlock getIdBlock(int size) throws JMSException
+   {
+      try
+      {
+         return serverPeer.getMessageIDManager().getIDBlock(size);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMSInvocation(t, this + " getIdBlock");
+      }
+   }
+   
    // Public ---------------------------------------------------------------------------------------
    
    public String getUsername()

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -250,19 +250,7 @@
          return new ClientConnectionDelegate(connectionID, serverPeer.getServerPeerID());
       }
    }
-   
-   public IDBlock getIdBlock(int size) throws JMSException
-   {
-      try
-      {
-         return serverPeer.getMessageIDManager().getIDBlock(size);
-      }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMSInvocation(t, this + " getIdBlock");
-      }
-   }
-   
+      
    public byte[] getClientAOPStack() throws JMSException
    {
       try

Modified: trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -26,6 +26,7 @@
 import org.jboss.jms.delegate.SessionDelegate;
 import org.jboss.jms.server.endpoint.ConnectionEndpoint;
 import org.jboss.jms.tx.TransactionRequest;
+import org.jboss.messaging.core.plugin.IDBlock;
 import org.jboss.messaging.core.tx.MessagingXid;
 
 /**
@@ -105,6 +106,11 @@
       return endpoint.getPreparedTransactions();
    }
    
+   public IDBlock getIdBlock(int size) throws JMSException
+   {
+      return endpoint.getIdBlock(size);
+   }
+   
    // Public --------------------------------------------------------
 
    public Object getEndpoint()

Modified: trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionFactoryAdvised.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionFactoryAdvised.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionFactoryAdvised.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -66,11 +66,6 @@
       return endpoint.createConnectionDelegate(username, password, failedNodeId);
    }
 
-   public IDBlock getIdBlock(int size) throws JMSException
-   {
-      return endpoint.getIdBlock(size);
-   }
-   
    public byte[] getClientAOPStack() throws JMSException
    {
       return endpoint.getClientAOPStack();

Deleted: trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockRequest.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockRequest.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.wireformat;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-
-import org.jboss.jms.server.endpoint.ConnectionFactoryEndpoint;
-
-public class ConnectionFactoryGetIDBlockRequest extends RequestSupport
-{
-   private int size;
-   
-   public ConnectionFactoryGetIDBlockRequest()
-   {      
-   }
-
-   public ConnectionFactoryGetIDBlockRequest(int objectId,
-                                             byte version,
-                                             int size)
-   {
-      super(objectId, PacketSupport.REQ_CONNECTIONFACTORY_GETIDBLOCK, version);
-      
-      this.size = size;
-   }
-
-   public void read(DataInputStream is) throws Exception
-   {
-      super.read(is);
-      
-      size = is.readInt();
-   }
-
-   public ResponseSupport serverInvoke() throws Exception
-   {
-      ConnectionFactoryEndpoint endpoint = 
-         (ConnectionFactoryEndpoint)Dispatcher.instance.getTarget(objectId);
-      
-      if (endpoint == null)
-      {
-         throw new IllegalStateException("Cannot find object in dispatcher with id " + objectId);
-      }
-      return new ConnectionFactoryGetIDBlockResponse(endpoint.getIdBlock(size));           
-   }
-
-   public void write(DataOutputStream os) throws Exception
-   {
-      super.write(os);
-      
-      os.writeInt(size);  
-      
-      os.flush();
-   }
-
-}
-

Deleted: trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockResponse.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockResponse.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockResponse.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.wireformat;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-
-import org.jboss.messaging.core.plugin.IDBlock;
-
-/**
- * 
- * A ConnectionFactoryGetIDBlockResponse
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- *
- */
-public class ConnectionFactoryGetIDBlockResponse extends ResponseSupport
-{
-   private IDBlock idBlock;
-   
-   public ConnectionFactoryGetIDBlockResponse()
-   {      
-   }
-   
-   public ConnectionFactoryGetIDBlockResponse(IDBlock block)
-   {
-      super(PacketSupport.RESP_CONNECTIONFACTORY_GETIDBLOCK);
-      
-      this.idBlock = block;
-   }
-
-   public Object getResponse()
-   {
-      return idBlock;
-   }
-   
-   public void write(DataOutputStream os) throws Exception
-   {
-      super.write(os);
-      
-      idBlock.write(os);
-      
-      os.flush();
-   }
-   
-   public void read(DataInputStream is) throws Exception
-   {
-      idBlock = new IDBlock();
-      
-      idBlock.read(is);
-   }
-
-}
-

Copied: trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockRequest.java (from rev 2464, trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockRequest.java)
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockRequest.java	                        (rev 0)
+++ trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockRequest.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.wireformat;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+
+import org.jboss.jms.server.endpoint.ConnectionEndpoint;
+
+public class ConnectionGetIDBlockRequest extends RequestSupport
+{
+   private int size;
+   
+   public ConnectionGetIDBlockRequest()
+   {      
+   }
+
+   public ConnectionGetIDBlockRequest(int objectId,
+                                      byte version,
+                                      int size)
+   {
+      super(objectId, PacketSupport.REQ_CONNECTIONFACTORY_GETIDBLOCK, version);
+      
+      this.size = size;
+   }
+
+   public void read(DataInputStream is) throws Exception
+   {
+      super.read(is);
+      
+      size = is.readInt();
+   }
+
+   public ResponseSupport serverInvoke() throws Exception
+   {
+      ConnectionEndpoint endpoint = 
+         (ConnectionEndpoint)Dispatcher.instance.getTarget(objectId);
+      
+      if (endpoint == null)
+      {
+         throw new IllegalStateException("Cannot find object in dispatcher with id " + objectId);
+      }
+      return new ConnectionGetIDBlockResponse(endpoint.getIdBlock(size));           
+   }
+
+   public void write(DataOutputStream os) throws Exception
+   {
+      super.write(os);
+      
+      os.writeInt(size);  
+      
+      os.flush();
+   }
+
+}
+

Copied: trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockResponse.java (from rev 2464, trunk/src/main/org/jboss/jms/wireformat/ConnectionFactoryGetIDBlockResponse.java)
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockResponse.java	                        (rev 0)
+++ trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockResponse.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.wireformat;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+
+import org.jboss.messaging.core.plugin.IDBlock;
+
+/**
+ * 
+ * A ConnectionFactoryGetIDBlockResponse
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ *
+ */
+public class ConnectionGetIDBlockResponse extends ResponseSupport
+{
+   private IDBlock idBlock;
+   
+   public ConnectionGetIDBlockResponse()
+   {      
+   }
+   
+   public ConnectionGetIDBlockResponse(IDBlock block)
+   {
+      super(PacketSupport.RESP_CONNECTIONFACTORY_GETIDBLOCK);
+      
+      this.idBlock = block;
+   }
+
+   public Object getResponse()
+   {
+      return idBlock;
+   }
+   
+   public void write(DataOutputStream os) throws Exception
+   {
+      super.write(os);
+      
+      idBlock.write(os);
+      
+      os.flush();
+   }
+   
+   public void read(DataInputStream is) throws Exception
+   {
+      idBlock = new IDBlock();
+      
+      idBlock.read(is);
+   }
+
+}
+

Modified: trunk/src/main/org/jboss/jms/wireformat/PacketSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/PacketSupport.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/src/main/org/jboss/jms/wireformat/PacketSupport.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -201,7 +201,7 @@
             packet = new ConnectionFactoryCreateConnectionDelegateRequest();
             break;         
          case REQ_CONNECTIONFACTORY_GETIDBLOCK:         
-            packet = new ConnectionFactoryGetIDBlockRequest();
+            packet = new ConnectionGetIDBlockRequest();
             break;
          case REQ_CONNECTIONFACTORY_GETCLIENTAOPSTACK:
             packet = new ConnectionFactoryGetClientAOPStackRequest();
@@ -301,7 +301,7 @@
             packet = new ConnectionFactoryCreateConnectionDelegateResponse();
             break;
          case RESP_CONNECTIONFACTORY_GETIDBLOCK:
-            packet = new ConnectionFactoryGetIDBlockResponse();
+            packet = new ConnectionGetIDBlockResponse();
             break;
          case RESP_CONNECTIONFACTORY_GETCLIENTAOPSTACK:
             packet = new ConnectionFactoryGetClientAOPStackResponse();

Modified: trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -60,8 +60,8 @@
 import org.jboss.jms.wireformat.ConnectionFactoryCreateConnectionDelegateResponse;
 import org.jboss.jms.wireformat.ConnectionFactoryGetClientAOPStackRequest;
 import org.jboss.jms.wireformat.ConnectionFactoryGetClientAOPStackResponse;
-import org.jboss.jms.wireformat.ConnectionFactoryGetIDBlockRequest;
-import org.jboss.jms.wireformat.ConnectionFactoryGetIDBlockResponse;
+import org.jboss.jms.wireformat.ConnectionGetIDBlockRequest;
+import org.jboss.jms.wireformat.ConnectionGetIDBlockResponse;
 import org.jboss.jms.wireformat.ConnectionGetClientIDRequest;
 import org.jboss.jms.wireformat.ConnectionGetClientIDResponse;
 import org.jboss.jms.wireformat.ConnectionGetPreparedTransactionsRequest;
@@ -454,7 +454,7 @@
       public void testConnectionFactoryGetIDBlock() throws Exception
       {
          RequestSupport req =
-            new ConnectionFactoryGetIDBlockRequest(23, (byte)77, 66);;
+            new ConnectionGetIDBlockRequest(23, (byte)77, 66);;
                  
          testPacket(req, PacketSupport.REQ_CONNECTIONFACTORY_GETIDBLOCK);                           
       }
@@ -734,7 +734,7 @@
          IDBlock block = new IDBlock(1, 76);
          
          ResponseSupport resp =
-            new ConnectionFactoryGetIDBlockResponse(block);
+            new ConnectionGetIDBlockResponse(block);
                  
          testPacket(resp, PacketSupport.RESP_CONNECTIONFACTORY_GETIDBLOCK);                           
       }

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultipleFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultipleFailoverTest.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultipleFailoverTest.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -231,7 +231,7 @@
 
             prod.send(tm);
             
-            Thread.sleep(10);
+            //Thread.sleep(10);
 
             if (count % 100 == 0)
             {
@@ -409,6 +409,8 @@
             
             if (!tm.getText().equals("message " + count))
             {
+               log.error("Expected message " + count + " but got " + tm.getText());
+               
                failed = true;
                
                latch.release();

Modified: trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java	2007-02-27 09:00:28 UTC (rev 2464)
+++ trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java	2007-02-27 12:58:08 UTC (rev 2465)
@@ -37,6 +37,7 @@
 import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
 import org.jboss.jms.server.endpoint.ConnectionEndpoint;
 import org.jboss.jms.tx.TransactionRequest;
+import org.jboss.messaging.core.plugin.IDBlock;
 import org.jboss.messaging.core.tx.MessagingXid;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
@@ -322,6 +323,11 @@
       {
          
       }
+
+      public IDBlock getIdBlock(int size) throws JMSException
+      {
+         return null;
+      }
    }
 }
 




More information about the jboss-cvs-commits mailing list