[jboss-cvs] JBoss Messaging SVN: r2615 - in branches/Branch_1_0_1_SP/src: main/org/jboss/jms/client/container and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 30 20:23:14 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-04-30 20:23:13 -0400 (Mon, 30 Apr 2007)
New Revision: 2615

Modified:
   branches/Branch_1_0_1_SP/src/etc/xmdesc/ServerPeer-xmbean.xml
   branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/container/AsfAspect.java
   branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/container/SessionAspect.java
   branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/state/SessionState.java
   branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ServerPeer.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-946 and adding deployQueue method to ServerPeer as Integration tests needed that with the same API as 1.2

Modified: branches/Branch_1_0_1_SP/src/etc/xmdesc/ServerPeer-xmbean.xml
===================================================================
--- branches/Branch_1_0_1_SP/src/etc/xmdesc/ServerPeer-xmbean.xml	2007-04-26 19:37:57 UTC (rev 2614)
+++ branches/Branch_1_0_1_SP/src/etc/xmdesc/ServerPeer-xmbean.xml	2007-05-01 00:23:13 UTC (rev 2615)
@@ -189,7 +189,7 @@
       </parameter>
       <return-type>java.lang.String</return-type>
    </operation>
-   
+
    <operation>
       <description>
          Creates a queue with the specified name/JNDI name and paging parameters. The corresponding destination service will be instantiated, created and started.
@@ -214,12 +214,56 @@
       <parameter>
          <name>downCacheSize</name>
          <type>int</type>
-      </parameter>            
+      </parameter>
       <return-type>java.lang.String</return-type>
-   </operation>   
+   </operation>
 
    <operation>
       <description>
+         Creates a queue with the specified name/JNDI name. The corresponding destination service will be instantiated, created and started.
+      </description>
+      <name>deployQueue</name>
+      <parameter>
+         <name>name</name>
+         <type>java.lang.String</type>
+      </parameter>
+      <parameter>
+         <name>jndiName</name>
+         <type>java.lang.String</type>
+      </parameter>
+      <return-type>java.lang.String</return-type>
+   </operation>
+
+   <operation>
+      <description>
+         Creates a queue with the specified name/JNDI name and paging parameters. The corresponding destination service will be instantiated, created and started.
+      </description>
+      <name>deployQueue</name>
+      <parameter>
+         <name>name</name>
+         <type>java.lang.String</type>
+      </parameter>
+      <parameter>
+         <name>jndiName</name>
+         <type>java.lang.String</type>
+      </parameter>
+      <parameter>
+         <name>fullSize</name>
+         <type>int</type>
+      </parameter>
+      <parameter>
+         <name>pageSize</name>
+         <type>int</type>
+      </parameter>
+      <parameter>
+         <name>downCacheSize</name>
+         <type>int</type>
+      </parameter>
+      <return-type>java.lang.String</return-type>
+   </operation>
+
+   <operation>
+      <description>
          Stops, destroys and unregisters from the MBean server the corresponding destination service, but only if the destination in question was created programatically with createQueue(). Returns true on success. Returns false if the destination does not exist or was not created programatically. A deployed destination must be undeployed to achieve the same effect.
       </description>
       <name>destroyQueue</name>
@@ -254,12 +298,40 @@
       <parameter>
          <name>downCacheSize</name>
          <type>int</type>
-      </parameter>         
+      </parameter>
       <return-type>java.lang.String</return-type>
    </operation>
-   
+
    <operation>
       <description>
+         Creates a topic with the specified name/JNDI name. The corresponding destination service will be instantiated, created and started.
+      </description>
+      <name>deployTopic</name>
+      <parameter>
+         <name>name</name>
+         <type>java.lang.String</type>
+      </parameter>
+      <parameter>
+         <name>jndiName</name>
+         <type>java.lang.String</type>
+      </parameter>
+      <parameter>
+         <name>fullSize</name>
+         <type>int</type>
+      </parameter>
+      <parameter>
+         <name>pageSize</name>
+         <type>int</type>
+      </parameter>
+      <parameter>
+         <name>downCacheSize</name>
+         <type>int</type>
+      </parameter>
+      <return-type>java.lang.String</return-type>
+   </operation>
+
+   <operation>
+      <description>
          Creates a topic with the specified name/JNDI name and paging parameters. The corresponding destination service will be instantiated, created and started.
       </description>
       <name>createTopic</name>
