mcconnell 2003/09/08 11:23:04
Modified: merlin/activation/src/java/org/apache/avalon/activation/appliance/impl
DefaultServiceManager.java
Log:
Don;t throw an exception of the released object isn't mapped. The non-mapping could
be a result of the component releasing the service multiple times. Instead of
throwing an exception just log a warning.
Revision Changes Path
1.6 +13 -4
avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultServiceManager.java
Index: DefaultServiceManager.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultServiceManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultServiceManager.java 8 Sep 2003 13:37:42 -0000 1.5
+++ DefaultServiceManager.java 8 Sep 2003 18:23:04 -0000 1.6
@@ -147,6 +147,9 @@
Object object = provider.resolve( this );
String id = "" + System.identityHashCode( object );
m_table.put( id, key );
+ final String message =
+ "resolved service [" + id + "] for the key [" + key + "].";
+ getLogger().debug( message );
return object;
}
catch( Throwable e )
@@ -177,11 +180,14 @@
final String key = (String) m_table.get( id );
if( key == null )
{
- final String error =
- "Illegal attempt to release an object ["
+ final String warning =
+ "Unrecognied object identity ["
+ id
- + "] that was not established by this service manager.";
- throw new IllegalArgumentException( error );
+ + "]. "
+ + "Either this object was not provided by this service manager "
+ + "or it has already been released.";
+ getLogger().warn( warning );
+ return;
}
final Home provider = (Home) m_map.get( key );
@@ -197,6 +203,9 @@
try
{
provider.release( this, object );
+ final String message =
+ "released service [" + id + "] from the key [" + key + "].";
+ getLogger().debug( message );
}
catch( Throwable e )
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]