Comment #52 on issue 62 by sberlin: Lifecycle support
http://code.google.com/p/google-guice/issues/detail?id=62

Some thoughts, based on previous lifecycle stuff I've written to cooperate with Guice...

* both startAndWait & startAsync (similarly both stopAsync & stopAndWait) is unnecessary. xAndWait can be done by calling get() on the returned future of the async method. * I've found an 'initialize' state to be useful -- that is, a state between & State.RUNNING. (likely two states: State.INITIALIZING & State.INITIALIZED), with a method Future<State> initialize(). This lets a lot of services that are interdependent make sure that they each have a proper setup before starting. (The service manager would call initialize on everything before starting anything.) * While there should be a granularity on services per service (or key), there should also be a way for a single listener to be notified of all service state changes. * There should be an easy way to schedule periodic Runnables/Callables (similarly to ScheduledExecutorService), to ensure that they start when the service starts & stop when the service stops. Something easier than delegating to a SecheduledExecutorService, capturing the returned ScheduledFuture in start & stopping it in stop.. because that usually either goes wrong (forgetting null checking), or is ignored (no stopping). * There should be some concept of service order. Doesn't need to be exact, but I've found buckets (early, middle, late) to be very helpful.

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" 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-dev?hl=en.

Reply via email to