@@ -272,10 +344,26 @@
          <type>java.lang.String</type>
       </parameter>
       <return-type>java.lang.String</return-type>
-   </operation>   
+   </operation>
 
    <operation>
       <description>
+         Creates a topic with the specified name/JNDI name and paging parameters. The corresponding destination service will be instantiated, created and started.
+      </description>
+      <name>deployTopic</name>
+      <parameter>
+         <name>name</name>
+         <type>java.lang.String</type>
+      </parameter>
+      <parameter>
+         <name>jndiName</name>
+         <type>java.lang.String</type>
+      </parameter>
+      <return-type>java.lang.String</return-type>
+   </operation>
+
+   <operation>
+      <description>
          Stops, destroys and unregisters from the MBean server the corresponding destination service, but only if the destination in question was created programatically with createTopic(). Returns true on success. Returns false if the destination does not exist or was not created programatically. A deployed destination must be undeployed to achieve the same effect.
       </description>
       <name>destroyTopic</name>

Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/container/AsfAspect.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/container/AsfAspect.java	2007-04-26 19:37:57 UTC (rev 2614)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/container/AsfAspect.java	2007-05-01 00:23:13 UTC (rev 2615)
@@ -66,9 +66,6 @@
    //The list of messages that get processed on a call to run()
    protected LinkedList msgs = new LinkedList();
    
-   //The distinguished message listener
-   protected MessageListener sessionListener;
-   
    protected SessionState state;
    
    // Static --------------------------------------------------------
@@ -89,9 +86,9 @@
       {
          throw new IllegalStateException("Cannot set a null MessageListener on the session");
       }
-      
-      sessionListener = listener;
-      
+
+      getSessionState(invocation).setDistinguishedListener(listener);
+
       return null;
    }
    
@@ -99,7 +96,7 @@
    {
       if (trace) { log.trace("getMessageListener()"); }
       
-      return sessionListener;
+      return getSessionState(invocation).getDistinguishedListener();
    }
    
    public Object handleCreateConnectionConsumer(Invocation invocation) throws Throwable
@@ -164,7 +161,7 @@
 
          if (trace) { log.trace("sending " + holder.msg + " to the message listener" ); }
          
-         MessageCallbackHandler.callOnMessage(del, sessionListener, holder.consumerID, false,
+         MessageCallbackHandler.callOnMessage(del, getSessionState(invocation).getDistinguishedListener(), holder.consumerID, false,
                                               holder.msg, ackMode, holder.maxDeliveries);                          
       }
       
@@ -179,7 +176,15 @@
    
    private SessionState getSessionState(Invocation inv)
    {
-      return (SessionState)((DelegateSupport)inv.getTargetObject()).getState();
+      if (state != null)
+      {
+         return state;
+      }
+      else
+      {
+         state = (SessionState)((DelegateSupport)inv.getTargetObject()).getState();
+         return state;
+      }
    }
 
    // Inner Classes --------------------------------------------------

Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/container/SessionAspect.java	2007-04-26 19:37:57 UTC (rev 2614)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/container/SessionAspect.java	2007-05-01 00:23:13 UTC (rev 2615)
@@ -28,6 +28,7 @@
 
 import javax.jms.IllegalStateException;
 import javax.jms.Session;
+import javax.jms.ServerSession;
 
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
@@ -37,6 +38,7 @@
 import org.jboss.jms.delegate.SessionDelegate;
 import org.jboss.jms.message.MessageProxy;
 import org.jboss.jms.tx.AckInfo;
+import org.jboss.jms.tx.LocalTx;
 import org.jboss.logging.Logger;
 import org.jboss.messaging.util.Util;
 
