use of com.sun.jdo.spi.persistence.support.sqlstore.StateManager in project Payara by payara.
the class HashSet method remove.
/**
* Removes the given element from this set if it is present.
*
* @param o object to be removed from this set, if present.
* @return <tt>true</tt> if the set contained the specified element.
* @see java.util.HashSet
*/
public boolean remove(Object o) {
if (owner != null) {
StateManager stateManager = owner.jdoGetStateManager();
if (stateManager != null) {
PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();
pm.acquireShareLock();
try {
pm.acquireFieldUpdateLock();
try {
stateManager.makeDirty(fieldName);
boolean modified = super.remove(o);
if (modified) {
if (added.remove(o) == false) {
removed.add(o);
}
stateManager.applyUpdates(fieldName, this);
}
return modified;
} finally {
pm.releaseFieldUpdateLock();
}
} finally {
pm.releaseShareLock();
}
}
}
return super.remove(o);
}
use of com.sun.jdo.spi.persistence.support.sqlstore.StateManager in project Payara by payara.
the class HashSet method retainAll.
/**
* Retains only the elements in this collection that are contained in the
* specified collection (optional operation).
*
* @return <tt>true</tt> if this collection changed as a result of the
* call.
*
* @throws UnsupportedOperationException if the <tt>retainAll</tt> method
* is not supported by this collection.
*
* @see java.util.HashSet
* @see java.util.AbstractCollection
*/
public boolean retainAll(Collection c) {
if (owner != null) {
StateManager stateManager = owner.jdoGetStateManager();
if (stateManager != null) {
PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();
pm.acquireShareLock();
try {
pm.acquireFieldUpdateLock();
try {
// Mark the field as dirty
stateManager.makeDirty(fieldName);
for (Iterator iter = super.iterator(); iter.hasNext(); ) {
Object o = iter.next();
if (!c.contains(o)) {
if (added.remove(o) == false) {
removed.add(o);
}
}
}
boolean modified = super.retainAll(c);
if (modified) {
stateManager.applyUpdates(fieldName, this);
}
return modified;
} finally {
pm.releaseFieldUpdateLock();
}
} finally {
pm.releaseShareLock();
}
}
}
return super.retainAll(c);
}
use of com.sun.jdo.spi.persistence.support.sqlstore.StateManager in project Payara by payara.
the class SqlDate method makeDirty.
/**
* Marks object dirty
*/
public StateManager makeDirty() {
if (owner != null) {
StateManager stateManager = owner.jdoGetStateManager();
if (stateManager != null) {
PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();
pm.acquireShareLock();
try {
synchronized (stateManager) {
//
if (owner != null) {
stateManager.makeDirty(fieldName);
return stateManager;
}
}
} finally {
pm.releaseShareLock();
}
}
}
return null;
}
use of com.sun.jdo.spi.persistence.support.sqlstore.StateManager in project Payara by payara.
the class SqlTimestamp method makeDirty.
/**
* Marks object dirty
*/
public StateManager makeDirty() {
if (owner != null) {
StateManager stateManager = owner.jdoGetStateManager();
if (stateManager != null) {
PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();
pm.acquireShareLock();
try {
synchronized (stateManager) {
//
if (owner != null) {
stateManager.makeDirty(fieldName);
return stateManager;
}
}
} finally {
pm.releaseShareLock();
}
}
}
return null;
}
use of com.sun.jdo.spi.persistence.support.sqlstore.StateManager in project Payara by payara.
the class Vector method removeAllElements.
/**
* Removes all components from this vector and sets its size to zero.<p>
*
* @see java.util.Vector
*/
public synchronized void removeAllElements() {
// Mark the field as dirty
StateManager stateManager = this.makeDirty();
for (Iterator iter = super.iterator(); iter.hasNext(); ) {
Object o = iter.next();
if (added.remove(o) == false)
removed.add(o);
}
added.clear();
super.removeAllElements();
// Apply updates
this.applyUpdates(stateManager, true);
}
Aggregations