2008/10/3 tzwoenn <[EMAIL PROTECTED]>:
> When I needed lifecycle support some months ago, I had implemented
> this using a custom scope, which optionally wrappes the 'real' scope.
>
> It looks like
>
> Scope LifeCycleScope.listenFor(Scope enclosingScope,
> LifeCycleListener... lifeCycleListeners);
>
> public interface LifeCycleListener {
>  void postConstruct(Object instance);
>  void preDestroy(Object instance);
> }
>
> with postConstruct gets called right after enclosingScope.scope(key,
> unscoped).get() and preDestroy when the object is not references any
> more and before GC runs.
>
> Based on this mechanism I have implemented an extension that uses
> javax.annotation lifecycle annotations. As far as I see this would
> fulfill your needs, would not it?

But that would prevent users from using any of the standard Guice
scopes right? So no SINGLETON/REQUEST/SESSION scopes? Or do you have a
cunning way of wrapping then under the covers?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to