@@ -132,7 +134,9 @@
       
       if (ackMode == Session.CLIENT_ACKNOWLEDGE ||
           ackMode == Session.AUTO_ACKNOWLEDGE ||
-          ackMode == Session.DUPS_OK_ACKNOWLEDGE)
+          ackMode == Session.DUPS_OK_ACKNOWLEDGE ||
+          state.isXA() && (state.getCurrentTxId() instanceof LocalTx) &&
+             state.getDistinguishedListener() == null)
       {
          // We collect acknowledgments (and not transact them) for CLIENT, AUTO and DUPS_OK
 
@@ -184,7 +188,9 @@
       }
       
       if (ackMode == Session.AUTO_ACKNOWLEDGE ||
-          ackMode == Session.DUPS_OK_ACKNOWLEDGE)
+          ackMode == Session.DUPS_OK_ACKNOWLEDGE ||
+          state.isXA() && (state.getCurrentTxId() instanceof LocalTx) &&
+             state.getDistinguishedListener() == null)
       {
          // We acknowledge immediately on a non-transacted session that does not want to
          // CLIENT_ACKNOWLEDGE

Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/state/SessionState.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/state/SessionState.java	2007-04-26 19:37:57 UTC (rev 2614)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/client/state/SessionState.java	2007-05-01 00:23:13 UTC (rev 2615)
@@ -34,6 +34,7 @@
 
 import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
 import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+import javax.jms.MessageListener;
 
 /**
  * State corresponding to a session. This state is acessible inside aspects/interceptors.
@@ -60,6 +61,9 @@
    
    private boolean recoverCalled;
 
+   //The distinguished message listener
+   protected MessageListener sessionListener;
+
    // List<AckInfo>
    private List toAck;
    
@@ -98,6 +102,17 @@
       callbackHandlers = new HashMap();
    }
 
+   public MessageListener getDistinguishedListener()
+   {
+      return this.sessionListener;
+   }
+
+   public void setDistinguishedListener(MessageListener listener)
+   {
+      this.sessionListener = listener;
+   }
+
+
    /**
     * @return List<AckInfo>
     */

Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ServerPeer.java	2007-04-26 19:37:57 UTC (rev 2614)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ServerPeer.java	2007-05-01 00:23:13 UTC (rev 2615)
@@ -462,7 +462,7 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue");
-      } 
+      }
    }
 
    public String createQueue(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
@@ -474,9 +474,35 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue(2)");
-      } 
+      }
    }
 
+   // Added this method just to have ServerPeer compatible between 1.0 and 1.2
+   public String deployQueue(String name, String jndiName) throws Exception
+   {
+      try
+      {
+         return createDestinationDefault(true, name, jndiName);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue");
+      }
+   }
+
+   // Added this method just to have ServerPeer compatible between 1.0 and 1.2
+   public String deployQueue(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
+   {
+      try
+      {
+         return createDestination(true, name, jndiName, fullSize, pageSize, downCacheSize);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " createQueue(2)");
+      }
+   }
+
    public boolean destroyQueue(String name) throws Exception
    {
       try
@@ -498,9 +524,35 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic");
-      } 
+      }
    }
 
+   // Added this method just to have ServerPeer compatible between 1.0 and 1.2
+   public String deployTopic(String name, String jndiName) throws Exception
+   {
+      try
+      {
+         return createDestinationDefault(false, name, jndiName);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic");
+      }
+   }
+
+   // Added this method just to have ServerPeer compatible between 1.0 and 1.2
+   public String deployTopic(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
+   {
+      try
+      {
+         return createDestination(false, name, jndiName, fullSize, pageSize, downCacheSize);
+      }
+      catch (Throwable t)
+      {
+         throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic(2)");
+      }
+   }
+
    public String createTopic(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
    {
       try
@@ -510,7 +562,7 @@
       catch (Throwable t)
       {
          throw ExceptionUtil.handleJMXInvocation(t, this + " createTopic(2)");
-      } 
+      }
    }
 
    public boolean destroyTopic(String name) throws Exception




More information about the jboss-cvs-commits mailing list