User: schaefera
  Date: 01/07/20 13:07:16

  Modified:    src/main/org/jboss/ejb/plugins AbstractInstanceCache.java
                        AbstractInstancePool.java
                        BMPPersistenceManager.java
                        CMPPersistenceManager.java EntityInstancePool.java
                        LRUEnterpriseContextCachePolicy.java
                        LogInterceptor.java
                        MessageDrivenInstanceInterceptor.java
                        MessageDrivenInstancePool.java
                        MessageDrivenTxInterceptorBMT.java
                        MetricsInterceptor.java SecurityInterceptor.java
                        SecurityProxyInterceptor.java
                        SingletonStatelessSessionInstancePool.java
                        StatefulSessionInstanceInterceptor.java
                        StatefulSessionInstancePool.java
                        StatelessSessionInstancePool.java
                        TxInterceptorBMT.java TxInterceptorCMT.java
  Log:
  Added Statistics Gathering for Entity Beans according to the JBoss
  Management. The main idea is to add StatisticsProvider Interface to
  all components delivering this data.
  
  Revision  Changes    Path
  1.15      +8 -1      jboss/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java
  
  Index: AbstractInstanceCache.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractInstanceCache.java        2001/07/04 22:45:56     1.14
  +++ AbstractInstanceCache.java        2001/07/20 20:07:15     1.15
  @@ -61,7 +61,7 @@
   * @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
   * @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
   *
  -* @version $Revision: 1.14 $
  +* @version $Revision: 1.15 $
   *
   *   <p><b>Revisions:</b>
   *
  @@ -117,6 +117,13 @@
                        }
                }
        }
  +  public Map retrieveStatistic()
  +  {
  +    return null;
  +  }
  +  public void resetStatistic()
  +  {
  +  }
        
        // Public --------------------------------------------------------
        public void setJMSMonitoringEnabled(boolean enable) {m_jmsMonitoring = enable;}
  
  
  
  1.13      +41 -3     jboss/src/main/org/jboss/ejb/plugins/AbstractInstancePool.java
  
  Index: AbstractInstancePool.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractInstancePool.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AbstractInstancePool.java 2001/07/04 22:48:50     1.12
  +++ AbstractInstancePool.java 2001/07/20 20:07:15     1.13
  @@ -24,22 +24,31 @@
   import org.jboss.metadata.XmlLoadable;
   import org.jboss.logging.Logger;
   
  +import org.jboss.management.JBossCountStatistic;
   
   
   /**
  -*    <description>
  +*  <review>
  +*    Abstract Instance Pool class containing the basic logic to create
  +*  an EJB Instance Pool.
  +*  </review>
   *
   *    @see <related>
   *    @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
   *    @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  +*  @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
   *    
  -*  @version $Revision: 1.12 $
  +*  @version $Revision: 1.13 $
   *
   *  <p><b>Revisions:</b>
   *  <p><b>20010704 marcf:</b>
   *  <ul>
   *  <li>- Pools if used, do not reuse but restock the pile with fresh instances
   *  </ul>
  +*  <p><b>20010709 andreas schaefer:</b>
  +*  <ul>
  +*  <li>- Added statistics gathering
  +*  </ul>
   */
   public abstract class AbstractInstancePool
   implements InstancePool, XmlLoadable
  @@ -52,6 +61,13 @@
        Stack pool = new Stack();
        int maxSize = 30;
        
  +   /** Counter of all the Bean instantiated within the Pool **/
  +   protected JBossCountStatistic mInstantiate = new JBossCountStatistic( 
"Instantiation", "", "Beans instantiated in Pool" );
  +   /** Counter of all the Bean destroyed within the Pool **/
  +   protected JBossCountStatistic mDestroy = new JBossCountStatistic( "Destroy", "", 
"Beans destroyed in Pool" );
  +   /** Counter of all the ready Beans within the Pool (which are not used now) **/
  +   protected JBossCountStatistic mReadyBean = new JBossCountStatistic( "ReadyBean", 
"", "Numbers of ready Bean Pool" );
  +
        // Static --------------------------------------------------------
        
        // Constructors --------------------------------------------------
  @@ -69,6 +85,11 @@
                this.container = c;
        }
        
  +   /**
  +   * <review>
  +   * @return Callback to the container which can be null if not set proviously
  +   * </review>
  +   **/
        public Container getContainer()
        {
                return container;
  @@ -106,6 +127,7 @@
                
                if (!pool.empty())
                {
  +         mReadyBean.remove();
                        return (EnterpriseContext)pool.pop();
                } else
                {
  @@ -142,7 +164,7 @@
                        
                        // We do not reuse but create a brand new instance simplifies 
the design
                        try {
  -                             
  +                             mReadyBean.add();
                                pool.push(create(container.createBeanClassInstance()));
                        } catch (Exception ignored) {}                  
                        //pool.push(ctx);
  @@ -157,6 +179,7 @@
                // Throw away
                try
                {
  +         mDestroy.add();
                        ctx.discard();
                } catch (RemoteException e)
                {
  @@ -176,6 +199,21 @@
                }
        }
        
  +   public Map retrieveStatistic()
  +   {
  +      Map lStatistics = new HashMap();
  +      lStatistics.put( "InstantiationCount", mInstantiate );
  +      lStatistics.put( "DestroyCount", mDestroy );
  +      lStatistics.put( "ReadyBeanCount", mReadyBean );
  +      return lStatistics;
  +   }
  +   public void resetStatistic()
  +   {
  +      mInstantiate.reset();
  +      mDestroy.reset();
  +      mReadyBean.reset();
  +   }
  +   
        // Package protected ---------------------------------------------
        
        // Protected -----------------------------------------------------
  
  
  
  1.26      +168 -101  jboss/src/main/org/jboss/ejb/plugins/BMPPersistenceManager.java
  
  Index: BMPPersistenceManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/BMPPersistenceManager.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- BMPPersistenceManager.java        2001/06/24 03:06:46     1.25
  +++ BMPPersistenceManager.java        2001/07/20 20:07:15     1.26
  @@ -15,6 +15,7 @@
   import java.util.Enumeration;
   import java.util.Iterator;
   import java.util.HashMap;
  +import java.util.Map;
   
   import javax.ejb.EntityBean;
   import javax.ejb.CreateException;
  @@ -29,6 +30,8 @@
   import org.jboss.ejb.EntityEnterpriseContext;
   import org.jboss.logging.Logger;
   
  +import org.jboss.management.JBossCountStatistic;
  +import org.jboss.management.JBossTimeStatistic;
   
   /**
   *   <description>
  @@ -36,7 +39,14 @@
   *   @see <related>
   *   @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
   *  @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  -*   @version $Revision: 1.25 $
  +*  @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  +*   @version $Revision: 1.26 $
  +*
  +*  <p><b>Revisions:</b>
  +*  <p><b>20010709 andreas schaefer:</b>
  +*  <ul>
  +*  <li>- Added statistics gathering
  +*  </ul>
   */
   public class BMPPersistenceManager
   implements EntityPersistenceManager
  @@ -56,6 +66,14 @@
      HashMap postCreateMethods = new HashMap();
      HashMap finderMethods = new HashMap();
   
  +   private JBossCountStatistic mCreate = new JBossCountStatistic( "Create", "", 
"EJBs created" );
  +   private JBossCountStatistic mRemove = new JBossCountStatistic( "Remove", "", 
"EJBs removed" );
  +   private JBossCountStatistic mActiveBean = new JBossCountStatistic( "ActiveBean", 
"", "Numbers of active EJBs" );
  +   private JBossTimeStatistic mActivate = new JBossTimeStatistic( "Activation", 
"ms", "Activation Time" );
  +   private JBossTimeStatistic mPassivate = new JBossTimeStatistic( "Passivation", 
"ms", "Passivation Time" );
  +   private JBossTimeStatistic mLoad = new JBossTimeStatistic( "Load", "ms", "Load 
Time" );
  +   private JBossTimeStatistic mStore = new JBossTimeStatistic( "Store", "ms", "Load 
Time" );
  +
      // Static --------------------------------------------------------
   
      // Constructors --------------------------------------------------
  @@ -135,108 +153,113 @@
      public void createEntity(Method m, Object[] args, EntityEnterpriseContext ctx)
      throws Exception
      {
  -      Method createMethod = (Method)createMethods.get(m);
  -      Method postCreateMethod = (Method)postCreateMethods.get(m);
  -
  -      Object id = null;
  -      try
  -      {
  -         // Call ejbCreate
  -         id = createMethod.invoke(ctx.getInstance(), args);
  -      } catch (IllegalAccessException e)
  -      {
  -         // Throw this as a bean exception...(?)
  -         throw new EJBException(e);
  -      } catch (InvocationTargetException ite)
  -      {
  -                     Throwable e = ite.getTargetException();
  -         if (e instanceof CreateException)
  -         {
  -            // Rethrow exception
  -            throw (CreateException)e;
  -         }
  -         else if (e instanceof RemoteException)
  -         {
  -            // Rethrow exception
  -            throw (RemoteException)e;
  +      try {
  +         Method createMethod = (Method)createMethods.get(m);
  +         Method postCreateMethod = (Method)postCreateMethods.get(m);
  +   
  +         Object id = null;
  +         try
  +         {
  +            // Call ejbCreate
  +            id = createMethod.invoke(ctx.getInstance(), args);
  +         } catch (IllegalAccessException e)
  +         {
  +            // Throw this as a bean exception...(?)
  +            throw new EJBException(e);
  +         } catch (InvocationTargetException ite)
  +         {
  +            Throwable e = ite.getTargetException();
  +            if (e instanceof CreateException)
  +            {
  +               // Rethrow exception
  +               throw (CreateException)e;
  +            }
  +            else if (e instanceof RemoteException)
  +            {
  +               // Rethrow exception
  +               throw (RemoteException)e;
  +            }
  +            else if (e instanceof EJBException)
  +            {
  +               // Rethrow exception
  +               throw (EJBException)e;
  +            }
  +            else if (e instanceof RuntimeException)
  +            {
  +               // Wrap runtime exceptions
  +               throw new EJBException((Exception)e);
  +            }
  +            else if(e instanceof Exception)
  +            {
  +               throw (Exception)e;
  +            }
  +            else
  +            {
  +               throw (Error)e;
  +            }
  +         }
  +   
  +         // set the id
  +         ctx.setId(id);
  +   
  +         // Create a new CacheKey
  +         Object cacheKey = ((EntityCache) con.getInstanceCache()).createCacheKey( 
id );
  +   
  +         // Give it to the context
  +         ctx.setCacheKey(cacheKey);
  +   
  +         // Insert in cache, it is now safe
  +         con.getInstanceCache().insert(ctx);
  +   
  +         // Create EJBObject
  +           // Create EJBObject
  +        if (con.getContainerInvoker() != null)
  +         ctx.setEJBObject(con.getContainerInvoker().getEntityEJBObject(cacheKey));
  +        if (con.getLocalHomeClass() != null)
  +         
ctx.setEJBLocalObject(con.getLocalContainerInvoker().getEntityEJBLocalObject(cacheKey));
  +   
  +         try
  +         {
  +            postCreateMethod.invoke(ctx.getInstance(), args);
  +         } catch (IllegalAccessException e)
  +         {
  +            // Throw this as a bean exception...(?)
  +            throw new EJBException(e);
  +         } catch (InvocationTargetException ite)
  +         {
  +            Throwable e = ite.getTargetException();
  +            if (e instanceof CreateException)
  +            {
  +               // Rethrow exception
  +               throw (CreateException)e;
  +            }
  +            else if (e instanceof RemoteException)
  +            {
  +               // Rethrow exception
  +               throw (RemoteException)e;
  +            }
  +            else if (e instanceof EJBException)
  +            {
  +               // Rethrow exception
  +               throw (EJBException)e;
  +            }
  +            else if (e instanceof RuntimeException)
  +            {
  +               // Wrap runtime exceptions
  +               throw new EJBException((Exception)e);
  +            }
  +            else if(e instanceof Exception)
  +            {
  +               throw (Exception)e;
  +            }
  +            else
  +            {
  +               throw (Error)e;
  +            }
            }
  -         else if (e instanceof EJBException)
  -         {
  -            // Rethrow exception
  -            throw (EJBException)e;
  -         }
  -         else if (e instanceof RuntimeException)
  -         {
  -            // Wrap runtime exceptions
  -            throw new EJBException((Exception)e);
  -         }
  -         else if(e instanceof Exception)
  -         {
  -            throw (Exception)e;
  -         }
  -         else
  -         {
  -            throw (Error)e;
  -         }
         }
  -
  -      // set the id
  -      ctx.setId(id);
  -
  -      // Create a new CacheKey
  -      Object cacheKey = ((EntityCache) con.getInstanceCache()).createCacheKey( id );
  -
  -      // Give it to the context
  -      ctx.setCacheKey(cacheKey);
  -
  -      // Insert in cache, it is now safe
  -      con.getInstanceCache().insert(ctx);
  -
  -      // Create EJBObject
  -        // Create EJBObject
  -     if (con.getContainerInvoker() != null)
  -      ctx.setEJBObject(con.getContainerInvoker().getEntityEJBObject(cacheKey));
  -     if (con.getLocalHomeClass() != null)
  -      
ctx.setEJBLocalObject(con.getLocalContainerInvoker().getEntityEJBLocalObject(cacheKey));
  -
  -      try
  -      {
  -         postCreateMethod.invoke(ctx.getInstance(), args);
  -      } catch (IllegalAccessException e)
  -      {
  -         // Throw this as a bean exception...(?)
  -         throw new EJBException(e);
  -      } catch (InvocationTargetException ite)
  -      {
  -         Throwable e = ite.getTargetException();
  -         if (e instanceof CreateException)
  -         {
  -            // Rethrow exception
  -            throw (CreateException)e;
  -         }
  -         else if (e instanceof RemoteException)
  -         {
  -            // Rethrow exception
  -            throw (RemoteException)e;
  -         }
  -         else if (e instanceof EJBException)
  -         {
  -            // Rethrow exception
  -            throw (EJBException)e;
  -         }
  -         else if (e instanceof RuntimeException)
  -         {
  -            // Wrap runtime exceptions
  -            throw new EJBException((Exception)e);
  -         }
  -         else if(e instanceof Exception)
  -         {
  -            throw (Exception)e;
  -         }
  -         else
  -         {
  -            throw (Error)e;
  -         }
  +      finally {
  +         mCreate.add();
         }
      }
   
  @@ -299,6 +322,7 @@
      public void activateEntity(EntityEnterpriseContext ctx)
      throws RemoteException
      {
  +      long lStart = System.currentTimeMillis();
         try
         {
            ejbActivate.invoke(ctx.getInstance(), new Object[0]);
  @@ -325,11 +349,15 @@
               throw new EJBException((Exception)e);
            }
         }
  +      finally {
  +         mActivate.add( System.currentTimeMillis() - lStart );
  +      }
      }
   
      public void loadEntity(EntityEnterpriseContext ctx)
      throws RemoteException
      {
  +      long lStart = System.currentTimeMillis();
         try
         {
            ejbLoad.invoke(ctx.getInstance(), new Object[0]);
  @@ -356,11 +384,15 @@
               throw new EJBException((Exception)e);
            }
         }
  +      finally {
  +         mLoad.add( System.currentTimeMillis() - lStart );
  +      }
      }
   
      public void storeEntity(EntityEnterpriseContext ctx)
      throws RemoteException
      {
  +      long lStart = System.currentTimeMillis();
         //DEBUG       Logger.debug("Store entity");
         try
         {
  @@ -388,11 +420,15 @@
               throw new EJBException((Exception)e);
            }
         }
  +      finally {
  +         mStore.add( System.currentTimeMillis() - lStart );
  +      }
      }
   
      public void passivateEntity(EntityEnterpriseContext ctx)
      throws RemoteException
      {
  +      long lStart = System.currentTimeMillis();
         try
         {
            ejbPassivate.invoke(ctx.getInstance(), new Object[0]);
  @@ -419,6 +455,9 @@
               throw new EJBException((Exception)e);
            }
         }
  +      finally {
  +         mPassivate.add( System.currentTimeMillis() - lStart );
  +      }
      }
   
      public void removeEntity(EntityEnterpriseContext ctx)
  @@ -455,7 +494,35 @@
               throw new EJBException((Exception)e);
            }
         }
  +      finally {
  +         mRemove.add();
  +      }
  +   }
  +
  +   public Map retrieveStatistic()
  +   {
  +      // Loop through all Interceptors and add Statistic
  +      Map lStatistics = new HashMap();
  +      lStatistics.put( "CreateCount", mCreate );
  +      lStatistics.put( "RemoveCount", mRemove );
  +      lStatistics.put( "ActiveBeanCount", mActiveBean );
  +      lStatistics.put( "ActivationTime", mActivate );
  +      lStatistics.put( "PassivationTime", mPassivate );
  +      lStatistics.put( "LoadTime", mLoad );
  +      lStatistics.put( "StoreTime", mStore );
  +      return lStatistics;
  +   }
  +   public void resetStatistic()
  +   {
  +      mCreate.reset();
  +      mRemove.reset();
  +      mActiveBean.reset();
  +      mActivate.reset();
  +      mPassivate.reset();
  +      mLoad.reset();
  +      mStore.reset();
      }
  +   
      // Z implementation ----------------------------------------------
   
      // Package protected ---------------------------------------------
  
  
  
  1.27      +48 -1     jboss/src/main/org/jboss/ejb/plugins/CMPPersistenceManager.java
  
  Index: CMPPersistenceManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/CMPPersistenceManager.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- CMPPersistenceManager.java        2001/07/09 21:04:24     1.26
  +++ CMPPersistenceManager.java        2001/07/20 20:07:15     1.27
  @@ -38,6 +38,9 @@
   import org.jboss.util.FinderResults;
   import org.jboss.util.Sync;
   
  +import org.jboss.management.JBossCountStatistic;
  +import org.jboss.management.JBossTimeStatistic;
  +
   /**
   *   The CMP Persistence Manager implements the semantics of the CMP
   *  EJB 1.1 call back specification.
  @@ -49,11 +52,13 @@
   *   @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
   *   @author <a href="mailto:[EMAIL PROTECTED]";>Dan Christopherson</a>
   *   @author <a href="mailto:[EMAIL PROTECTED]";>Bill Burke</a>
  -*   @version $Revision: 1.26 $
  +*   @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  +*   @version $Revision: 1.27 $
   *
   *   Revisions:
   *   20010621 Bill Burke: removed loadEntities call because CMP read-ahead is now
   *   done directly by the finder.
  +*   20010709 Andreas Schaefer: added statistics gathering
   *   
   */
   public class CMPPersistenceManager
  @@ -75,6 +80,14 @@
      HashMap createMethods = new HashMap();
      HashMap postCreateMethods = new HashMap();
   
  +   private JBossCountStatistic mCreate = new JBossCountStatistic( "Create", "", 
"EJBs created" );
  +   private JBossCountStatistic mRemove = new JBossCountStatistic( "Remove", "", 
"EJBs removed" );
  +   private JBossCountStatistic mActiveBean = new JBossCountStatistic( "ActiveBean", 
"", "Numbers of active EJBs" );
  +   private JBossTimeStatistic mActivation = new JBossTimeStatistic( "Activation", 
"ms", "Activation Time" );
  +   private JBossTimeStatistic mPassivation = new JBossTimeStatistic( "Passivation", 
"ms", "Passivation Time" );
  +   private JBossTimeStatistic mLoad = new JBossTimeStatistic( "Load", "ms", "Load 
Time" );
  +   private JBossTimeStatistic mStore = new JBossTimeStatistic( "Store", "ms", "Load 
Time" );
  +   
      // Static --------------------------------------------------------
   
       // Constructors --------------------------------------------------
  @@ -323,16 +336,20 @@
            }
         }
   
  +      long lStart = System.currentTimeMillis();
         // The implementation of the call can be left absolutely empty, the 
