You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/09/30 11:38:49 UTC
cvs commit: jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/impl ActiveMonitor.java
donaldp 2002/09/30 02:38:49
Modified: monitor build.xml default.properties
monitor/src/java/org/apache/avalon/excalibur/monitor/impl
ActiveMonitor.java
Log:
Make the stopping logic for ActiveMonitor actually work.
(Also fixup some build issues resulting from changes in ECM).
Submitted By: Greg Steuck <gr...@nest.cx>
Revision Changes Path
1.24 +3 -0 jakarta-avalon-excalibur/monitor/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/monitor/build.xml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- build.xml 10 Aug 2002 21:14:35 -0000 1.23
+++ build.xml 30 Sep 2002 09:38:49 -0000 1.24
@@ -35,6 +35,8 @@
<pathelement location="${excalibur-component.jar}"/>
<pathelement location="${excalibur-collections.jar}"/>
<pathelement location="${excalibur-pool.jar}"/>
+ <pathelement location="${excalibur-instrument.jar}"/>
+ <pathelement location="${excalibur-container.jar}"/>
<path refid="project.class.path"/>
</path>
<property name="cp" refid="test.class.path"/>
@@ -58,6 +60,7 @@
<ant antfile="${depchecker.prefix}/depchecker.xml" target="checkTestcase"/>
<ant antfile="${depchecker.prefix}/depchecker.xml" target="checkComponent"/>
<ant antfile="${depchecker.prefix}/depchecker.xml" target="checkCollections"/>
+ <ant antfile="${depchecker.prefix}/depchecker.xml" target="checkInstrument"/>
<ant antfile="${depchecker.prefix}/depchecker.xml" target="checkPool"/>
</target>
1.12 +10 -0 jakarta-avalon-excalibur/monitor/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/monitor/default.properties,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- default.properties 7 Aug 2002 16:33:23 -0000 1.11
+++ default.properties 30 Sep 2002 09:38:49 -0000 1.12
@@ -59,6 +59,16 @@
excalibur-collections.lib=${excalibur-collections.home}
excalibur-collections.jar=${excalibur-collections.lib}/excalibur-collections-1.0.jar
+# ----- Excalibur container, version 1.0 or later -----
+excalibur-container.home=${basedir}/../container/dist
+excalibur-container.lib=${excalibur-container.home}
+excalibur-container.jar=${excalibur-container.lib}/excalibur-container-1.0.jar
+
+# ----- Excalibur collections, version 1.0 or later -----
+excalibur-instrument.home=${basedir}/../instrument/dist
+excalibur-instrument.lib=${excalibur-instrument.home}
+excalibur-instrument.jar=${excalibur-instrument.lib}/excalibur-instrument-0.3.jar
+
# --------------------------------------------------
1.4 +9 -20 jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/impl/ActiveMonitor.java
Index: ActiveMonitor.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/impl/ActiveMonitor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ActiveMonitor.java 8 Sep 2002 00:02:45 -0000 1.3
+++ ActiveMonitor.java 30 Sep 2002 09:38:49 -0000 1.4
@@ -42,7 +42,7 @@
/**
* Set to false to shutdown the thread.
*/
- private boolean m_keepRunning = true;
+ private volatile boolean m_keepRunning = true;
/**
* Set the frequency with which the monitor
@@ -80,35 +80,24 @@
throws Exception
{
m_keepRunning = false;
+ m_monitorThread.interrupt();
m_monitorThread.join();
}
public final void run()
{
- while( m_keepRunning )
+ try
{
- long currentTestTime = System.currentTimeMillis();
- final long sleepTillTime = currentTestTime + m_frequency;
-
- while( (currentTestTime = System.currentTimeMillis()) < sleepTillTime )
+ while( m_keepRunning )
{
- delay( sleepTillTime - currentTestTime );
+ Thread.sleep( m_frequency );
+ scanAllResources();
}
-
- scanAllResources();
- }
- }
-
- private void delay( final long delay )
- {
- try
- {
- Thread.sleep( delay );
}
catch( InterruptedException e )
{
- // ignore interrupted exception and keep sleeping until it's
- // time to wake up
+ // clears the interrupted status
+ Thread.interrupted();
}
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>