cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject svn commit: r359307 - in /cocoon/trunk/src/java/org/apache/cocoon/components/flow: ContinuationsManagerImplMBean.java mbean.properties
Date Tue, 27 Dec 2005 22:48:58 GMT
Author: giacomo
Date: Tue Dec 27 14:48:54 2005
New Revision: 359307

URL: http://svn.apache.org/viewcvs?rev=359307&view=rev
Log:
new MBean (initial)

Added:
    cocoon/trunk/src/java/org/apache/cocoon/components/flow/ContinuationsManagerImplMBean.java
    cocoon/trunk/src/java/org/apache/cocoon/components/flow/mbean.properties

Added: cocoon/trunk/src/java/org/apache/cocoon/components/flow/ContinuationsManagerImplMBean.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/flow/ContinuationsManagerImplMBean.java?rev=359307&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/flow/ContinuationsManagerImplMBean.java
(added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/flow/ContinuationsManagerImplMBean.java
Tue Dec 27 14:48:54 2005
@@ -0,0 +1,97 @@
+/* 
+ * 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.components.flow;
+
+
+import org.mortbay.util.jmx.ModelMBeanImpl;
+
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+
+/**
+ * The ContinuationsManagerImplMBean adds JMX managability for ContinuationsManagerImpl.
+ *
+ * @version $Id: ThreadSafeComponentHandler.java 312637 2005-10-10 13:00:42Z cziegeler $
+ * @since 2.2
+ */
+public class ContinuationsManagerImplMBean
+extends ModelMBeanImpl {
+    
+    private final ContinuationsManagerImpl manager;
+    
+    protected void defineManagedResource() {
+        super.defineManagedResource();
+        defineAttribute("defaultTimeToLive", false, true);
+        defineAttribute("bindContinuationsToSession", false, true);
+        defineAttribute("expirationCheckInterval", false, true);
+        defineAttribute("expirationSet", false, true);
+    }
+    /**
+     * Construction of PoolableComponentHandlerMBean
+     *
+     * @param handler The managed PoolableComponentHandler instance
+     */
+    public ContinuationsManagerImplMBean(final ContinuationsManagerImpl manager)
+        throws MBeanException, InstanceNotFoundException {
+        super( manager );
+        this.manager = manager;
+    }
+    
+    public int getDefaultTimeToLive() {
+        return manager.defaultTimeToLive;
+    }
+    
+    public void setDefaultTimeToLive(final int ttl) {
+        manager.defaultTimeToLive = ttl;
+    }
+    
+    public boolean getBindContinuationsToSession() {
+        return manager.bindContinuationsToSession;
+    }
+    
+    public long getExpirationCheckInterval() {
+        return manager.expirationCheckInterval;
+    }
+    
+    public String[] getExpirationSet() {
+        final String [] lines = new String[ manager.expirations.size()];
+        int idx = 0;
+        for(final Iterator i = manager.expirations.iterator(); i.hasNext(); ) {
+            final StringBuffer wkSet = new StringBuffer();
+            final WebContinuation wk = (WebContinuation) i.next();
+            final long lat = wk.getLastAccessTime() + wk.getTimeToLive();
+            wkSet.append("WK: ")
+                    .append(wk.getId())
+                    .append(" ExpireTime [");
+
+            if (lat < System.currentTimeMillis()) {
+                wkSet.append("Expired");
+            } else {
+                final Date date = new Date();
+                date.setTime(lat);
+                wkSet.append(date);
+            }
+            wkSet.append("]");
+            lines[idx++] = wkSet.toString();
+        }
+        return lines;
+    }
+    
+}

Added: cocoon/trunk/src/java/org/apache/cocoon/components/flow/mbean.properties
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/flow/mbean.properties?rev=359307&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/flow/mbean.properties (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/flow/mbean.properties Tue Dec 27 14:48:54
2005
@@ -0,0 +1,7 @@
+ContinuationsManagerImpl = Manages the Continuations
+
+ContinuationsManagerImpl.defaultTimeToLive = How many milliseconds a continuation can live
by default
+ContinuationsManagerImpl.bindContinuationsToSession = Whether Continuations will be bind
to the Http Session
+ContinuationsManagerImpl.expirationCheckInterval = The expiration check interval in milliseconds
+ContinuationsManagerImpl.expirationCheckInterval = The expiration check interval in milliseconds
+ContinuationsManagerImpl.expirationSet = The set of expirations of Continuations
\ No newline at end of file



Mime
View raw message