donaldp 02/05/01 02:15:50
Modified: lib excalibur-thread-1.0.jar
excalibur-threadcontext-1.0.jar
src/java/org/apache/avalon/phoenix/components/application
DefaultApplication.java
Log:
Upgrade phoenix to latest threading code to get rid of exceptions in
ThreadPool due to ThreadContext changes.
Revision Changes Path
1.2 +173 -181 jakarta-avalon-phoenix/lib/excalibur-thread-1.0.jar
<<Binary file>>
1.3 +35 -34
jakarta-avalon-phoenix/lib/excalibur-threadcontext-1.0.jar
<<Binary file>>
1.14 +22 -18
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/DefaultApplication.java
Index: DefaultApplication.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/DefaultApplication.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DefaultApplication.java 30 Apr 2002 15:54:54 -0000 1.13
+++ DefaultApplication.java 1 May 2002 09:15:50 -0000 1.14
@@ -10,10 +10,9 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.excalibur.threadcontext.ThreadContext;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.phoenix.ApplicationEvent;
import org.apache.avalon.phoenix.Block;
import org.apache.avalon.phoenix.interfaces.Application;
@@ -23,6 +22,7 @@
import org.apache.avalon.phoenix.metadata.BlockListenerMetaData;
import org.apache.avalon.phoenix.metadata.BlockMetaData;
import org.apache.avalon.phoenix.metadata.SarMetaData;
+import org.apache.excalibur.threadcontext.ThreadContext;
/**
* This is the basic container of blocks. A server application
@@ -76,7 +76,7 @@
public void start()
throws IllegalStateException, ApplicationException
{
- if ( isRunning() )
+ if( isRunning() )
{
throw new IllegalStateException();
}
@@ -85,7 +85,7 @@
try
{
final BlockMetaData[] blocks =
m_context.getMetaData().getBlocks();
- for ( int i = 0; i < blocks.length; i++ )
+ for( int i = 0; i < blocks.length; i++ )
{
final String blockName = blocks[ i ].getName();
final BlockEntry blockEntry = new BlockEntry( blocks[ i
] );
@@ -98,7 +98,7 @@
// load blocks
runPhase( PHASE_STARTUP );
}
- catch ( final Throwable t )
+ catch( final Throwable t )
{
getLogger().info( "exception while starting:" +
t.getMessage() + "\n" );
t.printStackTrace();
@@ -141,7 +141,7 @@
public void stop()
throws IllegalStateException, ApplicationException
{
- if ( !isRunning() )
+ if( !isRunning() )
{
throw new IllegalStateException();
}
@@ -151,7 +151,7 @@
{
runPhase( PHASE_SHUTDOWN );
}
- catch ( final Throwable t )
+ catch( final Throwable t )
{
getLogger().info( "exception while stopping:" +
t.getMessage() + "\n" );
t.printStackTrace();
@@ -185,7 +185,7 @@
public Block getBlock( final String name )
{
final BlockEntry entry = (BlockEntry)m_entrys.get( name );
- if ( null == entry ) return null;
+ if( null == entry ) return null;
return entry.getProxy();
}
@@ -269,13 +269,13 @@
throws Exception
{
final BlockListenerMetaData[] listeners =
m_context.getMetaData().getListeners();
- for ( int i = 0; i < listeners.length; i++ )
+ for( int i = 0; i < listeners.length; i++ )
{
try
{
m_lifecycle.startupListener( listeners[ i ] );
}
- catch ( final Exception e )
+ catch( final Exception e )
{
final String name = listeners[ i ].getName();
final String message =
@@ -328,7 +328,7 @@
//Log message describing the number of blocks
//the phase in and the order in which they will be
//processed
- if ( getLogger().isInfoEnabled() )
+ if( getLogger().isInfoEnabled() )
{
final Integer count = new Integer( blocks.length );
final List pathList = Arrays.asList( order );
@@ -338,7 +338,7 @@
}
//All blocks about to be processed ...
- if ( PHASE_STARTUP == name )
+ if( PHASE_STARTUP == name )
{
//... for startup, so indicate to applicable listeners
final ApplicationEvent event =
@@ -353,12 +353,12 @@
//Process blocks, one by one.
- for ( int i = 0; i < order.length; i++ )
+ for( int i = 0; i < order.length; i++ )
{
final String block = order[ i ];
//Log message saying we are processing block
- if ( getLogger().isDebugEnabled() )
+ if( getLogger().isDebugEnabled() )
{
final String message = REZ.getString( "process-block",
block, name );
getLogger().debug( message );
@@ -367,12 +367,16 @@
try
{
final BlockEntry entry = (BlockEntry)m_entrys.get( block );
- if ( PHASE_STARTUP == name )
+ if( PHASE_STARTUP == name )
+ {
m_lifecycle.startup( entry );
+ }
else
+ {
m_lifecycle.shutdown( entry );
+ }
}
- catch ( final Exception e )
+ catch( final Exception e )
{
final String message =
REZ.getString( "app.error.run-phase", name, block,
e.getMessage() );
@@ -382,7 +386,7 @@
}
//Log message saying we have processed block
- if ( getLogger().isDebugEnabled() )
+ if( getLogger().isDebugEnabled() )
{
final String message = REZ.getString( "processed-block",
block, name );
getLogger().debug( message );
@@ -390,7 +394,7 @@
}
//All blocks processed ...
- if ( PHASE_STARTUP == name )
+ if( PHASE_STARTUP == name )
{
//... for startup, so indicate to applicable listeners
m_lifecycle.applicationStarted();
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>