Class ExecutionContextThreadedImpl

java.lang.Object
org.datanucleus.ExecutionContextImpl
org.datanucleus.ExecutionContextThreadedImpl
All Implemented Interfaces:
ExecutionContextReference, ExecutionContext, TransactionEventListener

public class ExecutionContextThreadedImpl extends ExecutionContextImpl
ExecutionContext to attempt to handle multi-threaded PM/EM cases. Intercepts various methods in an attempt to prevent conflicting thread updates by locking the current thread. Note we could have just put this code in ExecutionContextImpl but better to split it out since the majority use-case is to have a non-thread-safe PM/EM. Note also that having thread-safe ExecutionContext usage depends on much more than having this class, since SCO wrappers would need to coordinate with such locks, as would the Transaction for the ExecutionContext. TODO Evaluate all of the places we currently lock (when multithreaded) to find corner cases not caught. TODO We currently try to lock the ExecutionContext and not individual objects. To lock individual objects we would need a Lock object on the DNStateManager

This class *tries to be* thread-safe, but there is no guarantee. You are better advised to design your application to use PM/EM for a single thread.