User: schaefera
Date: 01/07/20 13:07:15
Modified: src/main/org/jboss/ejb ContainerFactory.java
EntityContainer.java EntityPersistenceManager.java
InstanceCache.java InstancePool.java
MessageDrivenContainer.java
StatefulSessionContainer.java
StatelessSessionContainer.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.83 +33 -35 jboss/src/main/org/jboss/ejb/ContainerFactory.java
Index: ContainerFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/ContainerFactory.java,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- ContainerFactory.java 2001/07/13 01:20:04 1.82
+++ ContainerFactory.java 2001/07/20 20:07:15 1.83
@@ -66,7 +66,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]">Scott Stark</a>
- * @version $Revision: 1.82 $
+ * @version $Revision: 1.83 $
*/
public class ContainerFactory
extends ServiceMBeanSupport
@@ -695,40 +695,38 @@
return container;
}
- // **************
- // Helper Methods
- // **************
-
- /**
- * Either creates the Management MBean wrapper for a container and start
- * it or it destroy it.
- **/
- private void handleContainerManagement( Container container,
- boolean doStart )
- {
- try {
- // Create and register the ContainerMBean
- ObjectName name = new ObjectName( "Management", "jnidName",
container.getBeanMetaData().getJndiName() );
- if( doStart ) {
- getServer().createMBean(
- "org.jboss.management.ContainerManagement",
- name,
- new Object[] { container },
- new String[] { "org.jboss.ejb.Container" }
- );
- getServer().invoke( name, "init", new Object[] {}, new String[] {} );
- getServer().invoke( name, "start", new Object[] {}, new String[] {} );
- }
- else {
- // If not startup then assume that the MBean is there
- getServer().invoke( name, "stop", new Object[] {}, new String[] {} );
- getServer().invoke( name, "destroy", new Object[] {}, new String[] {} );
- // Unregister the MBean to avoid future name conflicts
- getServer().unregisterMBean( name );
- }
- }
- catch( Exception e )
- {
+ // **************
+ // Helper Methods
+ // **************
+
+ /**
+ * Either creates the Management MBean wrapper for a container and start
+ * it or it destroy it.
+ **/
+ private void handleContainerManagement( Container container, boolean doStart ) {
+ try {
+ // Create and register the ContainerMBean
+ ObjectName name = new ObjectName( "Management", "jndiName",
container.getBeanMetaData().getJndiName() );
+ if( doStart ) {
+ getServer().createMBean(
+ "org.jboss.management.ContainerManagement",
+ name,
+ new Object[] { container },
+ new String[] { "org.jboss.ejb.Container" }
+ );
+ getServer().invoke( name, "init", new Object[] {}, new String[] {} );
+ getServer().invoke( name, "start", new Object[] {}, new String[] {} );
+ }
+ else {
+ // If not startup then assume that the MBean is there
+ getServer().invoke( name, "stop", new Object[] {}, new String[] {} );
+ getServer().invoke( name, "destroy", new Object[] {}, new String[] {} );
+ // Unregister the MBean to avoid future name conflicts
+ getServer().unregisterMBean( name );
+ }
+ }
+ catch( Exception e )
+ {
if( e instanceof RuntimeMBeanException )
{
RuntimeMBeanException rme = (RuntimeMBeanException) e;
1.46 +33 -3 jboss/src/main/org/jboss/ejb/EntityContainer.java
Index: EntityContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityContainer.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- EntityContainer.java 2001/07/13 04:08:18 1.45
+++ EntityContainer.java 2001/07/20 20:07:15 1.46
@@ -29,8 +29,11 @@
import javax.ejb.RemoveException;
import org.jboss.logging.Logger;
+import org.jboss.monitor.StatisticsProvider;
import org.jboss.util.SerializableEnumeration;
+import management.CountStatistic;
+
/**
* This is a Container for EntityBeans (both BMP and CMP).
*
@@ -42,7 +45,8 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a>
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.45 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>
+ * @version $Revision: 1.46 $
*
* <p><b>Revisions:</b>
*
@@ -50,10 +54,14 @@
* <ul>
* <li>Transaction to context wiring was moved to the instance interceptor
* </ul>
+ * <p><b>20010718 andreas schaefer:</b>
+ * <ul>
+ * <li>- Added statistics gathering
+ * </ul>
*/
public class EntityContainer
- extends Container
- implements ContainerInvokerContainer, InstancePoolContainer
+ extends Container
+ implements ContainerInvokerContainer, InstancePoolContainer, StatisticsProvider
{
// Constants -----------------------------------------------------
@@ -102,6 +110,10 @@
*/
protected Interceptor interceptor;
+ // These members contains statistics variable
+ protected long createCount = 0;
+ protected long removeCount = 0;
+
// Public --------------------------------------------------------
public void setContainerInvoker(ContainerInvoker ci)
@@ -393,6 +405,7 @@
// gone through the InstanceInterceptor so the instance is locked and we only
have one thread
// the case of reentrant threads is unclear (would you want to delete an
instance in reentrancy)
mi.getEnterpriseContext().setId(null);
+ removeCount++;
}
/**
@@ -462,6 +475,7 @@
(EntityEnterpriseContext)
mi.getEnterpriseContext());
// The context implicitely carries the EJBObject
+ createCount++;
return
((EntityEnterpriseContext)mi.getEnterpriseContext()).getEJBLocalObject();
}
@@ -564,6 +578,7 @@
(EntityEnterpriseContext)
mi.getEnterpriseContext());
// The context implicitely carries the EJBObject
+ createCount++;
return ((EntityEnterpriseContext)mi.getEnterpriseContext()).getEJBObject();
}
@@ -603,6 +618,21 @@
// TODO
throw new Error("Not yet implemented");
}
+
+ // StatisticsProvider implementation ------------------------------------
+ public Map retrieveStatistic()
+ {
+ // Loop through all Interceptors and add statistics
+ Map lStatistics = new HashMap();
+ StatisticsProvider lProvider = (StatisticsProvider) getPersistenceManager();
+ lStatistics.putAll( lProvider.retrieveStatistic() );
+ lProvider = (StatisticsProvider) getInstancePool();
+ lStatistics.putAll( lProvider.retrieveStatistic() );
+ return lStatistics;
+ }
+ public void resetStatistic()
+ {
+ }
// Private -------------------------------------------------------
1.9 +7 -4 jboss/src/main/org/jboss/ejb/EntityPersistenceManager.java
Index: EntityPersistenceManager.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityPersistenceManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- EntityPersistenceManager.java 2001/07/13 03:18:51 1.8
+++ EntityPersistenceManager.java 2001/07/20 20:07:15 1.9
@@ -12,9 +12,12 @@
import javax.ejb.RemoveException;
+// import org.jboss.util.FinderResults;
+
+import org.jboss.monitor.StatisticsProvider;
+
/**
- * This interface is implemented by any EntityBean persistence managers
- * plugins.
+ * This interface is implemented by any EntityBean persistence managers plugins.
*
* <p>Implementations of this interface are called by other plugins in the
* container. If the persistence manager wants to, it may attach any
@@ -24,10 +27,10 @@
* @see EntityContainer
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
*/
public interface EntityPersistenceManager
- extends ContainerPlugin
+ extends ContainerPlugin, StatisticsProvider
{
/**
* Returns a new instance of the bean class or a subclass of the bean class.
1.9 +10 -2 jboss/src/main/org/jboss/ejb/InstanceCache.java
Index: InstanceCache.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/InstanceCache.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- InstanceCache.java 2001/07/13 00:36:07 1.8
+++ InstanceCache.java 2001/07/20 20:07:15 1.9
@@ -9,15 +9,23 @@
import java.rmi.RemoteException;
import java.rmi.NoSuchObjectException;
+import org.jboss.monitor.StatisticsProvider;
+
/**
* The plugin that gives a container a cache for bean instances.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Simone Bordet</a>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
+ *
+ * <p><b>Revisions:</b>
+ * <p><b>20010718 andreas schaefer:</b>
+ * <ul>
+ * <li>- Marked the InstanceCache as Statistics Provider
+ * </ul>
*/
public interface InstanceCache
- extends ContainerPlugin
+ extends ContainerPlugin, StatisticsProvider
{
/**
* Gets a bean instance from this cache given the identity. This method
1.6 +10 -2 jboss/src/main/org/jboss/ejb/InstancePool.java
Index: InstancePool.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/InstancePool.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- InstancePool.java 2001/07/13 00:36:58 1.5
+++ InstancePool.java 2001/07/20 20:07:15 1.6
@@ -8,14 +8,22 @@
import java.rmi.RemoteException;
+import org.jboss.monitor.StatisticsProvider;
+
/**
* Defines the model for a EnterpriseContext instance pool.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
+ *
+ * <p><b>Revisions:</b>
+ * <p><b>20010718 andreas schaefer:</b>
+ * <ul>
+ * <li>- Marked the InstancePool as Statistics Provider
+ * </ul>
*/
public interface InstancePool
- extends ContainerPlugin
+ extends ContainerPlugin, StatisticsProvider
{
/**
* Get an instance without identity.
1.10 +13 -1 jboss/src/main/org/jboss/ejb/MessageDrivenContainer.java
Index: MessageDrivenContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/MessageDrivenContainer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- MessageDrivenContainer.java 2001/07/10 04:11:24 1.9
+++ MessageDrivenContainer.java 2001/07/20 20:07:15 1.10
@@ -34,7 +34,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class MessageDrivenContainer
extends Container
@@ -435,5 +435,17 @@
}
}
}
+ // 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.31 +13 -1 jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java
Index: StatefulSessionContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- StatefulSessionContainer.java 2001/07/13 04:06:24 1.30
+++ StatefulSessionContainer.java 2001/07/20 20:07:15 1.31
@@ -36,7 +36,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.30 $
+ * @version $Revision: 1.31 $
*
* <p><b>Revisions</b>
* <p><b>20010704</b>
@@ -710,6 +710,18 @@
throw (Error)ex;
}
}
+ }
+ // 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.23 +10 -8 jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java
Index: StatelessSessionContainer.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- StatelessSessionContainer.java 2001/07/13 04:06:12 1.22
+++ StatelessSessionContainer.java 2001/07/20 20:07:15 1.23
@@ -32,7 +32,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a>
- * @version $Revision: 1.22 $
+ * @version $Revision: 1.23 $
*/
public class StatelessSessionContainer
extends Container
@@ -53,27 +53,21 @@
* container methods.
*/
protected Map homeMapping;
-
/**
* These are the mappings between the remote interface methods and the
* bean methods.
*/
protected Map beanMapping;
-
/** This is the container invoker for this container */
protected ContainerInvoker containerInvoker;
-
/** This is the instancepool that is to be used */
protected InstancePool instancePool;
-
/**
* This is the first interceptor in the chain. The last interceptor must
* be provided by the container itself
*/
protected Interceptor interceptor;
-
// Static --------------------------------------------------------
-
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@@ -166,7 +160,7 @@
// Map the home methods
setupHomeMapping();
-
+
// Initialize pool
instancePool.init();
@@ -593,6 +587,14 @@
throw (Error)ex;
}
}
+ }
+ // StatisiticsProvider implementation ------------------------------------
+ public Map retrieveStatistic()
+ {
+ return null;
+ }
+ public void resetStatistic()
+ {
}
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development