You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/10/19 12:45:53 UTC
cvs commit: avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl DefaultAppliance.java
mcconnell 2003/10/19 03:45:53
Modified: merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl
DefaultAppliance.java
Log:
Improve handling of collection process by notifying proxy of instance destruction.
Revision Changes Path
1.7 +15 -4 avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java
Index: DefaultAppliance.java
===================================================================
RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultAppliance.java 19 Oct 2003 10:31:00 -0000 1.6
+++ DefaultAppliance.java 19 Oct 2003 10:45:53 -0000 1.7
@@ -625,7 +625,7 @@
private void destroyInstance( Object instance )
{
final int id = System.identityHashCode( instance );
- getLogger().debug( "component disposal: " + id );
+ getLogger().debug( "destroy: " + id );
try
{
applyStop( instance );
@@ -1171,7 +1171,7 @@
implements InvocationHandler
{
private final Object m_instance;
- private boolean m_disposed = false;
+ private boolean m_destroyed = false;
/**
* Create a proxy invocation handler.
@@ -1200,7 +1200,7 @@
{
if( proxy == null ) throw new NullPointerException( "proxy" );
if( method == null ) throw new NullPointerException( "method" );
- if( m_disposed ) throw new IllegalStateException( "disposed" );
+ if( m_destroyed ) throw new IllegalStateException( "destroyed" );
try
{
@@ -1225,7 +1225,7 @@
protected void finalize() throws Throwable
{
- if( !m_disposed )
+ if( !m_destroyed )
{
final String message =
"Releasing component ["
@@ -1244,6 +1244,11 @@
{
return m_instance;
}
+
+ void notifyDestroyed()
+ {
+ m_destroyed = true;
+ }
}
private class StandardFactory implements Factory
@@ -1319,6 +1324,12 @@
public void destroy( Object instance )
{
if( instance == null ) throw new NullPointerException( "instance" );
+ if( Proxy.isProxyClass( instance.getClass() ) )
+ {
+ ApplianceInvocationHandler handler =
+ (ApplianceInvocationHandler) Proxy.getInvocationHandler( instance );
+ handler.notifyDestroyed();
+ }
destroyInstance( getProviderInstance( instance ) );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org