[jbosscache-dev] Re: DummyTransaction and DumyTransactionManager

Jonathan Halliday jonathan.halliday at redhat.com
Thu Aug 23 09:00:31 EDT 2007


Nope, not if the failure occurs in phase two. In that case 
you get heuristics, which the TS knows about internally but 
for which JTA has no Status. Hence we use STATUS_UNKNOWN.

Jonathan.


Manik Surtani wrote:
> How, then, does a STATUS_UNKNOWN come about?
> 
> Any failure before afterCompletion() sequences commence (i.e., in 
> beforeCompletion()) should result in a rollback, right?
> 
> On 23 Aug 2007, at 11:09, Jonathan Halliday wrote:
> 
>>
>> No, the status is determined before any of the afterCompletions run 
>> and does not change. An afterCompletions success/failure does not 
>> change the transaction outcome. They are in effect receiving 
>> notification of an earlier event and the notifications are 
>> independent, may happen in arbitrary order or even in parallel. Well, 
>> aside from the use of TransactionSynchronizationRegistry, but that's 
>> another story.
>>
>> Jonathan.
>>
>> Manik Surtani wrote:
>>> Ok, then the DummyTM's current behaviour of swallowing exceptions in 
>>> afterCompletion() is correct?
>>> What about the status that gets passed into subsequent Syncs after an 
>>> exception is encountered?  I'd expect something like (pseudocode):
>>> int status = getStatusFromBeforeCompletion();
>>> for (Synchronization s : syncs)
>>> {
>>>     try
>>>     {
>>>         s.afterCompletion(status);
>>>     }
>>>     catch (Exception e)
>>>     {
>>>         log(e);
>>>         status = STATUS_UNKNOWN; // so subsequent Syncs get this status
>>>     }
>>> }
>>
>> -- 
>> ------------------------------------------------------------
>> Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod 
>> Street, Windsor, Berkshire, SI4 1TE, United Kingdom.
>> Registered in UK and Wales under Company Registration No. 3798903  
>> Directors: Michael Cunningham (USA), Charlie Peters (USA) and David 
>> Owens (Ireland)
> 
> -- 
> Manik Surtani
> 
> Lead, JBoss Cache
> JBoss, a division of Red Hat
> 
> 
> 


-- 
------------------------------------------------------------
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 
Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 
3798903  Directors: Michael Cunningham (USA), Charlie Peters 
(USA) and David Owens (Ireland)



More information about the jbosscache-dev mailing list