[New] Added StrolchTransaction.reset()

This commit is contained in:
Robert von Burg 2020-08-05 23:44:57 +02:00
parent a1ef05a6b7
commit 07d2329725
2 changed files with 16 additions and 0 deletions

View File

@ -1428,6 +1428,16 @@ public abstract class AbstractTransaction implements StrolchTransaction {
} }
} }
@Override
public void reset() {
clearCache();
if (this.commands != null)
this.commands.clear();
if (this.objectFilter != null)
this.objectFilter.clearCache();
logger.info("Cache, commands and changes have been cleared!");
}
@Override @Override
public void flush() { public void flush() {
try { try {

View File

@ -292,6 +292,12 @@ public interface StrolchTransaction extends AutoCloseable {
*/ */
void clearCache(); void clearCache();
/**
* Resets this TX so that all caches and changes are reverted, fetched objects might need to be re-fetched to have a
* clean state. Locks are not released!
*/
void reset();
/** /**
* <p> * <p>
* Performs all registered commands * Performs all registered commands