propagation of the call
                // is just a notification for stores that would need to know that an 
instance is being activated
         store.activateEntity(ctx);
  +      mActivation.add( System.currentTimeMillis() - lStart );
      }
   
      public void loadEntity(EntityEnterpriseContext ctx)
         throws RemoteException {
   
  +      long lStart = System.currentTimeMillis();
         // Have the store load the fields of the instance
         store.loadEntity(ctx);
  +      mLoad.add( System.currentTimeMillis() - lStart );
   
         invokeLoad(ctx);
      }
  @@ -366,8 +383,10 @@
            }
         }
   
  +      long lStart = System.currentTimeMillis();
         // Have the store deal with storing the fields of the instance
         store.storeEntity(ctx);
  +      mStore.add( System.currentTimeMillis() - lStart );
   
      }
   
  @@ -400,7 +419,9 @@
            }
         }
   
  +      long lStart = System.currentTimeMillis();
         store.passivateEntity(ctx);
  +      mPassivation.add( System.currentTimeMillis() - lStart );
      }
   
      public void removeEntity(EntityEnterpriseContext ctx)
  @@ -432,7 +453,9 @@
            }
         }
   
  +      long lStart = System.currentTimeMillis();
         store.removeEntity(ctx);
  +      mRemove.add();
      }
       
      protected void invokeLoad(EntityEnterpriseContext ctx) throws RemoteException {  
      
  @@ -521,6 +544,30 @@
                }
        }                       
   
  +   public Map retrieveStatistic()
  +   {
  +      // Loop through all Interceptors and add Statistic
  +      Map lStatistics = new HashMap();
  +      lStatistics.put( "CreateCount", mCreate );
  +      lStatistics.put( "RemoveCount", mRemove );
  +      lStatistics.put( "ActiveBeanCount", mActiveBean );
  +      lStatistics.put( "ActivationTime", mActivation );
  +      lStatistics.put( "PassivationTime", mPassivation );
  +      lStatistics.put( "LoadTime", mLoad );
  +      lStatistics.put( "StoreTime", mStore );
  +      return lStatistics;
  +   }
  +   public void resetStatistic()
  +   {
  +      mCreate.reset();
  +      mRemove.reset();
  +      mActiveBean.reset();
  +      mActivation.reset();
  +      mPassivation.reset();
  +      mLoad.reset();
  +      mStore.reset();
  +   }
  +   
      // Z implementation ----------------------------------------------
   
      // Package protected ---------------------------------------------
  
  
  
  1.12      +9 -1      jboss/src/main/org/jboss/ejb/plugins/EntityInstancePool.java
  
  Index: EntityInstancePool.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstancePool.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EntityInstancePool.java   2001/07/03 23:15:51     1.11
  +++ EntityInstancePool.java   2001/07/20 20:07:15     1.12
  @@ -20,7 +20,14 @@
    *   @see <related>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
    *  @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  - *   @version $Revision: 1.11 $
  + *  @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  + *   @version $Revision: 1.12 $
  + *      
  + * <p><b>Revisions:</b>
  + * <p><b>20010718 andreas schaefer:</b>
  + * <ul>
  + * <li>- Added statistics gathering
  + * </ul>
    */
   public class EntityInstancePool
      extends AbstractInstancePool
  @@ -65,6 +72,7 @@
      protected EnterpriseContext create(Object instance)
         throws Exception
      {
  +      mInstantiate.add();
         return new EntityEnterpriseContext(instance, getContainer());
      }
       
  
  
  
  1.11      +2 -1      
