[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13018523#comment-13018523
 ] 

Martin Serrano commented on ZOOKEEPER-978:
------------------------------------------

Actually we went with:

{noformat}

### Eclipse Workspace Patch 1.0
#P Attivio - App
Index: src/org/apache/zookeeper/server/ZooKeeperServerMain.java
===================================================================
--- src/org/apache/zookeeper/server/ZooKeeperServerMain.java    (revision 40109)
+++ src/org/apache/zookeeper/server/ZooKeeperServerMain.java    (working copy)
@@ -91,6 +91,7 @@
    */
   public void runFromConfig(ServerConfig config) throws IOException {
     LOG.info("Starting server");
+    FileTxnSnapLog ftxn = null;
     try {
       // Note that this thread isn't going to be doing anything else,
       // so rather than spawning another thread, we will just call
@@ -98,8 +99,7 @@
       // create a file logger url from the command line args
       ZooKeeperServer zkServer = new ZooKeeperServer();
 
-      FileTxnSnapLog ftxn = new FileTxnSnapLog(new
-                   File(config.dataLogDir), new File(config.dataDir));
+      ftxn = new FileTxnSnapLog(new File(config.dataLogDir), new 
File(config.dataDir));
       zkServer.setTxnLogFactory(ftxn);
       zkServer.setTickTime(config.tickTime);
       zkServer.setMinSessionTimeout(config.minSessionTimeout);
@@ -114,6 +114,8 @@
     } catch (InterruptedException e) {
       // warn, but generally this is ok
       LOG.warn("Server interrupted", e);
+    } finally {
+      if (ftxn != null) ftxn.close();
     }
   }
{noformat}

> ZookeeperServer does not close zk database on shutdwon
> ------------------------------------------------------
>
>                 Key: ZOOKEEPER-978
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-978
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.2
>            Reporter: Sergei Bobovich
>
> ZookeeperServer does not close zk database on shutdown leaving log files 
> open. Not sure if this is an intention, but looks like a possible bug to me. 
> Database is getting closed only from QuorumPeer class. 
> Hit it when executing regression tests on windows: failed to delete log files 
> from cleanup.
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to