donaldp 02/01/11 18:29:57
Modified: src/java/org/apache/avalon/phoenix/components/application
LifecycleHelper.java
Log:
Make sure block is removed from amangement system at end of lifecycle.
Revision Changes Path
1.26 +32 -0
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/LifecycleHelper.java
Index: LifecycleHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/LifecycleHelper.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- LifecycleHelper.java 12 Jan 2002 02:12:44 -0000 1.25
+++ LifecycleHelper.java 12 Jan 2002 02:29:57 -0000 1.26
@@ -266,6 +266,9 @@
final Block block = entry.getBlock();
+ //Remove block from Management system
+ unexportBlock( metaData, block );
+
//Invalidate entry. This will invalidate
//and null out Proxy object aswell as nulling out
//block property
@@ -335,6 +338,35 @@
REZ.getString( "export.error", name, service.getName(),
reason );
getLogger().error( message );
throw new CascadingException( message, e );
+ }
+ }
+ }
+
+ /**
+ * Unxport the services of block, declared to be management
+ * services, into management system.
+ */
+ private void unexportBlock( final BlockMetaData metaData,
+ final Block block )
+ {
+ final ServiceDescriptor[] services =
metaData.getBlockInfo().getManagement();
+ final String name = metaData.getName();
+ final ClassLoader classLoader = block.getClass().getClassLoader();
+
+ for( int i = 0; i < services.length; i++ )
+ {
+ final ServiceDescriptor service = services[ i ];
+ try
+ {
+ final Class clazz = classLoader.loadClass( service.getName()
);
+ m_context.unexportObject( name, clazz );
+ }
+ catch( final Exception e )
+ {
+ final String reason = e.toString();
+ final String message =
+ REZ.getString( "unexport.error", name,
service.getName(), reason );
+ getLogger().error( message );
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>