diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java | 6 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java index 58639e2..611df4f 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java @@ -76,21 +76,21 @@ class LoggingRepository implements Repository, LogAccessCapability { public Transaction enterTransaction() {
mLog.write("Repository.enterTransaction()");
- return new LoggingTransaction(mLog, mRepo.enterTransaction());
+ return new LoggingTransaction(mLog, mRepo.enterTransaction(), false);
}
public Transaction enterTransaction(IsolationLevel level) {
if (mLog.isEnabled()) {
mLog.write("Repository.enterTransaction(" + level + ')');
}
- return new LoggingTransaction(mLog, mRepo.enterTransaction(level));
+ return new LoggingTransaction(mLog, mRepo.enterTransaction(level), false);
}
public Transaction enterTopTransaction(IsolationLevel level) {
if (mLog.isEnabled()) {
mLog.write("Repository.enterTopTransaction(" + level + ')');
}
- return new LoggingTransaction(mLog, mRepo.enterTopTransaction(level));
+ return new LoggingTransaction(mLog, mRepo.enterTopTransaction(level), true);
}
public IsolationLevel getTransactionIsolationLevel() {
diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java index b9782c8..2fe9865 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java @@ -40,12 +40,14 @@ class LoggingTransaction implements Transaction { private final Log mLog;
private final Transaction mTxn;
private final long mID;
+ private final boolean mTop;
- LoggingTransaction(Log log, Transaction txn) {
+ LoggingTransaction(Log log, Transaction txn, boolean top) {
mParent = mActiveTxn.get();
mLog = log;
mTxn = txn;
mID = mNextID.addAndGet(1);
+ mTop = top;
mActiveTxn.set(this);
mLog.write("Entered transaction: " + idChain());
}
@@ -84,6 +86,10 @@ class LoggingTransaction implements Transaction { if (mParent == null) {
return String.valueOf(mID);
}
- return mParent.idChain() + " > " + mID;
+ if (mTop) {
+ return mParent.idChain() + " | " + mID;
+ } else {
+ return mParent.idChain() + " > " + mID;
+ }
}
}
|