Issue Details (XML | Word | Printable)

Key: NUCCORE-606
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Improve multithreaded handling, e.g subclass ObjectManagerImpl

Created: 28/Nov/10 12:52 PM   Updated: 03/Oct/11 07:37 AM   Resolved: 02/Aug/11 07:33 PM
Component/s: Code Structure, Persistence
Affects Version/s: None
Fix Version/s: 3.0.1


 Description  « Hide
If the PMF has the persistence property "Multithreaded" set, we should create an instance of a ThreadedObjectManagerImpl (extends ObjectManagerImpl). This subclass will simply override the client (PM/EM) facing method and add "synchronized(readWriteLock)". Means we can more easily separate the locking code from the work code

In addition we need to list all entry points to ObjectManager so we can assess what needs locking and when. We currently have
1. ObjectManager readWriteLock
2. ObjectManager some methods synchronized
3. StateManager some methods synchronized

ObjectManager has access methods like commit(), rollback(), findObject(), persistObject() etc and StateManager has access methods like setXXXField()

Andy Jefferson made changes - 30/Nov/10 11:01 AM
Field Original Value New Value
Summary Support multithreaded PM/EM by subclassing ObjectManagerImpl for multithreaded case Improve multithreaded handling, e.g subclass ObjectManagerImpl
Description If the PMF has the persistence property "Multithreaded" set, we should create an instance of a ThreadedObjectManagerImpl (extends ObjectManagerImpl). This subclass will simply override the client (PM/EM) facing method and add "synchronized(readWriteLock)". Means we can more easily separate the locking code from the work code If the PMF has the persistence property "Multithreaded" set, we should create an instance of a ThreadedObjectManagerImpl (extends ObjectManagerImpl). This subclass will simply override the client (PM/EM) facing method and add "synchronized(readWriteLock)". Means we can more easily separate the locking code from the work code

In addition we need to list all entry points to ObjectManager so we can assess what needs locking and when. We currently have
1. ObjectManager readWriteLock
2. ObjectManager some methods synchronized
3. StateManager some methods synchronized

ObjectManager has access methods like commit(), rollback(), findObject(), persistObject() etc and StateManager has access methods like setXXXField()
Andy Jefferson made changes - 02/Aug/11 07:32 PM
Priority Minor [ 4 ] Major [ 3 ]
Andy Jefferson added a comment - 02/Aug/11 07:33 PM
SVN trunk removes all "synchronized" and adds use of Lock.lock()/Lock.unlock() to ObjectManager and StateManager, and only when "multithreaded" is enabled. Means that the majority of usage will not see any locking

Andy Jefferson made changes - 02/Aug/11 07:33 PM
Status Open [ 1 ] Resolved [ 5 ]
Assignee Andy Jefferson [ andy ]
Fix Version/s 3.0.1 [ 11300 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 03/Oct/11 07:37 AM
Status Resolved [ 5 ] Closed [ 6 ]