[jboss-cvs] JBossAS SVN: r98925 - in trunk/server/src/main/java/org/jboss: invocation and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 23 21:18:46 EST 2009
Author: jason.greene at jboss.com
Date: 2009-12-23 21:18:45 -0500 (Wed, 23 Dec 2009)
New Revision: 98925
Modified:
trunk/server/src/main/java/org/jboss/ejb/Container.java
trunk/server/src/main/java/org/jboss/ejb/ContainerMBean.java
trunk/server/src/main/java/org/jboss/invocation/InvocationStatistics.java
Log:
Merge r90217 & r90277
Modified: trunk/server/src/main/java/org/jboss/ejb/Container.java
===================================================================
--- trunk/server/src/main/java/org/jboss/ejb/Container.java 2009-12-23 21:49:07 UTC (rev 98924)
+++ trunk/server/src/main/java/org/jboss/ejb/Container.java 2009-12-24 02:18:45 UTC (rev 98925)
@@ -189,7 +189,7 @@
/** SecurityManagement Instance - holder of all security managers */
protected ISecurityManagement securityManagement;
-
+
/** PolicyRegistration - Holds Authorization Policies */
protected PolicyRegistration policyRegistration;
@@ -241,8 +241,8 @@
/** The JACC context id for the container */
protected String jaccContextID;
- /**
- * Flag to denote whether a JACC configuration has been fitted for authorization
+ /**
+ * Flag to denote whether a JACC configuration has been fitted for authorization
*/
protected boolean isJaccEnabled = false;
@@ -289,7 +289,7 @@
/**
* Whether the bean is call by value
- *
+ *
* @return true for call by value
*/
public boolean isCallByValue()
@@ -339,7 +339,7 @@
public void setSecurityManagement(ISecurityManagement securityManagement)
{
this.securityManagement = securityManagement;
- }
+ }
public PolicyRegistration getPolicyRegistration()
{
@@ -413,7 +413,7 @@
// There's no factory thread local which means this is probably
// a local invocation. Just use the first (usually only)
// proxy factory.
- // TODO: define a default factory in the meta data or
+ // TODO: define a default factory in the meta data or
// even better, let the return over the original transport
// plugin the transport layer for the generated proxy
if (factory == null && remoteInterface != null)
@@ -476,9 +476,9 @@
this.timerService = timerService;
}
- /**
- * Get the flag whether JACC is enabled
- * @return
+ /**
+ * Get the flag whether JACC is enabled
+ * @return
*/
public boolean isJaccEnabled()
{
@@ -486,9 +486,9 @@
}
/**
- * Set the flag that JACC is enabled
- *
- * @param isJaccEnabled
+ * Set the flag that JACC is enabled
+ *
+ * @param isJaccEnabled
*/
public void setJaccEnabled(boolean isJaccEnabled)
{
@@ -506,6 +506,14 @@
}
/**
+ * Gets the deployment unit name that contains this container.
+ */
+ public String getDeploymentName()
+ {
+ return ejbModule.name;
+ }
+
+ /**
* Gets the number of create invocations that have been made
* @jmx.managed-attribute
*/
@@ -531,7 +539,62 @@
return invokeStats;
}
+
/**
+ * Converts the method invocation stats into a detyped nested map structure.
+ * The format is:
+ *
+ * {methodName => {statisticTypeName => longValue}}
+ *
+ * @return A map indexed by method name with map values indexed by statistic type
+ */
+ public Map<String, Map<String, Long>> getDetypedInvocationStatistics()
+ {
+ return invokeStats.toDetypedMap();
+ }
+
+ /**
+ * Return the current instance pool associate with this container if
+ * supported by the underlying container implementation.
+ *
+ * @return instance pool
+ * @throws UnsupportedOperationException if the container does not support an instance pool
+ */
+ protected InstancePool getInstancePool()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Get current pool size of the pool associated with this container,
+ * also known as the method ready count
+ *
+ * @throws UnsupportedOperationException if the container type does not support an instance pool
+ */
+ public int getCurrentPoolSize()
+ {
+ return getInstancePool().getCurrentSize();
+ }
+
+ /**
+ * Get current pool size of the pool associated with this container.
+ *
+ * @throws UnsupportedOperationException if the container type does not support an instance pool
+ */
+ public int getMaxPoolSize()
+ {
+ return getInstancePool().getMaxSize();
+ }
+
+ /**
+ * Resets the current invocation stats
+ */
+ public void resetInvocationStats()
+ {
+ invokeStats.resetStats();
+ }
+
+ /**
* Sets the class loader for this container. All the classes and resources
* used by the bean in this container will use this classloader.
*
@@ -643,7 +706,7 @@
}
else if (m.equals(EJB_TIMEOUT))
{
- // No role is required to access the ejbTimeout as this is
+ // No role is required to access the ejbTimeout as this is
permissions = new HashSet<Principal>();
permissions.add(AnybodyPrincipal.ANYBODY_PRINCIPAL);
methodPermissionsCache.put(m, permissions);
@@ -658,7 +721,7 @@
{
for (String role : roles)
permissions.add(new SimplePrincipal(role));
- }
+ }
methodPermissionsCache.put(m, permissions);
}
@@ -945,7 +1008,7 @@
public abstract void addInterceptor(Interceptor in);
/** The detached invoker operation.
- *
+ *
* @jmx.managed-operation
*
* @param mi - the method invocation context
@@ -1431,11 +1494,11 @@
if (securityDomain == null)
securityDomain = metaData.getApplicationMetaData().getSecurityDomain();
if (securityDomain != null)
- {
+ {
//JBAS-6060: Tolerate a Security Domain configuration without the java:/jaas prefix
if(securityDomain.startsWith(SecurityConstants.JAAS_CONTEXT_ROOT) == false)
securityDomain = SecurityConstants.JAAS_CONTEXT_ROOT + "/" + securityDomain;
-
+
log.debug("Binding securityDomain: " + securityDomain + " to JDNI ENC as: security/security-domain");
Util.bind(envCtx, "security/security-domain", new LinkRef(securityDomain));
Modified: trunk/server/src/main/java/org/jboss/ejb/ContainerMBean.java
===================================================================
--- trunk/server/src/main/java/org/jboss/ejb/ContainerMBean.java 2009-12-23 21:49:07 UTC (rev 98924)
+++ trunk/server/src/main/java/org/jboss/ejb/ContainerMBean.java 2009-12-24 02:18:45 UTC (rev 98925)
@@ -27,16 +27,18 @@
import org.jboss.invocation.Invocation;
+import java.util.Map;
+
/**
* MBean interface.
*/
public interface ContainerMBean extends org.jboss.system.ServiceMBean
{
- /**
- * @return Gets the application deployment unit for this container. All the bean containers within the same application unit share the same instance.
- */
- EjbModule getEjbModule();
+ /**
+ * Gets the deployment name of the deployment unit that contains this container.
+ */
+ String getDeploymentName();
/**
* Gets the type of bean (Session, Entity, etc)
@@ -46,10 +48,45 @@
String getBeanTypeName();
/**
+ * @return Gets the application deployment unit for this container. All the bean containers within the same application unit share the same instance.
+ */
+ EjbModule getEjbModule();
+
+ /**
* @return Gets the number of create invocations that have been made
*/
long getCreateCount();
+ /**
+ * Converts the method invocation stats into a detyped nested map structure.
+ * The format is:
+ *
+ * {methodName => {statisticTypeName => longValue}}
+ *
+ * @return A map indexed by method name with map values indexed by statistic type
+ */
+ Map<String, Map<String, Long>> getDetypedInvocationStatistics();
+
+ /**
+ * Get current pool size of the pool associated with this container,
+ * also known as the method ready count
+ *
+ * @throws UnsupportedOperationException if the container type does not support an instance pool
+ */
+ int getCurrentPoolSize();
+
+ /**
+ * Gets the max pool size of the pool associated with this container
+ *
+ * @throws UnsupportedOperationException if the container type does not support an instance pool
+ */
+ int getMaxPoolSize();
+
+ /**
+ * Resets the current invocation stats
+ */
+ void resetInvocationStats();
+
/**
* @return Gets the number of remove invocations that have been made
*/
Modified: trunk/server/src/main/java/org/jboss/invocation/InvocationStatistics.java
===================================================================
--- trunk/server/src/main/java/org/jboss/invocation/InvocationStatistics.java 2009-12-23 21:49:07 UTC (rev 98924)
+++ trunk/server/src/main/java/org/jboss/invocation/InvocationStatistics.java 2009-12-24 02:18:45 UTC (rev 98925)
@@ -41,7 +41,7 @@
private static final long serialVersionUID = -8031193044335393420L;
/** A HashMap<Method, TimeStatistic> of the method invocations */
- private Map methodStats;
+ private Map<Method, TimeStatistic> methodStats;
public long concurrentCalls = 0;
public long maxConcurrentCalls = 0;
@@ -52,7 +52,7 @@
{
/** @since 4.2.0 */
private static final long serialVersionUID = -8689933338506854386L;
-
+
public volatile long count;
public volatile long minTime = Long.MAX_VALUE;
public volatile long maxTime;
@@ -80,7 +80,7 @@
*/
public void updateStats(Method m, long elapsed)
{
- TimeStatistic stat = (TimeStatistic) methodStats.get(m);
+ TimeStatistic stat = methodStats.get(m);
if (stat == null)
{
stat = new TimeStatistic();
@@ -147,11 +147,10 @@
tmp.append(concurrentCalls);
tmp.append("' >\n");
- HashMap copy = new HashMap(methodStats);
- Iterator iter = copy.entrySet().iterator();
+ Iterator<Map.Entry<Method, TimeStatistic>> iter = methodStats.entrySet().iterator();
while (iter.hasNext())
{
- Map.Entry entry = (Map.Entry) iter.next();
+ Map.Entry<Method, TimeStatistic> entry = iter.next();
TimeStatistic stat = (TimeStatistic) entry.getValue();
if (stat != null)
{
@@ -171,4 +170,39 @@
tmp.append("</InvocationStatistics>");
return tmp.toString();
}
+
+ /**
+ * Converts the method invocation stats into a detyped nested map structure.
+ * The format is:
+ *
+ * {methodName => {statisticTypeName => longValue}}
+ *
+ * In addition some other global statistics are added under the fake
+ * method name #Global
+ *
+ * @return A map indexed by method name with map values indexed by statistic type
+ */
+ public Map<String, Map<String, Long>> toDetypedMap()
+ {
+
+ Map<String, Map<String, Long>> detyped = new HashMap<String, Map<String, Long>>();
+ for (Map.Entry<Method, TimeStatistic> entry : methodStats.entrySet())
+ {
+ TimeStatistic stats = entry.getValue();
+ Map<String, Long> detypedStats = new HashMap<String, Long>(methodStats.size());
+ detypedStats.put("count", stats.count);
+ detypedStats.put("minTime", stats.minTime);
+ detypedStats.put("maxTime", stats.maxTime);
+ detypedStats.put("totalTime", stats.totalTime);
+ detyped.put(entry.getKey().getName(), detypedStats);
+ }
+
+ Map<String, Long> global = new HashMap<String, Long>();
+ global.put("concurrentCalls", concurrentCalls);
+ global.put("maxConcurrentCalls", maxConcurrentCalls);
+ global.put("lastResetTime", lastResetTime);
+ detyped.put("#Global", global);
+
+ return detyped;
+ }
}
More information about the jboss-cvs-commits
mailing list