From 96d2600cff43f72700c00473bb813ee5c01c30ca Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Wed, 5 Mar 2014 15:55:08 -0800 Subject: Implement AutoCloseable --- .../java/com/amazon/carbonado/repo/logging/LoggingTransaction.java | 5 +++++ .../com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/amazon/carbonado/repo') 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 e2b080c..5141d6e 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java @@ -102,6 +102,11 @@ class LoggingTransaction implements Transaction { return mTxn.preCommit(); } + @Override + public void close() throws PersistException { + exit(); + } + private String idChain() { if (mParent == null) { return String.valueOf(mID); diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java index 1666bf4..d3649ba 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java @@ -25,7 +25,7 @@ import com.amazon.carbonado.PersistException; import com.amazon.carbonado.Transaction; /** - * ReadOnlyTransaction wraps an another transaction. It's only function is to + * ReadOnlyTransaction wraps an another transaction. Its only function is to * serve as a marker for the ReplicatedStorage triggers that no write * operations are allowed. * @@ -87,5 +87,10 @@ class ReadOnlyTransaction implements Transaction { public String toString() { return "ReadOnlyTransaction wrapping { " + mTxn.toString() + " }"; } + + @Override + public void close() throws PersistException { + exit(); + } } -- cgit v1.2.3