jboss/src/main/org/jboss/ejb/plugins/LRUEnterpriseContextCachePolicy.java
  
  Index: LRUEnterpriseContextCachePolicy.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/LRUEnterpriseContextCachePolicy.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LRUEnterpriseContextCachePolicy.java      2001/07/10 05:08:04     1.10
  +++ LRUEnterpriseContextCachePolicy.java      2001/07/20 20:07:15     1.11
  @@ -7,6 +7,7 @@
   package org.jboss.ejb.plugins;
   
   import java.util.HashMap;
  +import java.util.Map;
   import javax.jms.Message;
   import javax.jms.JMSException;
   
  @@ -26,7 +27,7 @@
    *
    * @see AbstractInstanceCache
    * @author <a href="mailto:[EMAIL PROTECTED]";>Simone Bordet</a>
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    */
   public class LRUEnterpriseContextCachePolicy
      extends LRUCachePolicy
  
  
  
  1.16      +13 -1     jboss/src/main/org/jboss/ejb/plugins/LogInterceptor.java
  
  Index: LogInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/LogInterceptor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- LogInterceptor.java       2001/06/18 20:01:23     1.15
  +++ LogInterceptor.java       2001/07/20 20:07:15     1.16
  @@ -36,7 +36,7 @@
    *      
    *   @see <related>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
  - *   @version $Revision: 1.15 $
  + *   @version $Revision: 1.16 $
    */
   public class LogInterceptor
      extends AbstractInterceptor
  @@ -245,6 +245,18 @@
         }
      }
      
  +  // Monitorable implementation ------------------------------------
  +  public void sample(Object s)
  +  {
  +    // Just here to because Monitorable request it but will be removed soon
  +  }
  +  public Map retrieveStatistic()
  +  {
  +    return null;
  +  }
  +  public void resetStatistic()
  +  {
  +  }
      // Private -------------------------------------------------------
   }
   
  
  
  
  1.7       +14 -1     
