proyal 02/05/28 18:18:35
Modified: event/src/java/org/apache/excalibur/event/command
TPCThreadManager.java
Log:
Patch from Gregory Steuck <[EMAIL PROTECTED]> to move
RuntimeException handling inside the PipelineRunner.
Revision Changes Path
1.18 +22 -14
jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/TPCThreadManager.java
Index: TPCThreadManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/TPCThreadManager.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- TPCThreadManager.java 29 May 2002 01:09:14 -0000 1.17
+++ TPCThreadManager.java 29 May 2002 01:18:35 -0000 1.18
@@ -133,7 +133,9 @@
try
{
- m_pipelines.put( pipeline, new PipelineRunner( pipeline ) );
+ PipelineRunner runner = new PipelineRunner( pipeline );
+ runner.enableLogging( getLogger() );
+ m_pipelines.put( pipeline, runner );
if( m_done )
{
@@ -260,17 +262,6 @@
+ "increase block-timeout
or number of threads per processor", e );
}
}
- catch( RuntimeException e )
- {
- //We want to catch this, because if an
unexpected runtime exception comes through a single
- //pipeline it can bring down the primary thread
-
- if( getLogger().isErrorEnabled() )
- {
- getLogger().error( "Exception processing
EventPipeline [msg: " + e.getMessage() + "]",
- e );
- }
- }
}
}
finally
@@ -287,7 +278,9 @@
}
}
- public static final class PipelineRunner implements Runnable
+ public static final class PipelineRunner
+ extends AbstractLogEnabled
+ implements Runnable
{
private final EventPipeline m_pipeline;
@@ -303,7 +296,22 @@
for( int i = 0; i < sources.length; i++ )
{
- handler.handleEvents( sources[i].dequeueAll() );
+ try
+ {
+ handler.handleEvents( sources[i].dequeueAll() );
+ }
+ catch( RuntimeException e )
+ {
+ // We want to catch this, because this is the only
+ // place where exceptions happening in this thread
+ // can be logged
+
+ if( getLogger().isErrorEnabled() )
+ {
+ getLogger().error( "Exception processing
EventPipeline [msg: " + e.getMessage() + "]",
+ e );
+ }
+ }
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>