Comment #17 on issue 598 by [email protected]: Persist Extension: PersistService.start() cannot be called multiple times
https://code.google.com/p/google-guice/issues/detail?id=598

I solved the problem by creating my own class extended
JpaPersistService with the overloaded method:
@Override
public synchronized void start() {
    try {
        super.start();
    } catch (IllegalStateException e) {
        ; // no worries if it's already running.
    }
}

I then added bindings for my class to the injector:

bind(PersistService.class).to(MyJpaPersistService.class);
bind(JpaPersistService.class).to(MyJpaPersistService.class);
bind(MyJpaPersistService.class).in(Singleton.class);

It sounds like Xavier did the equivalent using Guice's AOP features:
https://github.com/google/guice/wiki/AOP

Our application encounters the problem in a similar way as #15
describes: We attach to the database with one configuration to do
things like database migrations, and then reconfigure for normal use
with more limited permissions.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to