[infinispan-dev] deadlock detection - coin toss
David M. Lloyd
david.lloyd at redhat.com
Wed Jul 8 13:44:36 EDT 2009
On 07/08/2009 11:11 AM, Mircea Markus wrote:
> this is regarding: http://tinyurl.com/nunmyu
> In order to be able to determine which tx should commit and which will
> rollback, I need to generate a coin toss for each node - a random number.
> In order to do that I'm thinking to use on of the following:
>
> 1) use java.util.Random . The issue with this class is that it has an
> undocumented behavior when it comes to concurrent access, so I cannot
> rely on it behaving correctly if I don't enforce proper
> synchronization. I'm afraid this might become a bottleneck as all the
> prepapares requests might want to synchronize on it.
What about a ThreadLocal<Random>? Should be quick-ish
- DML
More information about the infinispan-dev
mailing list