mirror of https://github.com/apache/openjpa.git
OPENJPA-1904 Propagate refresh operation for eagerly fetched relationship fields.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.1.x@1044005 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0a087b2679
commit
8cf5f35488
|
@ -3011,7 +3011,7 @@ public class BrokerImpl
|
|||
}
|
||||
int level = _fc.getReadLockLevel();
|
||||
int timeout = _fc.getLockTimeout();
|
||||
_lm.lock(sm, level, timeout, null, false);
|
||||
_lm.refreshLock(sm, level, timeout, null);
|
||||
sm.readLocked(level, level);
|
||||
} else if (assertPersistenceCapable(obj).pcIsDetached()
|
||||
== Boolean.TRUE)
|
||||
|
@ -3083,7 +3083,7 @@ public class BrokerImpl
|
|||
}
|
||||
int level = _fc.getReadLockLevel();
|
||||
int timeout = _fc.getLockTimeout();
|
||||
_lm.lock(sm, level, timeout, null, false);
|
||||
_lm.refreshLock(sm, level, timeout, null);
|
||||
sm.readLocked(level, level);
|
||||
fireLifecycleEvent(sm.getManagedInstance(), null,
|
||||
sm.getMetaData(), LifecycleEvent.AFTER_REFRESH);
|
||||
|
|
|
@ -74,8 +74,8 @@ public interface LockManager
|
|||
* Perform the same function as previous lock method and has the option
|
||||
* to perform a version check after the lock function has completed.
|
||||
*/
|
||||
public void lock(OpenJPAStateManager sm, int level, int timeout,
|
||||
Object sdata, boolean postLockVersionCheck);
|
||||
public void refreshLock(OpenJPAStateManager sm, int level, int timeout,
|
||||
Object sdata);
|
||||
|
||||
/**
|
||||
* Obtain locks on the specified objects.
|
||||
|
|
|
@ -33,8 +33,8 @@ public class NoneLockManager
|
|||
sm.setLock(Boolean.TRUE);
|
||||
}
|
||||
|
||||
public void lock(OpenJPAStateManager sm, int level, int timeout,
|
||||
Object context, boolean postLockVersionCheck) {
|
||||
public void refreshLock(OpenJPAStateManager sm, int level, int timeout,
|
||||
Object context) {
|
||||
sm.setLock(Boolean.TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ public class VersionLockManager
|
|||
|
||||
private boolean _versionCheckOnReadLock = true;
|
||||
private boolean _versionUpdateOnWriteLock = true;
|
||||
private boolean _refreshing = false;
|
||||
|
||||
/**
|
||||
* Returns the given instance's lock level, assuming that the state's
|
||||
|
@ -67,10 +68,20 @@ public class VersionLockManager
|
|||
*/
|
||||
public void lock(OpenJPAStateManager sm, int level, int timeout,
|
||||
Object sdata) {
|
||||
lock(sm, level, timeout, sdata, true);
|
||||
commonLock(sm, level, timeout, sdata, !_refreshing);
|
||||
}
|
||||
|
||||
public void lock(OpenJPAStateManager sm, int level, int timeout,
|
||||
public void refreshLock(OpenJPAStateManager sm, int level, int timeout,
|
||||
Object sdata) {
|
||||
try {
|
||||
_refreshing = true;
|
||||
commonLock(sm, level, timeout, sdata, false);
|
||||
} finally {
|
||||
_refreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void commonLock(OpenJPAStateManager sm, int level, int timeout,
|
||||
Object sdata, boolean postLockVersionCheck) {
|
||||
if (level == LOCK_NONE)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue