Author: giacomo
Date: Sat Nov 6 15:12:39 2004
New Revision: 56786
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java
cocoon/trunk/src/java/org/apache/cocoon/components/thread/RunnableManager.java
Log:
added removal of Runnables
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java
==============================================================================
---
cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java
(original)
+++
cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java
Sat Nov 6 15:12:39 2004
@@ -392,6 +392,33 @@
}
/**
+ * Remove a <code>Runnable</code> from the command stack
+ *
+ * @param command The <code>Runnable</code> to be removed
+ */
+ public void remove( Runnable command )
+ {
+ synchronized( m_commandStack )
+ {
+ for( final Iterator i = m_commandStack.iterator( ); i.hasNext(
); )
+ {
+ final ExecutionInfo info = (ExecutionInfo)i.next( );
+
+ if( info.m_command == command )
+ {
+ i.remove( );
+ m_commandStack.notifyAll( );
+
+ return;
+ }
+ }
+ }
+
+ getLogger( ).warn( "Could not find command " + command +
+ " for removal" );
+ }
+
+ /**
* The heart of the command manager
*/
public void run( )
@@ -806,7 +833,6 @@
if( m_nextRun > 0 )
{
m_commandStack.add( this );
- m_commandStack.notifyAll( );
}
}
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/thread/RunnableManager.java
==============================================================================
---
cocoon/trunk/src/java/org/apache/cocoon/components/thread/RunnableManager.java
(original)
+++
cocoon/trunk/src/java/org/apache/cocoon/components/thread/RunnableManager.java
Sat Nov 6 15:12:39 2004
@@ -152,4 +152,11 @@
Runnable command,
long delay,
long interval );
+
+ /**
+ * Remove a [EMAIL PROTECTED] Runnable} from the execution stack
+ *
+ * @param command The command to be removed
+ */
+ void remove( Runnable command );
}