Bob Lee wrote:
> That's a possibility, but right now, FinalizableReferenceQueue isn't 
> exposed in the published API at all. I'd rather not do so, especially 
> considering you can just put Guice in your system classpath during 
> development and work around the problem.

        This problem occurs more frequently during development time, but is 
actually more critical during production time. Ironically the original 
bug report against Glassfish was by people complaining that it was 
unacceptable to have to restart the web server every time you wanted to 
redeploy your webapp. Apparently it happens often enough to warrant 
attention. Also, please consider the implications of running Guice at 
the system ClassLoader level: all webapps would have to share the same 
Guice instance/version. It would make it difficult to upgrade one webapp 
independently of the others. This goes pretty strongly against webapp 
"best practices".

        That being said, I think we can have our cake and eat it too. Please 
take a look at http://forums.sun.com/thread.jspa?messageID=10484065 and 
http://java.sun.com/javase/6/docs/api/java/lang/ref/package-summary.html#reachability

        The more I read about this, the more I become convinced that ejp is 
right. In theory all we'd need to do is have the servlet listener ask 
Guice to stop the thread and the remaining References would get 
garbage-collected automatically. Yes, this would require you to expose 
an extra API function but I think it is quite reasonable when 
considering the benefit. I wouldn't expose FinalizableReferenceQueue 
either (that's too low-level). Going by the Guice 1.0 API I would 
suggest adding Guice.close() that mirrors the way 
EntityManagerFactory.close() works. Alternatively you could use 
Injector.close() -- I believe others have asked for this anyway to 
satisfy other use-cases. Non-servlet users wouldn't have to change anything.

        In short: you'd expose a single API call consisting of 2-3 lines of 
code (shutting down the thread). In exchange, you'd retain the original 
clean implementation of FinalizableReferenceQueue. I know you're not a 
fan of exposing a new method but *please* consider the cost/benefit for 
us poor web users :)

Thanks,
Gili

--~--~---------~--~----~------------~-------~--~----~
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