From: <ad...@jb...> - 2005-06-01 00:00:44
|
"bil...@jb..." wrote : Maybe you didn't read my above email. I'm suggesting that any synchronization done should be done in the TransactionLocalDelegate implementation. For our implementation, we can do it in org.jboss.tm.TransactionImpl. Yes, I read your previous response. 1) I don't disagree that the delegate needs to be internally threadsafe. This is not true at the moment: a) TransactionImpl has an unsynchronized HashMap to store the values. b) TransactionLocalDelegate.getSynchronization() could register two synchronizations 2) I disagree that TransactionLocal needs to do internal synchronization, it should just be marked as not threadsafe. e.g. this code could lead to deadlocks | public class Blah | { | static TransactionLocal local = new TransactionLocal() | { | protected Object initialValue() | { | return doSomeExternalCalculationThatSynchronizesOnWhoKnowsWhat(); | } | } | | public void doSomething() | { | Object value = local.get(); | } | } | The ".get()" could invoke the initialValue() with contradictory synchronizations to the way doSomething() is used, and you also have the "unknown" synchronization on the delegate that the user can't see. This is just a mess. 3) Leave it to the user to correctly synchronize (they know best!) View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3879684#3879684 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3879684 |