You are viewing a plain text version of this content. The canonical link for it is here.
Posted to distributedlog-issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2017/10/18 19:17:08 UTC

[GitHub] sijie closed pull request #214: Issue173: Implement AutoCloseable in BKDistributedLogNamespace

sijie closed pull request #214: Issue173: Implement AutoCloseable in BKDistributedLogNamespace
URL: https://github.com/apache/distributedlog/pull/214
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 bc6cc8b3..b756feb1 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 @@ private void checkState() throws IOException {
 
     /**
      * 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 cad0f972..8766f17b 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 @@
  */
 @Public
 @Evolving
-public interface Namespace {
+public interface Namespace extends AutoCloseable{
 
     /**
      * Get the namespace driver used by this namespace.
@@ -187,6 +187,7 @@ AccessControlManager createAccessControlManager()
     /**
      * Close the namespace.
      */
+    @Override
     void close();
 
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services