jboss/src/main/org/jboss/ejb/plugins/MessageDrivenInstanceInterceptor.java
  
  Index: MessageDrivenInstanceInterceptor.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/MessageDrivenInstanceInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MessageDrivenInstanceInterceptor.java     2001/07/13 22:48:23     1.6
  +++ MessageDrivenInstanceInterceptor.java     2001/07/20 20:07:15     1.7
  @@ -7,6 +7,7 @@
   package org.jboss.ejb.plugins;
   
   import java.rmi.RemoteException;
  +import java.util.Map;
   
   import org.jboss.ejb.Container;
   import org.jboss.ejb.MessageDrivenContainer;
  @@ -20,7 +21,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class MessageDrivenInstanceInterceptor
      extends AbstractInterceptor
  @@ -95,5 +96,17 @@
               container.getInstancePool().free(mi.getEnterpriseContext());
         }
      }
  +  // Monitorable implementation ------------------------------------
  +  public void sample(Object s)
  +  {
  +    // Just here to because Monitorable request it but will be removed soon
  +  }
  +  public Map retrieveStatistic()
  +  {
  +    return null;
  +  }
  +  public void resetStatistic()
  +  {
  +  }
   }
   
  
  
  
  1.5       +9 -1      
jboss/src/main/org/jboss/ejb/plugins/MessageDrivenInstancePool.java
  
  Index: MessageDrivenInstancePool.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/MessageDrivenInstancePool.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MessageDrivenInstancePool.java    2001/06/18 20:01:23     1.4
  +++ MessageDrivenInstancePool.java    2001/07/20 20:07:15     1.5
  @@ -18,7 +18,14 @@
    *   @see <related>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
    *      @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - *   @version $Revision: 1.4 $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  + *   @version $Revision: 1.5 $
  + *      
  + * <p><b>Revisions:</b>
  + * <p><b>20010718 andreas schaefer:</b>
  + * <ul>
  + * <li>- Added Statistics Gathering
  + * </ul>
    */
   public class MessageDrivenInstancePool
      extends AbstractInstancePool
  @@ -45,6 +52,7 @@
      protected EnterpriseContext create(Object instance)
         throws Exception
      {
  +      mInstantiate.add();
         return new MessageDrivenEnterpriseContext(instance, getContainer());
      }
       
  
  
  
  1.7       +14 -1     
