|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.spif.StoreChain | +--net.sf.spif.StoreAccumulator
A store accumulator can accumulate several puts and removes, and forget them, or send them further down the chain at some later time. Use this too create long transactions without having to make the business code using the store transaction-aware.
This class is not thread safe.
Field Summary |
Fields inherited from class net.sf.spif.StoreChain |
chained |
Constructor Summary | |
StoreAccumulator()
|
Method Summary | |
void |
begin()
Starts a transaction. |
void |
clear()
Clears all puts and gets and sets this to be not in a transaction |
void |
commit()
Commits all accumulated changes (puts and removes) to the downstream store chain. |
java.lang.Object |
get(Id id,
boolean writable)
Returns an object. |
boolean |
inTransaction()
Returns whether we are in a transaction |
Id |
put(Id id,
java.lang.Object object)
Accumulates the put in this class until commit
if a transaction has started .
|
boolean |
remove(Id id)
Accumulates the remove in this class until commit
if a transaction has started .
|
void |
rollback()
Rolls back all changes if we are in a transaction. |
Methods inherited from class net.sf.spif.StoreChain |
equals, getChained, getChained, getChained, hashCode, setChained |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StoreAccumulator()
Method Detail |
public java.lang.Object get(Id id, boolean writable)
get
in class StoreChain
id
- the id of the object to return
public Id put(Id id, java.lang.Object object)
commit
if a transaction has started
.
Passes it on if not.
put
in class StoreChain
id
- the id of the object to put. May be nullobject
- the object to put. May be null
public boolean remove(Id id)
commit
if a transaction has started
.
Passes it on if not.
remove
in class StoreChain
id
- the id of the object to remove
public void clear()
clear
in class StoreChain
public void rollback()
public void begin()
public void commit()
public boolean inTransaction()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |