MySQL Forums
Forum List  »  NDB clusters

Re: ClusterJ multi thread java programming
Posted by: Craig Russell
Date: April 17, 2015 11:48AM

Hi Arco,

It sounds like you have the right idea. You need a separate Session for each thread, since Session is not multi-thread safe.

Something like this should work:

success = false;
while (success || ++retries < maxRetries) {
try {
session.currentTransaction().begin();
doStuff(session);
session.currentTransaction().commit();
success = true;
} catch (Exception ex) {
log(ex);
session.currentTransaction().rollback();
}
}

What kind of errors are being reported?

Regards,

Craig

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: ClusterJ multi thread java programming
1131
April 17, 2015 11:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.