jboss/src/main/org/jboss/ejb/plugins/MessageDrivenTxInterceptorBMT.java
  
  Index: MessageDrivenTxInterceptorBMT.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/MessageDrivenTxInterceptorBMT.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MessageDrivenTxInterceptorBMT.java        2001/06/25 21:20:28     1.6
  +++ MessageDrivenTxInterceptorBMT.java        2001/07/20 20:07:15     1.7
  @@ -6,6 +6,7 @@
   */
   package org.jboss.ejb.plugins;
   
  +import java.util.Map;
   import java.rmi.ServerException;
   
   import org.jboss.ejb.MethodInvocation;
  @@ -19,7 +20,7 @@
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Sebastien Alborini</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Ole Husgaard</a>
  - *   @version $Revision: 1.6 $
  + *   @version $Revision: 1.7 $
    */
   public class MessageDrivenTxInterceptorBMT
      extends AbstractTxInterceptorBMT
  @@ -35,4 +36,16 @@
      {
         return invokeNext(true, mi);
      }
  +  // Monitorable implementation ------------------------------------
  +  public void sample(Object s)
  +  {
  +    // Just here to because Monitorable request it but will be removed soon
  +  }
  +  public Map retrieveStatistic()
  +  {
  +    return null;
  +  }
  +  public void resetStatistic()
  +  {
  +  }
   }
  
  
  
  1.10      +13 -0     jboss/src/main/org/jboss/ejb/plugins/MetricsInterceptor.java
  
  Index: MetricsInterceptor.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/MetricsInterceptor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MetricsInterceptor.java   2001/04/18 20:36:17     1.9
  +++ MetricsInterceptor.java   2001/07/20 20:07:15     1.10
  @@ -9,6 +9,7 @@
   // standard imports
   import java.lang.reflect.Method;
   import java.security.Principal;
  +import java.util.Map;
   import java.util.Properties;
   import java.util.List;
   import java.util.ArrayList;
  @@ -196,6 +197,18 @@
           }
       }
   
  +  // Monitorable implementation ------------------------------------
  +  public void sample(Object s)
  +  {
  +    // Just here to because Monitorable request it but will be removed soon
  +  }
  +  public Map retrieveStatistic()
  +  {
  +    return null;
  +  }
  +  public void resetStatistic()
  +  {
  +  }
   
       /**
        * JMS Publisher thread implementation.
  
  
  
  1.19      +14 -1     jboss/src/main/org/jboss/ejb/plugins/SecurityInterceptor.java
  
  Index: SecurityInterceptor.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/SecurityInterceptor.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SecurityInterceptor.java  2001/06/18 20:01:23     1.18
  +++ SecurityInterceptor.java  2001/07/20 20:07:15     1.19
  @@ -10,6 +10,7 @@
   import java.rmi.RemoteException;
   import java.security.Principal;
   import java.util.Iterator;
  +import java.util.Map;
   import java.util.Set;
   import javax.naming.InitialContext;
   
  @@ -28,7 +29,7 @@
   
   @author <a href="[EMAIL PROTECTED]">Oleg Nitz</a>
   @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
  -@version $Revision: 1.18 $
  +@version $Revision: 1.19 $
   */
   public class SecurityInterceptor extends AbstractInterceptor
   {
  @@ -215,4 +216,16 @@
           }
      }
   
  +  // Monitorable implementation ------------------------------------
  +  public void sample(Object s)
  +  {
  +    // Just here to because Monitorable request it but will be removed soon
  +  }
  +  public Map retrieveStatistic()
  +  {
  +    return null;
  +  }
  +  public void resetStatistic()
  +  {
  +  }
   }
  
  
  
  1.5       +2 -1      
