directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-396 Stop the zookeeper server after running kdcinit tool.
Date Fri, 07 Aug 2015 13:04:44 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 6ab8fa141 -> 174d0b7e1


DIRKRB-396 Stop the zookeeper server after running kdcinit tool.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/174d0b7e
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/174d0b7e
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/174d0b7e

Branch: refs/heads/master
Commit: 174d0b7e1284563309cc24b11f0e84e6fea9620c
Parents: 6ab8fa1
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Fri Aug 7 21:10:07 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Fri Aug 7 21:10:07 2015 +0800

----------------------------------------------------------------------
 .../kdc/identitybackend/ZookeeperIdentityBackend.java | 14 ++++++++++++++
 .../org/apache/kerby/kerberos/kerb/admin/Kadmin.java  |  8 ++++----
 .../apache/kerby/kerberos/kerb/server/KdcServer.java  |  4 ++--
 .../kerby/kerberos/tool/kdcinit/KdcInitTool.java      |  1 +
 4 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/174d0b7e/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
----------------------------------------------------------------------
diff --git a/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
b/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
index 4e331da..0abc413 100644
--- a/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
+++ b/kerby-backend/zookeeper-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/ZookeeperIdentityBackend.java
@@ -78,6 +78,19 @@ public class ZookeeperIdentityBackend extends AbstractIdentityBackend {
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doStop() throws KrbException {
+        try {
+            zooKeeper.close();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        LOG.info("Zookeeper stopped.");
+    }
+
+    /**
      * Init Zookeeper Server and connection service, used to initialize the backend.
      */
     private void init() throws KrbException {
@@ -168,6 +181,7 @@ public class ZookeeperIdentityBackend extends AbstractIdentityBackend
{
                     }
                 }
             };
+            zookeeperThread.setDaemon(true);
             zookeeperThread.start();
         }
         LOG.info("Embedded Zookeeper started.");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/174d0b7e/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
index ef3e3cc..b37adca 100644
--- a/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
+++ b/kerby-kerb/kerb-admin/src/main/java/org/apache/kerby/kerberos/kerb/admin/Kadmin.java
@@ -23,9 +23,9 @@ import org.apache.kerby.KOptions;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.common.EncryptionUtil;
 import org.apache.kerby.kerberos.kerb.common.KrbUtil;
-import org.apache.kerby.kerberos.kerb.identity.IdentityService;
 import org.apache.kerby.kerberos.kerb.identity.KrbIdentity;
 import org.apache.kerby.kerberos.kerb.identity.backend.BackendConfig;
+import org.apache.kerby.kerberos.kerb.identity.backend.IdentityBackend;
 import org.apache.kerby.kerberos.kerb.keytab.Keytab;
 import org.apache.kerby.kerberos.kerb.server.KdcConfig;
 import org.apache.kerby.kerberos.kerb.server.KdcSetting;
@@ -47,7 +47,7 @@ import java.util.regex.PatternSyntaxException;
  */
 public class Kadmin {
     private final KdcSetting kdcSetting;
-    private final IdentityService backend;
+    private final IdentityBackend backend;
 
     /**
      * Construct with prepared KdcConfig and BackendConfig.
@@ -88,7 +88,7 @@ public class Kadmin {
      * @param kdcSetting The kdc setting
      * @param backend    The identity backend
      */
-    public Kadmin(KdcSetting kdcSetting, IdentityService backend) {
+    public Kadmin(KdcSetting kdcSetting, IdentityBackend backend) {
         this.kdcSetting = kdcSetting;
         this.backend = backend;
     }
@@ -172,7 +172,7 @@ public class Kadmin {
      *
      * @return IdentityBackend
      */
-    public IdentityService getIdentityBackend() {
+    public IdentityBackend getIdentityBackend() {
         return backend;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/174d0b7e/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
index 36e52af..88af20c 100644
--- a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
+++ b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
@@ -21,8 +21,8 @@ package org.apache.kerby.kerberos.kerb.server;
 
 import org.apache.kerby.KOptions;
 import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.identity.IdentityService;
 import org.apache.kerby.kerberos.kerb.identity.backend.BackendConfig;
+import org.apache.kerby.kerberos.kerb.identity.backend.IdentityBackend;
 import org.apache.kerby.kerberos.kerb.server.impl.DefaultInternalKdcServerImpl;
 import org.apache.kerby.kerberos.kerb.server.impl.InternalKdcServer;
 
@@ -196,7 +196,7 @@ public class KdcServer {
      * Get identity service.
      * @return IdentityService
      */
-    public IdentityService getIdentityService() {
+    public IdentityBackend getIdentityService() {
         if (innerKdc == null) {
             throw new RuntimeException("Not init yet");
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/174d0b7e/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
index 8e6b809..34df5b9 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java
@@ -40,6 +40,7 @@ public class KdcInitTool {
                 + " has exported into keytab file " + keytabFile.getAbsolutePath()
                 + ", please make sure to keep it, because it will be used by kadmin tool"
                 + " for the authentication.");
+        kadmin.getIdentityBackend().stop();
     }
 
     public static void main(String[] args) throws KrbException {


Mime
View raw message