i wondered it too

just to clear a bit your mail there is no link with the reloadable feature,
when i added the "reload" i simply reused the existing code.

it was added by Thiago i think to be able to use TCCL instead of
OpenEJB/TomEE one (hibernate in the webapps):
http://mail-archives.apache.org/mod_mbox/openejb-commits/201109.mbox/%[email protected]%3E

No issue to do it synchronously for me (a big +1)

- Romain


2012/5/28 David Blevins <[email protected]>

> Just noticed this chunk of code in PersistenceBuilder:
>
>    public static EntityManagerFactory createEmf(ClassLoader classLoader,
> Callable<EntityManagerFactory> callable) throws ExecutionException,
> TimeoutException, InterruptedException {
>        final ExecutorService executor =
> Executors.newSingleThreadExecutor(new
> EntityManagerFactoryThreadFactory(classLoader));
>        final Future<EntityManagerFactory> future =
> executor.submit(callable);
>        return future.get(10, TimeUnit.MINUTES);
>    }
>
> Not sure what the benefit is of making a new executor and turning this
> into a two threaded operation.  The timeout is the only benefit I can see.
>  Note though that it won't stop the thread doing the work.  It's also not a
> daemon thread so its existence will prevent shutdown.
>
> We should probably make this a real executor with a daemon thread or just
> keep it simple and directly create the EntityManager in the caller's thread.
>
> Thoughts?
>
>
> -David
>
>

Reply via email to