On Thu, Mar 15, 2012 at 3:53 AM, Igor Drobiazko
<igor.drobia...@gmail.com> wrote:
> On Wed, Mar 14, 2012 at 6:49 PM, Kalle Korhonen
> <kalle.o.korho...@gmail.com>wrote:
>> - what's the purpose of making a proxy for the EntityManager (rather
>> than just holding a reference to the EntityManager provided by the
>> EntityManagerManager)?
> EntityManager is a per-thread resource which is managed by
> EntityManagerManager.
> You need a proxy if you want the injected object to be recreated for each
> request.

Igor, thanks for the confirmation, that's what I thought but didn't
quite see how creating the proxy alone was enough to make the
mechanism work.

>> - does it not make sense to check if the proxy exists first and return
>> it right away before invoking the synchronized getOrCreateProxy?
> You want to move the null check from getOrCreateProxy to provide or do you
> want to double check?

Well, once the proxy is created it won't be nullified until the end of
the request, so it seemed unnecessary to me to synchronize any access
to entityManager for all requests. So yes, double check, first
unsynchronized.

>> My motivation for the questions is that I want to advise
>> EntityManager. Overriding EntityManagerObjectProvider seems like the
>> best place to do it.
> Feels like pain in the ass.

Thanks, that sounds like a constructive approach for fostering innovation.

Kalle

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org

Reply via email to