[jboss-cvs] JBossAS SVN: r58213 - branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 8 17:26:48 EST 2006


Author: weston.price at jboss.com
Date: 2006-11-08 17:26:46 -0500 (Wed, 08 Nov 2006)
New Revision: 58213

Modified:
   branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/ServerSessionPoolFactory.java
   branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSession.java
   branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java
   branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPoolFactory.java
Log:
[JBAS-3511] More ASF improvements.

Modified: branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/ServerSessionPoolFactory.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/ServerSessionPoolFactory.java	2006-11-08 22:26:23 UTC (rev 58212)
+++ branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/ServerSessionPoolFactory.java	2006-11-08 22:26:46 UTC (rev 58213)
@@ -92,7 +92,7 @@
     * @throws JMSException for any error
     */
    ServerSessionPool getServerSessionPool(Destination destination, Connection con, int minSession, int maxSession, long keepAlive, boolean isTransacted, int ack,
-         boolean useLocalTX, boolean lazy, boolean recycle, long idleTimeout, boolean destroyOnError, String sorterClassName, MessageListener listener) throws JMSException;
+         boolean useLocalTX, boolean lazy, boolean recycle, long idleTimeout, boolean destroyOnError, String supportCodeUrl, String sorterClassName, boolean validateLinkedExcpetion, MessageListener listener) throws JMSException;
 
 
 }
\ No newline at end of file

Modified: branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSession.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSession.java	2006-11-08 22:26:23 UTC (rev 58212)
+++ branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSession.java	2006-11-08 22:26:46 UTC (rev 58213)
@@ -116,7 +116,7 @@
          useLocalTX = false;
       
       this.useLocalTX = useLocalTX;
-      this.xidFactory = xidFactory;
+      this.xidFactory = xidFactory;      
       this.sorter = sorter;
       
       if (log.isDebugEnabled())
@@ -197,6 +197,7 @@
       
       TransactionDemarcationStrategy td = null;
       
