Hello,
I am using twig (built from trunk) and guice 3.0 (not sure my issue is linked with Guice though).
All my accesses to the datastore (via AnnotationObjectDatastore.load) fail with the exception raised in StandardFindCommand:
java.lang.IllegalStateException: Dectected use by more than one thread
at com.google.code.twig.standard.StandardCommand.<init>(StandardCommand.java:12)
at com.google.code.twig.standard.StandardFindCommand.<init>(StandardFindCommand.java:9)
at com.google.code.twig.standard.TranslatorObjectDatastore.find(TranslatorObjectDatastore.java:142)
at com.google.code.twig.standard.TranslatorObjectDatastore.find(TranslatorObjectDatastore.java:47)
...
I have configured my datastore in Guice as:
binder.bind(ObjectDatastore.class).to(AnnotationObjectDatastore.class);
(I tried to bind it both as Singleton and not, and the issue appears in both cases).
For info, using debug, the datastore.thread is a simple Thread object (id=1, so I assume it is the thread used when Guice initializes everything), while Thread.currentThread() is a QueuedThreadPool$PoolThread (id 38).
I have in fact two questions:
- Do you have an idea if I'm doing something wrong? Is the issue totally outside of twig?
- Why do we need to have the same thread?
Thanks for any help.
Cheers :-)
Seb