avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen McConnell <mcconn...@apache.org>
Subject ThreadLocalLifestyleHandler.java
Date Thu, 15 Aug 2002 02:50:47 GMT


bloritsch@apache.org wrote:

>  /**
>   * Lifestyle implementation that provides suppport for the per thread
>   * policy.  Request for a single instance will allways return the
>   * same instance for each request.
>   *
>   * NOTE:  Need to register a listener for threaddeath so I can properly
>   *        dispose of the component when the associated thread dies.
>   *
>   * NOTE 2: This is untested.
>   *
>  
>

Berlin:

Looking good!

Here is a log of four instances of the "simple" component, each running 
in a seperate container (therefor each in a seperate thread) except for 
the "simple" and "simpleX" component which share the same container. 
 I'm printing out the identity hashcode of a single lifecycle extension 
that is extending all of these components.  The lifecycle extension has 
been declared with a "thread" lifestyle policy.  

As you can see - the instance is only being created in in a new thread.  

Cheers, Steve.


[INFO   ] (root.simple#23503403): create id: 7841785, 
Thread[Thread-2,5,main]
[INFO   ] (root.simple#23503403): access id: 7841785, 
Thread[Thread-2,5,main]
[INFO   ] (root.sub.demo.simple): create id: 813251, Thread[Thread-4,5,main]
[INFO   ] (root.sub.demo.simple): access id: 813251, Thread[Thread-4,5,main]
[INFO   ] (root.sub.demo.simpleX): create id: 813251, 
Thread[Thread-4,5,main]
[INFO   ] (root.sub.demo.simpleX): access id: 813251, 
Thread[Thread-4,5,main]
[INFO   ] (root.sub.demo.working.admin.simple2): create id: 31538514, 
Thread[Thread-9,5,main]
[INFO   ] (root.sub.demo.working.admin.simple2): access id: 31538514, 
Thread[Thread-9,5,main]
[INFO   ] (root.sub.demo.simple): release id: 813251, 
Thread[Thread-4,5,main]
[INFO   ] (root.sub.demo.simple): destroy id: 813251, 
Thread[Thread-4,5,main]
[INFO   ] (root.sub.demo.simpleX): release id: 813251, 
Thread[Thread-4,5,main]
[INFO   ] (root.sub.demo.simpleX): destroy id: 813251, 
Thread[Thread-4,5,main]
[INFO   ] (root.sub.demo.working.admin.simple2): destroy id: 31538514, 
Thread[Thread-9,5,main]
[INFO   ] (root.simple#23503403): release id: 7841785, 
Thread[Thread-2,5,main]
[INFO   ] (root.simple#23503403): destroy id: 7841785, 
Thread[Thread-2,5,main]


>

-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net




--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message