You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2010/04/01 17:39:57 UTC

svn commit: r930011 - in /geronimo/server/branches/2.1/plugins/axis2: axis2/src/main/plan/plan.xml geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java

Author: gawor
Date: Thu Apr  1 15:39:57 2010
New Revision: 930011

URL: http://svn.apache.org/viewvc?rev=930011&view=rev
Log:
Useful gbean for clearing Axis2 ServiceDescription cache

Added:
    geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java   (with props)
Modified:
    geronimo/server/branches/2.1/plugins/axis2/axis2/src/main/plan/plan.xml

Modified: geronimo/server/branches/2.1/plugins/axis2/axis2/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/axis2/src/main/plan/plan.xml?rev=930011&r1=930010&r2=930011&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/axis2/src/main/plan/plan.xml (original)
+++ geronimo/server/branches/2.1/plugins/axis2/axis2/src/main/plan/plan.xml Thu Apr  1 15:39:57 2010
@@ -20,4 +20,10 @@
 
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
 
+    <!--
+    <gbean name="Axis2Cache" class="org.apache.geronimo.axis2.ClearCacheGBean">
+        <attribute name="period">600000</attribute>
+    </gbean>
+    -->
+
 </module>

Added: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java?rev=930011&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java (added)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java Thu Apr  1 15:39:57 2010
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.geronimo.axis2;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+
+import org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl;
+
+public class ClearCacheGBean implements GBeanLifecycle {
+
+    private static final Log LOG = LogFactory.getLog(ClearCacheGBean.class);
+
+    private Timer timer;
+    private long period;
+
+    public ClearCacheGBean(long period) {
+        this.period = period;
+    }
+    
+    public void doStart() throws Exception {
+        if (timer == null) {
+            timer = new Timer(true);
+        }
+        timer.schedule(new ClearCacheTask(), 0, this.period);
+    }
+    
+    public void doStop() throws Exception {  
+        if (timer != null) {
+            timer.cancel();
+            timer = null;
+        }
+    }
+
+    public void doFail() {
+    }
+
+    private static class ClearCacheTask extends TimerTask {
+        public void run() {
+            LOG.debug("Clearing Axis2 cache");
+            DescriptionFactoryImpl.clearServiceDescriptionCache();
+        }
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(ClearCacheGBean.class, NameFactory.GERONIMO_SERVICE);
+        infoBuilder.addAttribute("period", long.class, true, true);
+
+        infoBuilder.setConstructor(new String[]{
+                "period"
+        });
+        
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ClearCacheGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain