Injector shutdown

1,460 views
Skip to first unread message

Blair Zajac

unread,
Feb 13, 2008, 1:30:35 AM2/13/08
to google...@googlegroups.com
I'm looking at using Guice for my application and want the ability to shutdown
all threads, remove JDBC drivers registered with java.sql.DriverManager, and
clean up any other resources so I can properly redeploy the application in a
servlet container.

Grepping through the sources, I don't see any way of shutting down the injector
and specifying methods to run when an object should be destroyed, such as using
Spring's destroy-method on a bean.

JDK6 does have a javax.annotation.PreDestroy annotation that could be
potentially used for this.

Are there any plans for this in Guice?

Thanks,
Blair

--
Blair Zajac, Ph.D.
CTO, OrcaWare Technologies
<bl...@orcaware.com>
Subversion training, consulting and support
http://www.orcaware.com/svn/

Stuart McCulloch

unread,
Feb 13, 2008, 1:45:02 AM2/13/08
to google...@googlegroups.com
On 13/02/2008, Blair Zajac <bl...@orcaware.com> wrote:

I'm looking at using Guice for my application and want the ability to shutdown
all threads, remove JDBC drivers registered with java.sql.DriverManager, and
clean up any other resources so I can properly redeploy the application in a
servlet container.

Grepping through the sources, I don't see any way of shutting down the injector
and specifying methods to run when an object should be destroyed, such as using
Spring's destroy-method on a bean.

JDK6 does have a javax.annotation.PreDestroy annotation that could be
potentially used for this.

Are there any plans for this in Guice?

supporting a basic life-cycle has been raised:

  http://code.google.com/p/google-guice/issues/detail?id=62

but I'm not sure if it will be in the next release

Blair Zajac

unread,
Feb 13, 2008, 1:15:49 PM2/13/08
to google...@googlegroups.com
Stuart McCulloch wrote:
> On 13/02/2008, *Blair Zajac* <bl...@orcaware.com
> <mailto:bl...@orcaware.com>> wrote:
>
>
> I'm looking at using Guice for my application and want the ability
> to shutdown
> all threads, remove JDBC drivers registered with
> java.sql.DriverManager, and
> clean up any other resources so I can properly redeploy the
> application in a
> servlet container.
>
> Grepping through the sources, I don't see any way of shutting down
> the injector
> and specifying methods to run when an object should be destroyed,
> such as using
> Spring's destroy-method on a bean.
>
> JDK6 does have a javax.annotation.PreDestroy annotation that could be
> potentially used for this.
>
> Are there any plans for this in Guice?
>
>
> supporting a basic life-cycle has been raised:
>
> http://code.google.com/p/google-guice/issues/detail?id=62
>
> but I'm not sure if it will be in the next release

Stuart,

Thanks for pointing that issue out, I added a comment to it.

Regards,
Blair

Reply all
Reply to author
Forward
0 new messages