jboss/src/main/org/jboss/ejb/plugins/SecurityProxyInterceptor.java
  
  Index: SecurityProxyInterceptor.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/SecurityProxyInterceptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SecurityProxyInterceptor.java     2001/07/10 05:03:16     1.4
  +++ SecurityProxyInterceptor.java     2001/07/20 20:07:15     1.5
  @@ -8,6 +8,7 @@
   
   import java.lang.reflect.Method;
   import java.rmi.RemoteException;
  +import java.util.Map;
   import java.security.Principal;
   import javax.ejb.EJBContext;
   import javax.naming.InitialContext;
  @@ -31,7 +32,7 @@
    * interceptor has access to the EJB instance and context.
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class SecurityProxyInterceptor
      extends AbstractInterceptor
  
  
  
  1.9       +40 -2     
jboss/src/main/org/jboss/ejb/plugins/SingletonStatelessSessionInstancePool.java
  
  Index: SingletonStatelessSessionInstancePool.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/SingletonStatelessSessionInstancePool.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SingletonStatelessSessionInstancePool.java        2001/06/24 03:06:46     1.8
  +++ SingletonStatelessSessionInstancePool.java        2001/07/20 20:07:15     1.9
  @@ -8,7 +8,8 @@
   
   import java.rmi.RemoteException;
   import java.rmi.ServerException;
  -
  +import java.util.Map;
  +import java.util.HashMap;
   import javax.ejb.EJBHome;
   
   import org.jboss.ejb.Container;
  @@ -21,6 +22,7 @@
   import org.jboss.metadata.MetaData;
   import org.w3c.dom.Element;
   import org.jboss.logging.Logger;
  +import org.jboss.management.JBossCountStatistic;
   
   
   /**
  @@ -29,7 +31,13 @@
    *      
    *   @see <related>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
  - *   @version $Revision: 1.8 $
  + *   @version $Revision: 1.9 $
  + *      
  + * <p><b>Revisions:</b>
  + * <p><b>20010718 andreas schaefer:</b>
  + * <ul>
  + * <li>- Added Statistics Gathering
  + * </ul>
    */
   public class SingletonStatelessSessionInstancePool
      implements InstancePool, XmlLoadable
  @@ -43,6 +51,13 @@
      boolean inUse = false;
      boolean isSynchronized = true;
      
  +   /** Counter of all the Bean instantiated within the Pool **/
  +   protected JBossCountStatistic mInstantiate = new JBossCountStatistic( 
"Instantiation", "", "Beans instantiated in Pool" );
  +   /** Counter of all the Bean destroyed within the Pool **/
  +   protected JBossCountStatistic mDestroy = new JBossCountStatistic( "Destroy", "", 
"Beans destroyed in Pool" );
  +   /** Counter of all the ready Beans within the Pool (which are not used now) **/
  +   protected JBossCountStatistic mReadyBean = new JBossCountStatistic( "ReadyBean", 
"", "Numbers of ready Bean Pool" );
  +
      // Static --------------------------------------------------------
      
      // Constructors --------------------------------------------------
  @@ -98,6 +113,7 @@
         {
            try
            {
  +            mInstantiate.add();
               ctx = create(con.createBeanClassInstance(), con);
            } catch (InstantiationException e)
            {
  @@ -107,6 +123,10 @@
               throw new ServerException("Could not instantiate bean", e);
            }
         }
  +      else
  +      {
  +         mReadyBean.remove();
  +      }
         
         // Lock and return instance
         inUse = true;
  @@ -127,6 +147,7 @@
         // Notify waiters
         inUse = false;
         this.notifyAll();
  +      mReadyBean.add();
      }
      
      public void discard(EnterpriseContext ctx)
  @@ -134,6 +155,8 @@
         // Throw away
         try
         {
  +         mDestroy.add();
  +         mReadyBean.remove();
            ctx.discard();
         } catch (RemoteException e)
         {
  @@ -143,6 +166,21 @@
         // Notify waiters
         inUse = false;
         this.notifyAll();
  +   }
  +   
  +   public Map retrieveStatistic()
  +   {
  +      Map lStatistics = new HashMap();
  +      lStatistics.put( "InstantiationCount", mInstantiate );
  +      lStatistics.put( "DestroyCount", mDestroy );
  +      lStatistics.put( "ReadyBeanCount", mReadyBean );
  +      return lStatistics;
  +   }
  +   public void resetStatistic()
  +   {
  +      mInstantiate.reset();
  +      mDestroy.reset();
  +      mReadyBean.reset();
      }
      
      // Z implementation ----------------------------------------------
  
  
  
  1.19      +2 -1      
