xiaodududu / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

JpaPersistService start() does not follow conditions specified in PersistService #605

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The javadoc comment for start() in PersistService indicates that if start() is 
called when the service is already started, the method call does nothing. 
However, in the case of JpaPersistFilter, a second call to start produces the 
following trace

java.lang.IllegalStateException: Persistence service was already initialized.
    at com.google.inject.internal.util.$Preconditions.checkState(Preconditions.java:142)
    at com.google.inject.persist.jpa.JpaPersistService.start(JpaPersistService.java:88):

This case matters to me because I in general want to use the PersistFilter 
(which calls start) but also want to do some initialization work in my 
GuiceServletContextListener subclass which requires database access, and thus I 
call start there as well. This results in an error when loading the 
PersistFilter.

The same issue also appears to exist for stop().

Original issue reported on code.google.com by michael....@gmail.com on 17 Feb 2011 at 8:09

GoogleCodeExporter commented 9 years ago
Sorry - just realized that this is a duplicate of issue 598. Apologies.

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

Original comment by michael....@gmail.com on 17 Feb 2011 at 8:12

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 18 Feb 2011 at 2:48