Transactional cache that holds soft refs to clean instances.
| Method from org.apache.openjpa.kernel.BrokerImpl$TransactionalCache Detail: |
public boolean add(Object obj) {
throw new UnsupportedOperationException();
}
|
public boolean addAll(Collection coll) {
throw new UnsupportedOperationException();
}
|
public void addClean(StateManagerImpl sm) {
if (addCleanInternal(sm) && _dirty != null)
_dirty.remove(sm);
}
Add the given instance to the clean cache. |
public void addDirty(StateManagerImpl sm) {
if (_dirty == null) {
if (_orderDirty)
_dirty = MapBackedSet.decorate(new LinkedMap());
else
_dirty = new HashSet();
}
if (_dirty.add(sm))
removeCleanInternal(sm);
}
Add the given instance to the dirty cache. |
public void clear() {
if (_dirty != null)
_dirty = null;
if (_clean != null)
_clean = null;
}
|
public boolean contains(Object obj) {
return (_dirty != null && _dirty.contains(obj))
|| (_clean != null && _clean.contains(obj));
}
|
public boolean containsAll(Collection coll) {
for (Iterator itr = coll.iterator(); itr.hasNext();)
if (!contains(itr.next()))
return false;
return true;
}
|
public Collection copy() {
if (isEmpty())
return Collections.EMPTY_LIST;
// size may not be entirely accurate due to refs expiring, so
// manually copy each object; doesn't matter this way if size too
// big by some
List copy = new ArrayList(size());
if (_dirty != null)
for (Iterator itr = _dirty.iterator(); itr.hasNext();)
copy.add(itr.next());
if (_clean != null)
for (Iterator itr = _clean.iterator(); itr.hasNext();)
copy.add(itr.next());
return copy;
}
Return a copy of all transactional state managers. |
public Collection copyDirty() {
if (_dirty == null || _dirty.isEmpty())
return Collections.EMPTY_LIST;
return new ArrayList(_dirty);
}
Return a copy of all dirty state managers. |
public void flushed(StateManagerImpl sm) {
if (sm.isDirty() && _dirty != null && _dirty.remove(sm))
addCleanInternal(sm);
}
Transfer the given instance from the dirty cache to the clean cache. |
public boolean isEmpty() {
return (_dirty == null || _dirty.isEmpty())
&& (_clean == null || _clean.isEmpty());
}
|
public Iterator iterator() {
IteratorChain chain = new IteratorChain();
if (_dirty != null && !_dirty.isEmpty())
chain.addIterator(_dirty.iterator());
if (_clean != null && !_clean.isEmpty())
chain.addIterator(_clean.iterator());
return chain;
}
|
public boolean remove(StateManagerImpl sm) {
return removeCleanInternal(sm)
|| (_dirty != null && _dirty.remove(sm));
}
Remove the given instance from the cache. |
public boolean remove(Object obj) {
throw new UnsupportedOperationException();
}
|
public boolean removeAll(Collection coll) {
throw new UnsupportedOperationException();
}
|
public boolean retainAll(Collection c) {
throw new UnsupportedOperationException();
}
|
public int size() {
int size = 0;
if (_dirty != null)
size += _dirty.size();
if (_clean != null)
size += _clean.size();
return size;
}
|
public Object[] toArray() {
throw new UnsupportedOperationException();
}
|
public Object[] toArray(Object[] arr) {
throw new UnsupportedOperationException();
}
|