/** * Make sure the version information is correct in the detached object. */ private void compareVersion(StateManagerImpl sm, PersistenceCapable pc) { Object version = pc.pcGetVersion(); if (version == null) return; // don't need to load unloaded fields since its implicitly // a single field value StoreManager store = sm.getBroker().getStoreManager(); switch (store.compareVersion(sm, version, sm.getVersion())) { case StoreManager.VERSION_LATER: // we have a later version: set it into the object. // lock validation will occur at commit time sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(sm.getManagedInstance()); case StoreManager.VERSION_SAME: // no action required break; } }
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(sm.getManagedInstance()); case StoreManager.VERSION_SAME:
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(sm.getManagedInstance()); case StoreManager.VERSION_SAME:
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(sm.getManagedInstance()); case StoreManager.VERSION_SAME:
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(sm.getManagedInstance()); case StoreManager.VERSION_SAME:
public boolean beforeRefresh(boolean refreshAll) { // note: all logic placed here rather than in the states for // optimization; this method public b/c used by remote package // nothing to do for non persistent or new unflushed instances if (!isPersistent() || (isNew() && !isFlushed())) return false; lock(); try { // if dirty need to clear fields if (isDirty()) { clearFields(); return true; } // if some fields have been loaded but the instance is out of // date or this is part of a refreshAll() and we don't want to // take the extra hit to see if the instance is out of date, clear if (_loaded.length() > 0 && (refreshAll || isEmbedded() || !syncVersion(null))) { Object version = _version; clearFields(); // if syncVersion just replaced the version, reset it if (!refreshAll && !isEmbedded()) setVersion(version); return true; } return false; } finally { unlock(); } }
public boolean beforeRefresh(boolean refreshAll) { // note: all logic placed here rather than in the states for // optimization; this method public b/c used by remote package // nothing to do for non persistent or new unflushed instances if (!isPersistent() || (isNew() && !isFlushed())) return false; lock(); try { // if dirty need to clear fields if (isDirty()) { clearFields(); return true; } // if some fields have been loaded but the instance is out of // date or this is part of a refreshAll() and we don't want to // take the extra hit to see if the instance is out of date, clear if (_loaded.length() > 0 && (refreshAll || isEmbedded() || !syncVersion(null))) { Object version = _version; clearFields(); // if syncVersion just replaced the version, reset it if (!refreshAll && !isEmbedded()) setVersion(version); return true; } return false; } finally { unlock(); } }
public boolean beforeRefresh(boolean refreshAll) { // note: all logic placed here rather than in the states for // optimization; this method public b/c used by remote package // nothing to do for non persistent or new unflushed instances if (!isPersistent() || (isNew() && !isFlushed())) return false; lock(); try { // if dirty need to clear fields if (isDirty()) { clearFields(); return true; } // if some fields have been loaded but the instance is out of // date or this is part of a refreshAll() and we don't want to // take the extra hit to see if the instance is out of date, clear if (_loaded.length() > 0 && (refreshAll || isEmbedded() || !syncVersion(null))) { Object version = _version; clearFields(); // if syncVersion just replaced the version, reset it if (!refreshAll && !isEmbedded()) setVersion(version); return true; } return false; } finally { unlock(); } }
public boolean beforeRefresh(boolean refreshAll) { // note: all logic placed here rather than in the states for // optimization; this method public b/c used by remote package // nothing to do for non persistent or new unflushed instances if (!isPersistent() || (isNew() && !isFlushed())) return false; lock(); try { // if dirty need to clear fields if (isDirty()) { clearFields(); return true; } // if some fields have been loaded but the instance is out of // date or this is part of a refreshAll() and we don't want to // take the extra hit to see if the instance is out of date, clear if (_loaded.length() > 0 && (refreshAll || isEmbedded() || !syncVersion(null))) { Object version = _version; clearFields(); // if syncVersion just replaced the version, reset it if (!refreshAll && !isEmbedded()) setVersion(version); return true; } return false; } finally { unlock(); } }
public boolean beforeRefresh(boolean refreshAll) { // note: all logic placed here rather than in the states for // optimization; this method public b/c used by remote package // nothing to do for non persistent or new unflushed instances if (!isPersistent() || (isNew() && !isFlushed())) return false; lock(); try { // if dirty need to clear fields if (isDirty()) { clearFields(); return true; } // if some fields have been loaded but the instance is out of // date or this is part of a refreshAll() and we don't want to // take the extra hit to see if the instance is out of date, clear if (_loaded.length() > 0 && (refreshAll || isEmbedded() || !syncVersion(null))) { Object version = _version; clearFields(); // if syncVersion just replaced the version, reset it if (!refreshAll && !isEmbedded()) setVersion(version); return true; } return false; } finally { unlock(); } }
/** * Delegates to the current state after checking the value * of the RetainState flag. * * @see PCState#commit * @see PCState#commitRetain */ void commit() { // release locks before oid updated releaseLocks(); // update version and oid information setVersion(_version); _flags &= ~FLAG_FLUSHED; _flags &= ~FLAG_FLUSHED_DIRTY; Object orig = _id; assertObjectIdAssigned(false); boolean wasNew = isNew() && !isDeleted() && !isProvisional(); if (_broker.getRetainState()) setPCState(_state.commitRetain(this)); else setPCState(_state.commit(this)); // ask the broker to re-cache us if we were new previously if (wasNew) _broker.setStateManager(orig, this, BrokerImpl.STATUS_COMMIT_NEW); }
/** * Delegates to the current state after checking the value * of the RetainState flag. * * @see PCState#commit * @see PCState#commitRetain */ void commit() { // release locks before oid updated releaseLocks(); // update version and oid information setVersion(_version); _flags &= ~FLAG_FLUSHED; _flags &= ~FLAG_FLUSHED_DIRTY; Object orig = _id; assertObjectIdAssigned(false); boolean wasNew = isNew() && !isDeleted() && !isProvisional(); if (_broker.getRetainState()) setPCState(_state.commitRetain(this)); else setPCState(_state.commit(this)); // ask the broker to re-cache us if we were new previously if (wasNew) _broker.setStateManager(orig, this, BrokerImpl.STATUS_COMMIT_NEW); }
/** * Delegates to the current state after checking the value * of the RetainState flag. * * @see PCState#commit * @see PCState#commitRetain */ void commit() { // release locks before oid updated releaseLocks(); // update version and oid information setVersion(_version); _flags &= ~FLAG_FLUSHED; _flags &= ~FLAG_FLUSHED_DIRTY; Object orig = _id; assertObjectIdAssigned(false); boolean wasNew = isNew() && !isDeleted() && !isProvisional(); if (_broker.getRetainState()) setPCState(_state.commitRetain(this)); else setPCState(_state.commit(this)); // ask the broker to re-cache us if we were new previously if (wasNew) _broker.setStateManager(orig, this, BrokerImpl.STATUS_COMMIT_NEW); }
/** * Delegates to the current state after checking the value * of the RetainState flag. * * @see PCState#commit * @see PCState#commitRetain */ void commit() { // release locks before oid updated releaseLocks(); // update version and oid information setVersion(_version); _flags &= ~FLAG_FLUSHED; _flags &= ~FLAG_FLUSHED_DIRTY; Object orig = _id; assertObjectIdAssigned(false); boolean wasNew = isNew() && !isDeleted() && !isProvisional(); if (_broker.getRetainState()) setPCState(_state.commitRetain(this)); else setPCState(_state.commit(this)); // ask the broker to re-cache us if we were new previously if (wasNew) _broker.setStateManager(orig, this, BrokerImpl.STATUS_COMMIT_NEW); }
/** * Delegates to the current state after checking the value * of the RetainState flag. * * @see PCState#commit * @see PCState#commitRetain */ void commit() { // release locks before oid updated releaseLocks(); // update version and oid information setVersion(_version); _flags &= ~FLAG_FLUSHED; _flags &= ~FLAG_FLUSHED_DIRTY; Object orig = _id; assertObjectIdAssigned(false); boolean wasNew = isNew() && !isDeleted() && !isProvisional(); if (_broker.getRetainState()) setPCState(_state.commitRetain(this)); else setPCState(_state.commit(this)); // ask the broker to re-cache us if we were new previously if (wasNew) _broker.setStateManager(orig, this, BrokerImpl.STATUS_COMMIT_NEW); }
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(into); case StoreManager.VERSION_SAME:
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(into); case StoreManager.VERSION_SAME:
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(into); case StoreManager.VERSION_SAME:
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(into); case StoreManager.VERSION_SAME:
sm.setVersion(version); break; case StoreManager.VERSION_EARLIER: case StoreManager.VERSION_DIFFERENT: sm.setVersion(version); throw new OptimisticException(into); case StoreManager.VERSION_SAME: