You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gi...@apache.org on 2005/12/27 17:28:31 UTC
svn commit: r359235 -
/cocoon/trunk/src/java/org/apache/cocoon/core/container/handler/SingleThreadedComponentHandlerMBean.java
Author: giacomo
Date: Tue Dec 27 08:28:28 2005
New Revision: 359235
URL: http://svn.apache.org/viewcvs?rev=359235&view=rev
Log:
added MBean
Added:
cocoon/trunk/src/java/org/apache/cocoon/core/container/handler/SingleThreadedComponentHandlerMBean.java
Added: cocoon/trunk/src/java/org/apache/cocoon/core/container/handler/SingleThreadedComponentHandlerMBean.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/handler/SingleThreadedComponentHandlerMBean.java?rev=359235&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/handler/SingleThreadedComponentHandlerMBean.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/handler/SingleThreadedComponentHandlerMBean.java Tue Dec 27 08:28:28 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2002-2005 The Apache Software Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.core.container.handler;
+
+
+import org.apache.cocoon.components.ComponentInfo;
+import org.mortbay.util.jmx.ModelMBeanImpl;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+
+/**
+ * The ThreadSafeComponentHandlerMBean adds JMX managability for ThreadSafeComponentHandler.
+ *
+ * @version $Id: ThreadSafeComponentHandler.java 312637 2005-10-10 13:00:42Z cziegeler $
+ * @since 2.2
+ */
+public class SingleThreadedComponentHandlerMBean
+extends ModelMBeanImpl {
+
+ private final SingleThreadedComponentHandler handler;
+ private final ComponentInfo info;
+
+ protected void defineManagedResource() {
+ super.defineManagedResource();
+ defineAttribute("maxCreated", false, true);
+ defineAttribute("maxDecommissioned", false, true);
+ defineAttribute("outstanding", false, true);
+ }
+ /**
+ * Construction of PoolableComponentHandlerMBean
+ *
+ * @param handler The managed PoolableComponentHandler instance
+ */
+ public SingleThreadedComponentHandlerMBean(final SingleThreadedComponentHandler handler, final ComponentInfo info)
+ throws MBeanException, InstanceNotFoundException {
+ super( handler );
+ this.handler = handler;
+ this.info = info;
+ }
+
+ public long getMaxCreated()
+ {
+ return handler.getMaxCreated();
+ }
+
+ public long getMaxDecommissioned()
+ {
+ return handler.getMaxDecommissioned();
+ }
+
+ public long getOutstanding()
+ {
+ return handler.getMaxCreated() - handler.getMaxDecommissioned();
+ }
+
+ public String getJmxName()
+ {
+ return "subsys=ECM++,handler=single-threaded" + (info.getRole() != null ? ",role=" + info.getRole() : "");
+ }
+}