[jboss-cvs] JBossAS SVN: r82997 - branches/JBPAPP_4_2_0_GA_CP/cluster/src/main/org/jboss/ejb/plugins.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 16 16:09:53 EST 2009


Author: jiwils
Date: 2009-01-16 16:09:53 -0500 (Fri, 16 Jan 2009)
New Revision: 82997

Modified:
   branches/JBPAPP_4_2_0_GA_CP/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java
Log:
Fix for JBPAPP-1521.  Exception message cleanup.

Modified: branches/JBPAPP_4_2_0_GA_CP/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java	2009-01-16 20:22:36 UTC (rev 82996)
+++ branches/JBPAPP_4_2_0_GA_CP/cluster/src/main/org/jboss/ejb/plugins/CleanShutdownInterceptor.java	2009-01-16 21:09:53 UTC (rev 82997)
@@ -68,15 +68,15 @@
    // Attributes ----------------------------------------------------
 
    protected Container container = null;
-   
+
    protected EjbModule ejbModule = null;
    protected String ejbModuleName = null;
-   
+
    private static ThreadLocal currentModule = new ThreadLocal ();
-   
+
    protected boolean allowInvocations = false;
    protected boolean allowRemoteInvocations = false;
-   
+
    protected boolean isDebugEnabled = false;
 
    public long runningInvocations = 0;
@@ -87,7 +87,7 @@
    protected ReentrantWriterPreferenceReadWriteLock rwLock = new ReentrantWriterPreferenceReadWriteLock();
 
    // Static --------------------------------------------------------
-   
+
    private static final String METHOD_INVOCATION_TAG = "WrappingEjbModuleName";
 
    // Constructors --------------------------------------------------
@@ -97,7 +97,7 @@
    }
 
    // Public --------------------------------------------------------
-   
+
    public void onlyAllowLocalInvocations ()
    {
       if (isDebugEnabled) log.debug ("Only allow local invocation from now on: " + this.container.getServiceName ().toString ());
@@ -113,7 +113,7 @@
       purgeRunningInvocations ();
       if (isDebugEnabled) log.debug ("... Done: no more remote invocations currently running in this container.");
    }
-   
+
    // Z implementation ----------------------------------------------
 
    // AbstractInterceptor overrides ---------------------------------------------------
@@ -122,20 +122,20 @@
       super.create ();
       this.allowInvocations = false;
       this.allowRemoteInvocations = false;
-      
+
       this.isDebugEnabled = log.isDebugEnabled ();
-      
+
       ejbModuleName = ejbModule.getServiceName().toString();
-      
+
       // we register our inner-class to retrieve STATE notifications from our container
       //
       AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter ();
       filter.enableAttribute ("State");
-      
+
       this.container.getServer ().
-         addNotificationListener (this.container.getEjbModule ().getServiceName (), 
-                                  new CleanShutdownInterceptor.StateChangeListener (), 
-                                  filter, 
+         addNotificationListener (this.container.getEjbModule ().getServiceName (),
+                                  new CleanShutdownInterceptor.StateChangeListener (),
+                                  filter,
                                   null);
 
       // we need a way to find all CleanShutDownInterceptor of an EjbModule
@@ -176,7 +176,7 @@
       {
          String origin = getOrigin (mi);
          boolean isAppLocalCall = ejbModuleName.equals (origin);
-         
+
          if (!this.allowRemoteInvocations && !isAppLocalCall)
             // it is a remote call and they are currently forbidden!
             //
@@ -185,7 +185,7 @@
             throw new GenericClusteringException (GenericClusteringException.COMPLETED_NO,
                                                   "This application does not accept remote calls any more");
          }
-         
+
          // we need to acquire the read lock. If we cannot directly, it means
          // that the stop/destroy call has gotten the write lock in the meantime
          //
@@ -224,7 +224,7 @@
          {
             if (!isAppLocalCall)
                revertOrigin (mi, origin);
-            
+
             runningHomeInvocations--;
             if (!isAppLocalCall) // we only consider remote calls => every local originates from a remote!
                rwLock.readLock ().release ();
@@ -232,7 +232,7 @@
       }
       else
          throw new GenericClusteringException (GenericClusteringException.COMPLETED_NO,
-                                               "Container is shuting down on this node");
+                                               "Container is not allowing invocations as it failed to start or is shutting down");
    }
 
    public Object invoke (Invocation mi)