+      
       if (StdServerSessionPool.USE_OLD == false)
       {
          td = createTransactionDemarcation();
@@ -207,6 +208,7 @@
 
       try
       {
+
          if (StdServerSessionPool.USE_OLD && xaSession != null)
          {
             xaSession.run();
@@ -522,9 +524,9 @@
       {
          if(useLocalTX)
          {
-            localRollbackFlag = true;
-           
-         }else
+            localRollbackFlag = true;           
+         }
+         else
          {
             try
             {
@@ -535,6 +537,7 @@
             }
             catch (Throwable t)
             {
+               handleSessionFailure(t);
                log.error(StdServerSession.this + " failed to set rollback only", t);
             }
             

Modified: branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java	2006-11-08 22:26:23 UTC (rev 58212)
+++ branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java	2006-11-08 22:26:46 UTC (rev 58213)
@@ -153,6 +153,12 @@
       
    private SessionPoolStatisticsCollector counter = new SessionPoolStatisticsCollector();
    
+   private JMSSupportCodeHandler handler;
+   
+   private String supportCodeUrl;
+   
+   private String sorterClassName;
+   
    public StdServerSessionPool(final Destination destination, 
                            final Connection con, 
                            final boolean transacted, 
@@ -166,7 +172,9 @@
                            final boolean recycle,
                            final long idleTimeout,
                            final boolean destroyOnError,
-                           final String exceptionSorter,
+                           final String supportCodeUrl,
+                           final String sorterClassName,
+                           final boolean validateLinkedException,
                            final XidFactoryMBean xidFactory) throws JMSException
    {
       
@@ -214,21 +222,10 @@
          
       }
       
-      if(exceptionSorter != null)
-      {
-         try
-         {
-            Class clz = Class.forName(exceptionSorter);
-            sorter = (JMSExceptionSorter)clz.newInstance();
-            
-         }catch(Exception e)
-         {
-            log.trace("Could not intialize JMSExceptionSorter. Setting to DefaultJMSExceptionSorter.");
-            sorter = new AllNonFatalJMSExceptionSorter();
-         }         
-         
-      }
+      this.supportCodeUrl = supportCodeUrl;
+      this.sorterClassName = sorterClassName;
       
+      handler = new JMSSupportCodeHandler(supportCodeUrl, sorterClassName, validateLinkedException);
       
       log.debug("Server Session pool set up");
       
@@ -439,6 +436,11 @@
    
    }
    
+   public int getSessionDestroyedCount()
+   {
+      return counter.getSessionDestroyedCount();
+      
+   }
 
    // --- Protected messages for StdServerSession to use
 
@@ -477,6 +479,42 @@
 	  }
    
    }
+   
+   public void refreshSupportCodeFile()
+   {
+      handler.reloadSupportFile();
+      
+   }
+
+   public void loadSupportCodeFile(String fileName)
+   {      
+    
+      handler.reloadSupportFile(fileName);      
+   }
+   
+   public Integer[] listCurrentSupportCodes()
+   {
+      return handler.getCurrentCodes();
+           
+   }
+   
+   public void clearCurrentSupportCodes()
+   {
+      
+      handler.clearSupportCodes();
+      
+   }
+   
+   public void addSupportCodes(final String fileName)
+   {
+      handler.addSupportCodes(fileName);      
+   }
+   
+   public boolean isCodeInUse(int code)
+   {
+      return handler.isCodeInUse(code);
+      
+   }
    /**
     * Recycle a server session.
     *
@@ -501,7 +539,16 @@
                   
          if (closing || isTimedOut || (session.getHasError() && destroyOnError))
          {
+            
+            if(session.getHasError())
+            {
+               counter.incDestroyed();
+               
+            }
+            
             session.close();
+            
+            
             numServerSessions--;
             
             if (numServerSessions == 0)
@@ -567,7 +614,7 @@
       // create the server session and add it to the pool - it is up to the
       // server session to set the listener
       StdServerSession serverSession = new StdServerSession(this, ses, xaSes,
-         listener, useLocalTX, xidFactory, sorter);
+         listener, useLocalTX, xidFactory, handler);
       numServerSessions++;
       counter.incTotalCreated();
 
@@ -620,7 +667,7 @@
          // create the server session and add it to the pool - it is up to the
          // server session to set the listener
          StdServerSession serverSession = new StdServerSession(this, ses, xaSes,
-            listener, useLocalTX, xidFactory, sorter);
+            listener, useLocalTX, xidFactory, handler);
          
          counter.incTotalCreated();
          sessionPool.add(serverSession);
@@ -631,6 +678,7 @@
       }
    }
    
+   
    void removeTimedOut()
    {
    
@@ -753,6 +801,7 @@
       private int maxInUse;
       private int error;
       private int totalCreated;
+      private int destroyedCount;
       
       synchronized void incTotalCreated()
       {
@@ -765,6 +814,12 @@
          --inUse;
       }
       
+      synchronized void incDestroyed()
+      {
+         ++destroyedCount;
+         
+      }
+      
       synchronized void inUse()
       {
          ++inUse;
@@ -815,6 +870,12 @@
       {
          return totalCreated;
       }
+   
+      private int getSessionDestroyedCount()
+      {
+         return destroyedCount;
+         
+      }
    }
 
 }

Modified: branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPoolFactory.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPoolFactory.java	2006-11-08 22:26:23 UTC (rev 58212)
+++ branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPoolFactory.java	2006-11-08 22:26:46 UTC (rev 58213)
@@ -63,10 +63,10 @@
    }
    
 
-   public javax.jms.ServerSessionPool getServerSessionPool(Destination destination, Connection con, int minSession, int maxSession, long keepAlive, boolean isTransacted, int ack, boolean useLocalTX, boolean lazyInit, boolean recycle, long idleTimeout, boolean destroySessionOnError, String sorterClassName, javax.jms.MessageListener listener) throws javax.jms.JMSException
+   public javax.jms.ServerSessionPool getServerSessionPool(Destination destination, Connection con, int minSession, int maxSession, long keepAlive, boolean isTransacted, int ack, boolean useLocalTX, boolean lazyInit, boolean recycle, long idleTimeout, boolean destroySessionOnError, String supportCodeUrl, String sorterClassName, boolean validateLinkedException, javax.jms.MessageListener listener) throws javax.jms.JMSException
    {
      
-      ServerSessionPool pool = (ServerSessionPool)new StdServerSessionPool(destination, con, isTransacted, ack, useLocalTX, listener, minSession, maxSession, keepAlive, lazyInit, recycle, idleTimeout, destroySessionOnError, sorterClassName, xidFactory);
+      ServerSessionPool pool = (ServerSessionPool)new StdServerSessionPool(destination, con, isTransacted, ack, useLocalTX, listener, minSession, maxSession, keepAlive, lazyInit, recycle, idleTimeout, destroySessionOnError, supportCodeUrl, sorterClassName, validateLinkedException, xidFactory);
       return pool;
    }
    




More information about the jboss-cvs-commits mailing list