List Info

Thread: Re: Re: DummyTransaction and DumyTransactionManager




Re: Re: DummyTransaction and DumyTransactionManager
user name
2007-08-23 04:59:50
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
	}
}


On 23 Aug 2007, at 09:43, Jonathan Halliday wrote:

> Manik Surtani wrote:
>> WRT JBCACHE-1167 I'm writing a test to create this
situation where  
>> JBC's Sync is called with a STATUS_UKNOWN and I
notice that the  
>> OrderedSynchronizationHandler and DummyTransaction
in JBoss Cache  
>> swallow any exceptions in afterCompletion(), simply
logging the  
>> outcome.
>> See http://fisheye.jboss.org/browse/JBossCache/core/tags/ 
>>
JBossCache_1_4_1_SP4/src/org/jboss/cache/transaction/ 
>> DummyTransaction.java?r=1566 Lines 269 - 274.
>> Makes unit testing pretty tough if the TM swallows
the failure  
>> here.  ;)
>> Jonathan, how does JBossTS behave (or how should
any TM behave) at  
>> this stage?  I'm assuming keep the exception, set
status to  
>> STATUS_UNKNOWN for the remaining syncs, and then
throw the exception?
>
> If an afterCompletion throws an Exception the TS
continues  
> regardless, since all Synchronizations should be
invoked. What the  
> client sees is determined by the transaction outcome,
not the  
> behaviour of the afterCompletion syncs. The client will
get an  
> exception only if the beforeCompletion or XARresources
misbehave,  
> not it the afterCompletions do.
>
> Jonathan.
> _______________________________________________
> jbosscache-dev mailing list
> jbosscache-devlists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosscache-dev

--
Manik Surtani

Lead, JBoss Cache
JBoss, a division of Red Hat



_______________________________________________
jbosscache-dev mailing list
jbosscache-devlists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosscache-dev

Re: Re: DummyTransaction and DumyTransactionManager
user name
2007-08-23 05:09:14
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)
_______________________________________________
jbosscache-dev mailing list
jbosscache-devlists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosscache-dev

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )