bloritsch 2003/01/23 13:26:51
Modified: event/src/java/org/apache/excalibur/event/command
AbstractThreadManager.java
Log:
provide better control of mutexes in the ThreadManager
Revision Changes Path
1.13 +23 -9
jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/AbstractThreadManager.java
Index: AbstractThreadManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/AbstractThreadManager.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AbstractThreadManager.java 4 Dec 2002 02:52:37 -0000 1.12
+++ AbstractThreadManager.java 23 Jan 2003 21:26:51 -0000 1.13
@@ -249,7 +249,16 @@
while( it.hasNext() )
{
- ( ( ThreadControl ) it.next() ).join( 1000 );
+ ThreadControl tc = (ThreadControl) it.next();
+
+ try
+ {
+ tc.join( 1000 );
+ }
+ catch (Exception e)
+ {
+ tc.interrupt();
+ }
}
m_pipelines.clear();
@@ -362,18 +371,23 @@
m_mutex.acquire();
- Iterator it = m_controls.iterator();
-
- while( it.hasNext() )
+ try
{
- ThreadControl control = ( ThreadControl ) it.next();
- if( control.isFinished() )
+ Iterator it = m_controls.iterator();
+
+ while( it.hasNext() )
{
- it.remove();
+ ThreadControl control = ( ThreadControl ) it.next();
+ if( control.isFinished() )
+ {
+ it.remove();
+ }
}
}
-
- m_mutex.release();
+ finally
+ {
+ m_mutex.release();
+ }
}
}
catch( InterruptedException e )
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>