This is an automated email from the ASF dual-hosted git repository.
andor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/master by this push:
new a6abb93 ZOOKEEPER-3348: Make TxnLog and TxnLog Iterator Closable
a6abb93 is described below
commit a6abb9315bd8309a98393b406ed9f593d4fa25f2
Author: Beluga Behr <[email protected]>
AuthorDate: Fri Apr 12 19:06:41 2019 +0200
ZOOKEEPER-3348: Make TxnLog and TxnLog Iterator Closable
Author: Beluga Behr <[email protected]>
Reviewers: [email protected]
Closes #894 from BELUGABEHR/ZOOKEEPER-3348
---
.../apache/zookeeper/server/persistence/TxnLog.java | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/TxnLog.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/TxnLog.java
index 9781f45..200c933 100644
---
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/TxnLog.java
+++
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/TxnLog.java
@@ -18,6 +18,7 @@
package org.apache.zookeeper.server.persistence;
+import java.io.Closeable;
import java.io.IOException;
import org.apache.jute.Record;
@@ -28,7 +29,7 @@ import org.apache.zookeeper.txn.TxnHeader;
* Interface for reading transaction logs.
*
*/
-public interface TxnLog {
+public interface TxnLog extends Closeable {
/**
* Setter for ServerStats to monitor fsync threshold exceed
@@ -96,15 +97,11 @@ public interface TxnLog {
*/
long getTxnLogSyncElapsedTime();
- /**
- * close the transactions logs
- */
- void close() throws IOException;
/**
* an iterating interface for reading
* transaction logs.
*/
- public interface TxnIterator {
+ public interface TxnIterator extends Closeable {
/**
* return the transaction header.
* @return return the transaction header.
@@ -122,14 +119,7 @@ public interface TxnLog {
* @throws IOException
*/
boolean next() throws IOException;
-
- /**
- * close files and release the
- * resources
- * @throws IOException
- */
- void close() throws IOException;
-
+
/**
* Get an estimated storage space used to store transaction records
* that will return by this iterator