openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Persist issue in multithreaded environment
Date Tue, 04 Aug 2009 14:25:02 GMT
Hi Claudio,
You mention in an earlier post that when you turn on SQL Trace that you see
all of the Inserts getting created.  So, does that mean that if you turn
Trace on that it seems to affect the processing and everything works as
expected?  Or, do you see SQL in the Trace that is supposedly generated and
executed, but it doesn't result in rows in tables?

Have you turned on all of the TRACE to see if there are any errant
exceptions not being surfaced?  (If turning Trace on affects the ability to
reproduce the problem, then this may not be a valid request.)

In your thread local method, you check if the EM is Open.  If it's Closed,
then you create a new one.  If it's Open, then you just continue to use it.
Can you further explain your lifecycle processing for the EM?  That is, who
is responsible for Closing the EM when it's done?  And, under what
conditions?  What transaction demarcation are you using?  Local
EntityTransactions or some external transaction manager?  I'm just wondering
if there's some hiccup between the opening/closing of the EM and the
transaction demarcation processing.

BTW, I agree with Craig's earlier comment that there should be no reason to
use the Multihhreaded property if you are only using a single EM per
thread.  And, if you set this openjpa.Multithreaded to "true", then the
problem does not surface?  If that's the case, then it seems that you are
accidentally using an EM by more than one thread.  I just don't see how
yet...

Kevin

On Tue, Aug 4, 2009 at 2:49 AM, Claudio Di Vita <c.divita@gmail.com> wrote:

>
>
> Craig L Russell wrote:
> >
> > The usual symptom for a multithreading problem is an exception thrown
> > inside an implementation method that can't be explained by application
> > code.
> >
> > What are your symptoms?
> >
> I persist a set of entities in n different threads at the same time. Each
> thread uses a different EntityManager.
>
> At the end of computation sometimes I have n rows in my table, sometimes I
> have n - 1, or n - 2 rows. No exception is thrown and the persist method is
> always invoked n times.
>
> Any ideas ??
>
> -----
> Not everything that can be counted counts, and not everything that counts
> can
> be counted - Albert Einstein
> --
> View this message in context:
> http://n2.nabble.com/Persist-issue-in-multithreaded-environment-tp3377510p3383069.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message