jboss/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
  
  Index: StatefulSessionInstanceInterceptor.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- StatefulSessionInstanceInterceptor.java   2001/07/10 05:06:40     1.18
  +++ StatefulSessionInstanceInterceptor.java   2001/07/20 20:07:15     1.19
  @@ -8,6 +8,7 @@
   
   import java.lang.reflect.Method;
   import java.rmi.RemoteException;
  +import java.util.Map;
   
   import javax.transaction.Transaction;
   import javax.transaction.RollbackException;
  @@ -34,7 +35,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  - * @version $Revision: 1.18 $
  + * @version $Revision: 1.19 $
    *
    * <p><b>Revisions:</b>
    * <p><b>20010704 marcf</b>
  
  
  
  1.5       +9 -1      
jboss/src/main/org/jboss/ejb/plugins/StatefulSessionInstancePool.java
  
  Index: StatefulSessionInstancePool.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/StatefulSessionInstancePool.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StatefulSessionInstancePool.java  2000/12/07 15:44:25     1.4
  +++ StatefulSessionInstancePool.java  2001/07/20 20:07:15     1.5
  @@ -17,7 +17,14 @@
   *      
   *    @see <related>
   *   @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  -*    @version $Revision: 1.4 $
  +*   @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  +*    @version $Revision: 1.5 $
  +*      
  +* <p><b>Revisions:</b>
  +* <p><b>20010718 andreas schaefer:</b>
  +* <ul>
  +* <li>- Added Statistics Gathering
  +* </ul>
   */
   public class StatefulSessionInstancePool
   extends AbstractInstancePool
  @@ -41,6 +48,7 @@
        protected EnterpriseContext create(Object instance)
        throws Exception
        {
  +      mInstantiate.add();
                // The instance is created by the caller and is a newInstance();
                return new StatefulSessionEnterpriseContext(instance, getContainer());
        }
  
  
  
  1.6       +9 -1      