@@ -242,7 +242,7 @@
       {
          String origin = getOrigin (mi);
          boolean isAppLocalCall = ejbModuleName.equals (origin);
-         
+
          if (!this.allowRemoteInvocations && !isAppLocalCall)
             // it is a remote call and they are currently forbidden!
             //
@@ -298,7 +298,7 @@
       }
       else
          throw new GenericClusteringException (GenericClusteringException.COMPLETED_NO,
-                                               "Container is shuting down on this node");
+                                               "Container is not allowing invocations as it failed to start or is shutting down");
    }
 
    public Container getContainer ()
@@ -329,7 +329,7 @@
 
       purgeRunningInvocations();
    }
-   
+
    protected void purgeRunningInvocations ()
    {
       try
@@ -337,59 +337,59 @@
          if (this.rwLock.writeLock ().attempt (shutdownTimeout))
             this.rwLock.writeLock ().release ();
          else
-            log.info ("Possible running invocations not terminated " + 
+            log.info ("Possible running invocations not terminated " +
                "while leaving the container. Home: " + runningHomeInvocations +
-               ". Remote: " + runningInvocations + ".");         
+               ". Remote: " + runningInvocations + ".");
       }
-      catch (Exception e) 
+      catch (Exception e)
       {
-         log.info ("Exception while waiting for running invocations " + 
+         log.info ("Exception while waiting for running invocations " +
             "to leave container. Home: " + runningHomeInvocations +
-            ". Remote: " + runningInvocations + ".", e);         
+            ". Remote: " + runningInvocations + ".", e);
       }
       finally
       {
-         
+
       }
    }
-   
+
    protected String getOrigin (Invocation mi)
    {
       String value = (String)currentModule.get ();
       if (log.isTraceEnabled())
          log.trace ("GET_ORIGIN: " + value + " in " + this.container.getServiceName ().toString ());
-      return value; 
+      return value;
    }
-   
+
    protected void setOrigin (Invocation mi)
-   {      
+   {
       currentModule.set (this.ejbModuleName);
    }
-      
+
    protected void revertOrigin (Invocation mi, String origin)
    {
-      
+
       if (log.isTraceEnabled()) log.trace ("Crossing ejbModule border from " + this.ejbModuleName + " to " + origin);
       currentModule.set (origin);
    }
-   
 
+
    // Private -------------------------------------------------------
 
    protected void containerIsAboutToStop ()
    {
       log.debug ("Container about to stop: disabling HA-RMI access to bean from interceptor");
-      
+
       // This is bad: we should have some kind of code (manager) associated
       // with this ejbModule. We mimic this by electing the first ProxyFactoryHA
       // as a manager
       //
       boolean iAmTheManager = !Boolean.TRUE.equals (ejbModule.getModuleData ("ShutdownInterceptorElected"));
-      
+
       if (iAmTheManager)
       {
          ejbModule.putModuleData ("ShutdownInterceptorElected", Boolean.TRUE);
-         
+
          if (isDebugEnabled) log.debug ("Container is about to stop and I am the manager of the first step: blocking remote calls");
          // in a first step, all interceptors must refuse/redirect remote invocations
          //
@@ -414,34 +414,34 @@
       {
          if (isDebugEnabled) log.debug ("Container is about to stop but I am not the manager: I don't manage the first step of the process.");
       }
-      
+
       // in a second step, all container, manager or not, will wait that no more invocation
       // are running through
       // The cycling around other interceptor is managed by the JMX callbacks, not by us
       //
       waitForNoMoreInvocations ();
    }
-   
+
    // Inner classes -------------------------------------------------
 
    class StateChangeListener implements NotificationListener
    {
-      
+
       public void handleNotification (Notification notification, java.lang.Object handback)
       {
          if (notification instanceof AttributeChangeNotification)
          {
             AttributeChangeNotification notif = (AttributeChangeNotification) notification;
             int value = ((Integer)notif.getNewValue()).intValue ();
-            
+
             // Start management is handled by the ProxyFactoryHA, not here
             if (value == ServiceMBean.STOPPING)
-            {               
+            {
                containerIsAboutToStop ();
             }
          }
       }
-      
+
    }
-   
+
    }




More information about the jboss-cvs-commits mailing list