Are you running this immediately after the commit of the transaction?

One recommendation is to put information into a message and put it on a
queue and return right away. Keep the emailing and other code out of your
main processing thread. Let a background process pick up the messages and
send the emails.

I know this doesn't answer your problem but it may be helpful to move this
work someplace else entirely. It could make it easier to debug the problem
for one, but at least your main system is not trying to do everything in one
shot from creating the transaction, posting it, and reporting on it as well.

On Wed, May 5, 2010 at 4:19 AM, Mark Derricutt <[email protected]> wrote:

> Hey all,
>
> I have a curly question for you all - I'm wanting to have some
> processing take place on the successful commit of a JTA transaction in
> our system, for example - only send customer emails out if the
> transactions modifying their account commit successfully, or only
> update LDAP when the database is committed.
>
> Now, my understanding of JTA at the underlying XAResource layer is
> rather limited, much like blind alley dumpster diving - I'm not sure
> where I'm heading, or if I really should be.  For the most part the
> code I've written seems to work a treat, but I've noticed several of
> my integration tests randomly failing, and all manner of strange
> errors come out of the JTA engine ( Atomikos Essentials in this case
> ).
>
> The code I'm using can be seen at:
>
>  https://gist.github.com/88bd6fa07c6da73c89dc
>
> The two classes and short snippet show the relevant code i'm using to
> enlist an instance of my resource to the transaction ( potentially
> multiple instances to a single transaction - which might actually be
> my problem ).
>
> I've also posted to the Atomikos forum (
> http://fogbugz.atomikos.com/default.asp?community.6.1489.3 ) about
> this but as yet havn't had any successful outcome.  The problem I see
> is expressed as the log warning:
>
> 04.05.2010 13:56:48.829 *WARN* [66156...@qtp-46719652-4] atomikos The
> given XAResource instance is being enlisted a second time without
> delist in between?
>
> As it stands I'm not entirely sure where I'm going wrong, I have
> suspicions the core of my problem is not understanding how JTA works
> internally, the workflow of XAResources - and Google as I might I've
> not found any resources that actually explain it.
>
> Has anyone here done anything similar before?  Any words of wisdom or
> pangs of regret you guys can share?
>
> Mark
>
>
>
>
>
>
> --
> Pull me down under...
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<javaposse%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>
>


-- 
Robert Casto
www.IWantFreeShipping.com
Find Amazon Filler Items easily!

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to