[New] added StrolchTransaction.setSuppressDoNothingLogging()

This commit is contained in:
Robert von Burg 2015-02-13 17:15:25 +01:00
parent a8e5a07a9d
commit 69af0d75bc
2 changed files with 29 additions and 0 deletions

View File

@ -86,6 +86,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
private TransactionCloseStrategy closeStrategy;
private boolean suppressUpdates;
private boolean suppressAudits;
private boolean suppressDoNothingLogging;
private TransactionResult txResult;
private List<Command> commands;
@ -206,6 +207,16 @@ public abstract class AbstractTransaction implements StrolchTransaction {
return this.suppressAudits;
}
@Override
public boolean isSuppressDoNothingLogging() {
return suppressDoNothingLogging;
}
@Override
public void setSuppressDoNothingLogging(boolean quietDoNothing) {
this.suppressDoNothingLogging = quietDoNothing;
}
@Override
public <T extends StrolchRootElement> void lock(T element) throws StrolchLockException {
this.realm.lock(element);
@ -589,6 +600,9 @@ public abstract class AbstractTransaction implements StrolchTransaction {
private void handleDoNothing(long start, long auditTrailDuration) {
if (this.suppressDoNothingLogging)
return;
long end = System.nanoTime();
long txDuration = end - this.txResult.getStartNanos();
long closeDuration = end - start;

View File

@ -268,6 +268,21 @@ public interface StrolchTransaction extends AutoCloseable {
*/
public boolean isSuppressAudits();
/**
* If the given argument is true, then logging of a {@link TransactionCloseStrategy#DO_NOTHING} will be suppressed
*
* @param SuppressDoNothingLogging
* true to suppress logging of a {@link TransactionCloseStrategy#DO_NOTHING}, false to enable logging
*/
void setSuppressDoNothingLogging(boolean suppressDoNothingLogging);
/**
* Returns true if logging of a {@link TransactionCloseStrategy#DO_NOTHING} should be suppressed
*
* @return true if logging of a {@link TransactionCloseStrategy#DO_NOTHING} should be suppressed
*/
boolean isSuppressDoNothingLogging();
/**
* Locks the given element and registers it on the transaction so the lock is released when the transaction is
* closed