You are viewing a plain text version of this content. The canonical link for it is here.
Posted to distributedlog-commits@bookkeeper.apache.org by si...@apache.org on 2017/10/18 19:17:04 UTC
[distributedlog] branch master updated: ISSUE173: Implement
AutoCloseable in BKDistributedLogNamespace
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/distributedlog.git
The following commit(s) were added to refs/heads/master by this push:
new 51a0873 ISSUE173: Implement AutoCloseable in BKDistributedLogNamespace
51a0873 is described below
commit 51a08735d57b7c11b05afe9e03c6ef69ae3706d0
Author: Arvin <ar...@gmail.com>
AuthorDate: Wed Oct 18 12:16:58 2017 -0700
ISSUE173: Implement AutoCloseable in BKDistributedLogNamespace
Descriptions of the changes in this PR:
Implement AutoCloseable in BKDistributedLogNamespace
Author: Arvin <ar...@gmail.com>
Reviewers: Sijie Guo <si...@apache.org>
This closes #214 from ArvinDevel/issue173
---
.../java/org/apache/distributedlog/BKDistributedLogNamespace.java | 5 +++--
.../main/java/org/apache/distributedlog/api/namespace/Namespace.java | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogNamespace.java b/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogNamespace.java
index bc6cc8b..b756feb 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogNamespace.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogNamespace.java
@@ -298,16 +298,17 @@ public class BKDistributedLogNamespace implements Namespace {
/**
* Close the distributed log manager factory, freeing any resources it may hold.
+ * close the resource in reverse order v.s. in which they are started
*/
@Override
public void close() {
if (!closed.compareAndSet(false, true)) {
return;
}
- // shutdown the driver
- Utils.close(driver);
// close the write limiter
this.writeLimiter.close();
+ // shutdown the driver
+ Utils.close(driver);
// Shutdown the schedulers
SchedulerUtils.shutdownScheduler(scheduler, conf.getSchedulerShutdownTimeoutMs(),
TimeUnit.MILLISECONDS);
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/Namespace.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/Namespace.java
index cad0f97..8766f17 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/Namespace.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/Namespace.java
@@ -70,7 +70,7 @@ import org.apache.distributedlog.namespace.NamespaceDriver;
*/
@Public
@Evolving
-public interface Namespace {
+public interface Namespace extends AutoCloseable{
/**
* Get the namespace driver used by this namespace.
@@ -187,6 +187,7 @@ public interface Namespace {
/**
* Close the namespace.
*/
+ @Override
void close();
}
--
To stop receiving notification emails like this one, please contact
['"distributedlog-commits@bookkeeper.apache.org" <di...@bookkeeper.apache.org>'].