How could I manage Lifecycle control ?

185 views
Skip to first unread message

Michael

unread,
Dec 10, 2012, 12:11:34 AM12/10/12
to google...@googlegroups.com
Hi all,

Does anyone know the process about the issue 'lifecycle support' http://code.google.com/p/google-guice/issues/detail?id=62&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Component

Currently I am facing the problem about this part. I implemented the init method by using provider and call init() within the get() of the provider.

But how about the destroy method, How could I do this in Guice ? Especially for servlet request scope.

Many thanks!

Randgalt

unread,
Dec 10, 2012, 1:23:07 PM12/10/12
to google...@googlegroups.com
There are several projects that add Lifecycle support to Guice. GuiceyFruit is one (I don't know if it's still being maintained). We (Netflix) recently opened a project that adds Lifecycle support (and other stuff): https://github.com/Netflix/governator

-JZ

Michael

unread,
Dec 11, 2012, 12:48:43 AM12/11/12
to google...@googlegroups.com
Thanks, I will take a look at Netflix.

在 2012年12月11日星期二UTC+8上午2时23分07秒,Randgalt写道:

Stuart McCulloch

unread,
Dec 11, 2012, 6:39:12 AM12/11/12
to google...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/cYvi10Z0G9wJ.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.

Christian Gruber

unread,
Dec 11, 2012, 6:44:22 PM12/11/12
to google...@googlegroups.com
So… sisu forked to get lifecycle… I wanted to chat about what was
missing from Guice that would have allowed lifecycle as a pure extension
for Sonatype's needs.

Christian.

Stuart McCulloch

unread,
Dec 11, 2012, 7:09:34 PM12/11/12
to google...@googlegroups.com
On 11 Dec 2012, at 23:44, Christian Gruber wrote:

> So… sisu forked to get lifecycle…

Er... I don't quite get the connection here, lifegycle was developed by Simone Tripodi (http://www.99soft.org/) - it uses the public Guice SPI and is completely separate to Sisu.

Sisu itself also only uses the public Guice SPI to add various behaviours / automatic wiring such as dynamic collections (think Map/List/etc. without having to explicitly define multibindings).

If you're talking about Sisu-Guice then this is our minor branch of Guice that has various patches that we've found useful in production, but which have not yet been merged into Guice for various reasons. You can see the individual patches in https://github.com/sonatype/sisu-guice/tree/master/PATCHES along with their upstream issue numbers. Note that you can use Sisu with mainstream Guice if you want - you'd just need to build Guice from master, as Sisu uses the ProvisionListener API that was added after 3.0

> I wanted to chat about what was missing from Guice that would have allowed lifecycle as a pure extension for Sonatype's needs.

The only lifecycle code implemented in Sisu at the moment is the Plexus lifecycle support in Sisu-Plexus, which is a pure extension again built on top of the public Guice SPI.

So I'm not sure what the question is here...

Christian Gruber

unread,
Dec 11, 2012, 7:15:00 PM12/11/12
to google...@googlegroups.com
On 11 Dec 2012, at 19:09, Stuart McCulloch wrote:

The relevance was that I wanted to make sure any lifecycle providers
(including sisu) had whatever APIs they needed to do things effectively.

> On 11 Dec 2012, at 23:44, Christian Gruber wrote:
>
> If you're talking about Sisu-Guice then this is our minor branch of
> Guice that has various patches that we've found useful in production,
> but which have not yet been merged into Guice for various reasons. You
> can see the individual patches in
> https://github.com/sonatype/sisu-guice/tree/master/PATCHES along with
> their upstream issue numbers. Note that you can use Sisu with
> mainstream Guice if you want - you'd just need to build Guice from
> master, as Sisu uses the ProvisionListener API that was added after
> 3.0

Ah. I see - fair enough. This was largely then a case of Guice not
releasing fast enough. Cool. I had misunderstood the extent.

>
>> I wanted to chat about what was missing from Guice that would have
>> allowed lifecycle as a pure extension for Sonatype's needs.
>
> The only lifecycle code implemented in Sisu at the moment is the
> Plexus lifecycle support in Sisu-Plexus, which is a pure extension
> again built on top of the public Guice SPI.

Yeah - I was under the impression that sisu-plexus needed more
generalized api support in sisu-guice… but if that's just the
ProvisionListener, then that's fine.

Never mind then. We can get on with releasing 3.1. Thanks for the
patch pointers above.

Christian.

Michael

unread,
Dec 12, 2012, 3:59:32 AM12/12/12
to google...@googlegroups.com
Thanks!

This is exactly what I was looking for. And it uses the public Guice SPI which is a good thing.

在 2012年12月11日星期二UTC+8下午7时39分12秒,Stuart McCulloch写道:

Cédric Beust ♔

unread,
Dec 12, 2012, 2:31:47 PM12/12/12
to google...@googlegroups.com, Simone Tripodi
The Onami maintainers might want to rephrase this section:

Inline image 1

:-)

(+cc Simone)


-- 
Cédric




To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/UFfFdSUMXZEJ.
Screen Shot 2012-12-12 at 11.30.06 AM.png

Tim Peierls

unread,
Dec 12, 2012, 2:35:47 PM12/12/12
to google...@googlegroups.com
At least they aren't guilty of the sin of Onami! :-)
Screen Shot 2012-12-12 at 11.30.06 AM.png

Moandji Ezana

unread,
Dec 12, 2012, 2:49:03 PM12/12/12
to google...@googlegroups.com, Simone Tripodi
I fixed that in a pull request 7 months ago, which was merged 2 months ago, so I'm a bit surprised it's still there. Looking at it again, the PR was issued on the master branch, so I guess the Maven website was never regenerated and pushed to the gh-pages branch?

Moandji
Screen Shot 2012-12-12 at 11.30.06 AM.png

Simone Tripodi

unread,
Dec 12, 2012, 6:39:51 PM12/12/12
to google...@googlegroups.com
Screen Shot 2012-12-12 at 11.30.06 AM.png

Simone Tripodi

unread,
Dec 12, 2012, 6:46:44 PM12/12/12
to google...@googlegroups.com
Screen Shot 2012-12-12 at 11.30.06 AM.png
Reply all
Reply to author
Forward
0 new messages