perfsonar-dev - r1681 - in trunk/perfsonar: ant src/org/perfsonar/commons src/org/perfsonar/commons/auxiliary src/org/perfsonar/commons/auxiliary/components/simplescheduler src/org/perfsonar/commons/container src/org/perfsonar/commons/container/listeners
Subject: perfsonar development work
List archive
r1681 - in trunk/perfsonar: ant src/org/perfsonar/commons src/org/perfsonar/commons/auxiliary src/org/perfsonar/commons/auxiliary/components/simplescheduler src/org/perfsonar/commons/container src/org/perfsonar/commons/container/listeners
Chronological Thread
- From:
- To:
- Subject: r1681 - in trunk/perfsonar: ant src/org/perfsonar/commons src/org/perfsonar/commons/auxiliary src/org/perfsonar/commons/auxiliary/components/simplescheduler src/org/perfsonar/commons/container src/org/perfsonar/commons/container/listeners
- Date: Fri, 13 Oct 2006 04:18:03 -0400
Author: uros
Date: 2006-10-13 04:18:03 -0400 (Fri, 13 Oct 2006)
New Revision: 1681
Added:
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/AuxiliaryThreadedComponent.java
trunk/perfsonar/src/org/perfsonar/commons/container/
trunk/perfsonar/src/org/perfsonar/commons/container/listeners/
trunk/perfsonar/src/org/perfsonar/commons/container/listeners/StartupInitializer.java
Modified:
trunk/perfsonar/ant/libs-download-targets.xml
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/AuxiliaryComponentManager.java
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/components/simplescheduler/Scheduler.java
Log:
Added Servlet Context Listener used for (un)initialization of perfSONAR
services (currently used to initialize LS Registrator Scheduler and
it's shutdown, when context is destroyed).
Cleanup fixed Tomcat hang bug, when some form of scheduler is already running.
Each component runing in a separate thread in an infinite loop should be
implementing AuxiliaryThreadedComponent instead of AuxiliaryComponent,
which is then automatically recognized by uninitializer class and stopped.
For (un)initialization you should add the following lines to the
AXIS's WEB-INF/web.xml file, right after the last <listener> tag:
<listener>
<listener-class>
org.perfsonar.commons.container.listeners.StartupInitializer
</listener-class>
</listener>
and of course restart Tomcat. There is work in progress for automating this.
Modified: trunk/perfsonar/ant/libs-download-targets.xml
===================================================================
--- trunk/perfsonar/ant/libs-download-targets.xml 2006-10-13 08:12:24
UTC (rev 1680)
+++ trunk/perfsonar/ant/libs-download-targets.xml 2006-10-13 08:18:03
UTC (rev 1681)
@@ -57,6 +57,8 @@
<dependency groupId="javax.activation"
artifactId="activation" version="1.0.2"/>
<dependency groupId="javax.mail" artifactId="mail"
version="1.3.2"/>
+ <dependency groupId="tomcat"
artifactId="servlet-api" version="5.0.28"/>
+
<dependency groupId="log4j" artifactId="log4j"
version="1.2.9"/>
<localRepository refid="local.repository"/>
Modified:
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/AuxiliaryComponentManager.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/AuxiliaryComponentManager.java
2006-10-13 08:12:24 UTC (rev 1680)
+++
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/AuxiliaryComponentManager.java
2006-10-13 08:18:03 UTC (rev 1681)
@@ -5,6 +5,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import java.util.Iterator;
import org.perfsonar.service.commons.exceptions.SystemException;
@@ -17,6 +18,7 @@
* static, persistent part of Axis servlet
*
* @author Maciej Glowiak
+ * @author Uros Juvan (added componentsIterator)
*
*/
public class AuxiliaryComponentManager {
@@ -195,6 +197,17 @@
}
+ /**
+ * Return key,value pair iterator over components Map.
+ * @return iterator over pair Map.Entry<String, AuxiliaryComponent>
+ */
+ public Iterator<Map.Entry<String, AuxiliaryComponent>>
componentsIterator() {
+
+ return components == null ? null : components.entrySet().iterator();
+
+ }
+
+
// --------------------------------------------------------- static
methods
Added:
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/AuxiliaryThreadedComponent.java
Property changes on:
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/AuxiliaryThreadedComponent.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified:
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/components/simplescheduler/Scheduler.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/components/simplescheduler/Scheduler.java
2006-10-13 08:12:24 UTC (rev 1680)
+++
trunk/perfsonar/src/org/perfsonar/commons/auxiliary/components/simplescheduler/Scheduler.java
2006-10-13 08:18:03 UTC (rev 1681)
@@ -8,7 +8,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.perfsonar.commons.auxiliary.AuxiliaryComponent;
+import org.perfsonar.commons.auxiliary.AuxiliaryThreadedComponent;
import org.perfsonar.commons.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.commons.auxiliary.ComponentNames;
import
org.perfsonar.commons.auxiliary.components.configuration.ConfigurationComponent;
@@ -20,9 +20,12 @@
* This class provides the capability to run an action each N seconds
*
* @author Maciej Glowiak
+ * @author Uros Juvan (changed interface being implemented from
+ * AuxiliaryComponent to AuxiliaryThreadedComponent,
+ * added stopThread method)
*
*/
-public class Scheduler extends Thread implements AuxiliaryComponent {
+public class Scheduler extends Thread implements AuxiliaryThreadedComponent {
// ----------------------------Member Variables
@@ -203,6 +206,15 @@
this.paused = paused;
}
+
+ /**
+ * Stop the thread by calling stopScheduler
+ */
+ public void stopThread() {
+
+ stopScheduler();
+
+ }
} //Scheduler
\ No newline at end of file
Added:
trunk/perfsonar/src/org/perfsonar/commons/container/listeners/StartupInitializer.java
Property changes on:
trunk/perfsonar/src/org/perfsonar/commons/container/listeners/StartupInitializer.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
- r1681 - in trunk/perfsonar: ant src/org/perfsonar/commons src/org/perfsonar/commons/auxiliary src/org/perfsonar/commons/auxiliary/components/simplescheduler src/org/perfsonar/commons/container src/org/perfsonar/commons/container/listeners, svnlog, 10/13/2006
Archive powered by MHonArc 2.6.16.