jboss/src/main/org/jboss/ejb/plugins/StatelessSessionInstancePool.java
  
  Index: StatelessSessionInstancePool.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/StatelessSessionInstancePool.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StatelessSessionInstancePool.java 2001/06/18 20:01:23     1.5
  +++ StatelessSessionInstancePool.java 2001/07/20 20:07:15     1.6
  @@ -17,7 +17,14 @@
    *      
    *   @see <related>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
  - *   @version $Revision: 1.5 $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  + *   @version $Revision: 1.6 $
  + *      
  + * <p><b>Revisions:</b>
  + * <p><b>20010718 andreas schaefer:</b>
  + * <ul>
  + * <li>- Added Statistics Gathering
  + * </ul>
    */
   public class StatelessSessionInstancePool
      extends AbstractInstancePool
  @@ -44,6 +51,7 @@
      protected EnterpriseContext create(Object instance)
         throws Exception
      {
  +      mInstantiate.add();
         return new StatelessSessionEnterpriseContext(instance, getContainer());
      }
       
  
  
  
  1.19      +15 -1     jboss/src/main/org/jboss/ejb/plugins/TxInterceptorBMT.java
  
  Index: TxInterceptorBMT.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/TxInterceptorBMT.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TxInterceptorBMT.java     2001/06/25 19:45:49     1.18
  +++ TxInterceptorBMT.java     2001/07/20 20:07:15     1.19
  @@ -6,6 +6,7 @@
   */
   package org.jboss.ejb.plugins;
   
  +import java.util.Map;
   
   import org.jboss.ejb.MethodInvocation;
   
  @@ -19,7 +20,7 @@
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Anatoly Akkerman</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Ole Husgaard</a>
  - *   @version $Revision: 1.18 $
  + *   @version $Revision: 1.19 $
    */
   public class TxInterceptorBMT
      extends AbstractTxInterceptorBMT
  @@ -60,6 +61,19 @@
      {
         return invokeNext(true, mi);
      }
  +
  +  // Monitorable implementation ------------------------------------
  +  public void sample(Object s)
  +  {
  +    // Just here to because Monitorable request it but will be removed soon
  +  }
  +  public Map retrieveStatistic()
  +  {
  +    return null;
  +  }
  +  public void resetStatistic()
  +  {
  +  }
   
      // Protected  ----------------------------------------------------
   
  
  
  
  1.14      +14 -1     jboss/src/main/org/jboss/ejb/plugins/TxInterceptorCMT.java
  
  Index: TxInterceptorCMT.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/TxInterceptorCMT.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TxInterceptorCMT.java     2001/06/25 19:45:49     1.13
  +++ TxInterceptorCMT.java     2001/07/20 20:07:15     1.14
  @@ -9,6 +9,7 @@
   import java.lang.reflect.Method;
   import java.rmi.RemoteException;
   import java.util.HashMap;
  +import java.util.Map;
   
   import javax.transaction.Status;
   import javax.transaction.Transaction;
  @@ -28,7 +29,7 @@
    *  @author <a href="mailto:[EMAIL PROTECTED]";>Sebastien Alborini</a>
    *  @author <a href="mailto:[EMAIL PROTECTED]";>Anatoly Akkerman</a>
    *  @author <a href="mailto:[EMAIL PROTECTED]";>Ole Husgaard</a>
  - *  @version $Revision: 1.13 $
  + *  @version $Revision: 1.14 $
    */
   public class TxInterceptorCMT
       extends AbstractTxInterceptor
  @@ -269,4 +270,16 @@
   
       // Inner classes -------------------------------------------------
   
  +  // Monitorable implementation ------------------------------------
  +  public void sample(Object s)
  +  {
  +    // Just here to because Monitorable request it but will be removed soon
  +  }
  +  public Map retrieveStatistic()
  +  {
  +    return null;
  +  }
  +  public void resetStatistic()
  +  {
  +  }
   }
  
  
  

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

Reply via email to