bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eolive...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-1074: Remove JMX Bean
Date Thu, 01 Jun 2017 11:20:03 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/master d1f37dafb -> dd08ce1a6


BOOKKEEPER-1074: Remove JMX Bean

This change is based on #160 , the change here is: gitsha [b3be81f](https://github.com/sijie/bookkeeper/commit/b3be81fadae50f2d4a2e938c2735fa35c6c31421)

Author: Sijie Guo <sijie@apache.org>
Author: Sijie Guo <sijieg@twitter.com>

Reviewers: Enrico Olivelli, Matteo Merli

Closes #161 from sijie/remove_jmx_beam


Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/dd08ce1a
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/dd08ce1a
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/dd08ce1a

Branch: refs/heads/master
Commit: dd08ce1a644de00967dd5fe34ce15caa9789d775
Parents: d1f37da
Author: Sijie Guo <sijie@apache.org>
Authored: Thu Jun 1 13:19:58 2017 +0200
Committer: Enrico Olivelli <eolivelli@apache.org>
Committed: Thu Jun 1 13:19:58 2017 +0200

----------------------------------------------------------------------
 .../org/apache/bookkeeper/bookie/Bookie.java    | 63 +-------------
 .../apache/bookkeeper/bookie/BookieBean.java    | 56 ------------
 .../apache/bookkeeper/bookie/BookieMXBean.java  | 31 -------
 .../bookie/InterleavedLedgerStorage.java        |  6 --
 .../apache/bookkeeper/bookie/LedgerCache.java   |  2 -
 .../bookkeeper/bookie/LedgerCacheBean.java      | 27 ------
 .../bookkeeper/bookie/LedgerCacheImpl.java      | 41 ---------
 .../bookkeeper/bookie/LedgerCacheMXBean.java    | 50 -----------
 .../apache/bookkeeper/bookie/LedgerStorage.java |  8 +-
 .../org/apache/bookkeeper/jmx/BKMBeanInfo.java  | 27 ------
 .../apache/bookkeeper/jmx/BKMBeanRegistry.java  | 89 --------------------
 .../apache/bookkeeper/proto/BookieServer.java   | 32 -------
 .../bookkeeper/proto/BookieServerBean.java      | 82 ------------------
 .../bookkeeper/proto/BookieServerMXBean.java    | 53 ------------
 .../bookkeeper/bookie/TestSyncThread.java       |  4 -
 .../apache/bookkeeper/meta/GcLedgersTest.java   |  6 --
 .../bookkeeper/meta/LedgerManagerTestCase.java  |  6 --
 17 files changed, 3 insertions(+), 580 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
index 090574c..63e1708 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
@@ -43,18 +43,16 @@ import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import org.apache.bookkeeper.bookie.Journal.JournalScanner;
 import org.apache.bookkeeper.bookie.LedgerDirsManager.LedgerDirsListener;
 import org.apache.bookkeeper.bookie.LedgerDirsManager.NoWritableLedgerDirException;
 import org.apache.bookkeeper.conf.ServerConfiguration;
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
-import org.apache.bookkeeper.jmx.BKMBeanRegistry;
-
 import org.apache.bookkeeper.meta.LedgerManager;
 import org.apache.bookkeeper.meta.LedgerManagerFactory;
-
 import org.apache.bookkeeper.net.BookieSocketAddress;
 import org.apache.bookkeeper.net.DNS;
 import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.WriteCallback;
@@ -72,7 +70,6 @@ import org.apache.bookkeeper.versioning.Versioned;
 import org.apache.bookkeeper.zookeeper.BoundExponentialBackoffRetryPolicy;
 import org.apache.bookkeeper.zookeeper.ZooKeeperClient;
 import org.apache.commons.io.FileUtils;
-
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.NodeExistsException;
@@ -80,15 +77,11 @@ import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.Watcher.Event.EventType;
 import org.apache.zookeeper.Watcher.Event.KeeperState;
-
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.Stat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Sets;
-
 import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIE_ADD_ENTRY;
 import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIE_ADD_ENTRY_BYTES;
 import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIE_READ_ENTRY;
@@ -142,10 +135,6 @@ public class Bookie extends BookieCriticalThread {
 
     private int exitCode = ExitCode.OK;
 
-    // jmx related beans
-    BookieBean jmxBookieBean;
-    BKMBeanInfo jmxLedgerStorageBean;
-
     private final ConcurrentLongHashMap<byte[]> masterKeyCache = new ConcurrentLongHashMap<>();
 
     final protected String zkBookieRegPath;
@@ -894,54 +883,6 @@ public class Bookie extends BookieCriticalThread {
     }
 
     /**
-     * Register jmx with parent
-     *
-     * @param parent parent bk mbean info
-     */
-    public void registerJMX(BKMBeanInfo parent) {
-        try {
-            jmxBookieBean = new BookieBean(this);
-            BKMBeanRegistry.getInstance().register(jmxBookieBean, parent);
-
-            try {
-                jmxLedgerStorageBean = this.ledgerStorage.getJMXBean();
-                if (jmxLedgerStorageBean != null) {
-                    BKMBeanRegistry.getInstance().register(jmxLedgerStorageBean, jmxBookieBean);
-                }
-            } catch (Exception e) {
-                LOG.warn("Failed to register with JMX for ledger cache", e);
-                jmxLedgerStorageBean = null;
-            }
-        } catch (Exception e) {
-            LOG.warn("Failed to register with JMX", e);
-            jmxBookieBean = null;
-        }
-    }
-
-    /**
-     * Unregister jmx
-     */
-    public void unregisterJMX() {
-        try {
-            if (jmxLedgerStorageBean != null) {
-                BKMBeanRegistry.getInstance().unregister(jmxLedgerStorageBean);
-            }
-        } catch (Exception e) {
-            LOG.warn("Failed to unregister with JMX", e);
-        }
-        try {
-            if (jmxBookieBean != null) {
-                BKMBeanRegistry.getInstance().unregister(jmxBookieBean);
-            }
-        } catch (Exception e) {
-            LOG.warn("Failed to unregister with JMX", e);
-        }
-        jmxBookieBean = null;
-        jmxLedgerStorageBean = null;
-    }
-
-
-    /**
      * Instantiate the ZooKeeper client for the Bookie.
      */
     private ZooKeeper instantiateZookeeperClient(ServerConfiguration conf)

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieBean.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieBean.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieBean.java
deleted file mode 100644
index 67d0129..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieBean.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.bookkeeper.bookie;
-
-import java.io.File;
-
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
-
-/**
- * Bookie Bean
- */
-public class BookieBean implements BookieMXBean, BKMBeanInfo {
-
-    protected Bookie bk;
-
-    public BookieBean(Bookie bk) {
-        this.bk = bk;
-    }
-
-    @Override
-    public String getName() {
-        return "Bookie";
-    }
-
-    @Override
-    public boolean isHidden() {
-        return false;
-    }
-
-    @Override
-    public int getQueueLength() {
-
-        int totalLength = 0;
-        for (Journal journal : bk.journals) {
-            totalLength += journal.getJournalQueueLength();
-        }
-        return totalLength;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieMXBean.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieMXBean.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieMXBean.java
deleted file mode 100644
index 24f299c..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieMXBean.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.bookkeeper.bookie;
-
-import java.io.File;
-
-/**
- * Bookie MBean
- */
-public interface BookieMXBean {
-    /**
-     * @return log entry queue length
-     */
-    public int getQueueLength();
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/InterleavedLedgerStorage.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/InterleavedLedgerStorage.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/InterleavedLedgerStorage.java
index 61a81c4..b8a6e53 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/InterleavedLedgerStorage.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/InterleavedLedgerStorage.java
@@ -40,7 +40,6 @@ import java.util.Map;
 import java.util.NavigableMap;
 
 import org.apache.bookkeeper.conf.ServerConfiguration;
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
 import org.apache.bookkeeper.meta.LedgerManager;
 import org.apache.bookkeeper.proto.BookieProtocol;
 import org.apache.bookkeeper.stats.OpStatsLogger;
@@ -421,11 +420,6 @@ public class InterleavedLedgerStorage implements CompactableLedgerStorage,
Entry
     }
 
     @Override
-    public BKMBeanInfo getJMXBean() {
-        return ledgerCache.getJMXBean();
-    }
-
-    @Override
     public void registerLedgerDeletionListener(LedgerDeletionListener listener) {
         ledgerDeletionListeners.add(listener);
     }

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCache.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCache.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCache.java
index efb67dc..c55592f 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCache.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCache.java
@@ -23,7 +23,6 @@ package org.apache.bookkeeper.bookie;
 
 import java.io.Closeable;
 import java.io.IOException;
-import java.nio.ByteBuffer;
 
 import io.netty.buffer.ByteBuf;
 
@@ -52,7 +51,6 @@ interface LedgerCache extends Closeable {
 
     void deleteLedger(long ledgerId) throws IOException;
 
-    LedgerCacheBean getJMXBean();
     void setExplicitLac(long ledgerId, ByteBuf lac) throws IOException;
     ByteBuf getExplicitLac(long ledgerId);
 }

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheBean.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheBean.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheBean.java
deleted file mode 100644
index dabc12d..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheBean.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.bookkeeper.bookie;
-
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
-
-/**
- * Ledger Cache Bean
- */
-public interface LedgerCacheBean extends LedgerCacheMXBean, BKMBeanInfo {
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheImpl.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheImpl.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheImpl.java
index 515b64b..6fd6ecf 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheImpl.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheImpl.java
@@ -22,7 +22,6 @@
 package org.apache.bookkeeper.bookie;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 
 import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.stats.NullStatsLogger;
@@ -158,46 +157,6 @@ public class LedgerCacheImpl implements LedgerCache {
     }
 
     @Override
-    public LedgerCacheBean getJMXBean() {
-        return new LedgerCacheBean() {
-            @Override
-            public String getName() {
-                return "LedgerCache";
-            }
-
-            @Override
-            public boolean isHidden() {
-                return false;
-            }
-
-            @Override
-            public int getPageCount() {
-                return LedgerCacheImpl.this.indexPageManager.getNumUsedPages();
-            }
-
-            @Override
-            public int getPageSize() {
-                return LedgerCacheImpl.this.getPageSize();
-            }
-
-            @Override
-            public int getOpenFileLimit() {
-                return LedgerCacheImpl.this.indexPersistenceManager.getOpenFileLimit();
-            }
-
-            @Override
-            public int getPageLimit() {
-                return LedgerCacheImpl.this.indexPageManager.getPageLimit();
-            }
-
-            @Override
-            public int getNumOpenLedgers() {
-                return LedgerCacheImpl.this.indexPersistenceManager.getNumOpenLedgers();
-            }
-        };
-    }
-
-    @Override
     public void close() throws IOException {
         indexPersistenceManager.close();
     }

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheMXBean.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheMXBean.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheMXBean.java
deleted file mode 100644
index c24e348..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerCacheMXBean.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.bookkeeper.bookie;
-
-/**
- * Ledger Cache MBean
- */
-public interface LedgerCacheMXBean {
-
-    /**
-     * @return number of page used in cache
-     */
-    public int getPageCount();
-
-    /**
-     * @return page size
-     */
-    public int getPageSize();
-
-    /**
-     * @return the limit of open files
-     */
-    public int getOpenFileLimit();
-
-    /**
-     * @return the limit number of pages
-     */
-    public int getPageLimit();
-
-    /**
-     * @return number of open ledgers
-     */
-    public int getNumOpenLedgers();
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerStorage.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerStorage.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerStorage.java
index 4587460..9d2161e 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerStorage.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerStorage.java
@@ -28,7 +28,6 @@ import java.io.IOException;
 import org.apache.bookkeeper.bookie.CheckpointSource.Checkpoint;
 import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.stats.StatsLogger;
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
 import org.apache.bookkeeper.meta.LedgerManager;
 
 /**
@@ -132,7 +131,7 @@ public interface LedgerStorage {
      * before that point already persist.
      *
      * @param checkpoint
-     *          Check Point that {@link Checkpointer} proposed.
+     *          Check Point that {@link Checkpoint} proposed.
      * @throws IOException
      * @return the checkpoint that the ledger storage finished.
      */
@@ -157,11 +156,6 @@ public interface LedgerStorage {
      */
     void registerLedgerDeletionListener(LedgerDeletionListener listener);
 
-    /**
-     * Get the JMX management bean for this LedgerStorage
-     */
-    BKMBeanInfo getJMXBean();
-
     void setExplicitlac(long ledgerId, ByteBuf lac) throws IOException;
 
     ByteBuf getExplicitLac(long ledgerId);

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanInfo.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanInfo.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanInfo.java
deleted file mode 100644
index 5d4f120..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanInfo.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.bookkeeper.jmx;
-
-import org.apache.zookeeper.jmx.ZKMBeanInfo;
-
-/**
- * BookKeeper MBean info interface.
- */
-public interface BKMBeanInfo extends ZKMBeanInfo {
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java
deleted file mode 100644
index 3988916..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.bookkeeper.jmx;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.zookeeper.jmx.MBeanRegistry;
-import org.apache.zookeeper.jmx.ZKMBeanInfo;
-
-/**
- * This class provides a unified interface for registering/unregistering of
- * bookkeeper MBeans with the platform MBean server. It builds a hierarchy of MBeans
- * where each MBean represented by a filesystem-like path. Eventually, this hierarchy
- * will be stored in the zookeeper data tree instance as a virtual data tree.
- */
-public class BKMBeanRegistry extends MBeanRegistry {
-    static final Logger LOG = LoggerFactory.getLogger(BKMBeanRegistry.class);
-    
-    static final String DOMAIN = "org.apache.BookKeeperService";
-
-    static BKMBeanRegistry instance=new BKMBeanRegistry(); 
-
-    public static BKMBeanRegistry getInstance(){
-        return instance;
-    }
-
-    protected String getDomainName() {
-        return DOMAIN;
-    }
-    
-    /**
-     * This takes a path, such as /a/b/c, and converts it to 
-     * name0=a,name1=b,name2=c
-     * 
-     * Copy from zookeeper MBeanRegistry since tokenize is private
-     */
-    protected int tokenize(StringBuilder sb, String path, int index) {
-        String[] tokens = path.split("/");
-        for (String s: tokens) {
-            if (s.length()==0)
-                continue;
-            sb.append("name").append(index++).append("=").append(s).append(",");
-        }
-        return index;
-    }
-
-    /**
-     * Builds an MBean path and creates an ObjectName instance using the path. 
-     * @param path MBean path
-     * @param bean the MBean instance
-     * @return ObjectName to be registered with the platform MBean server
-     */
-    protected ObjectName makeObjectName(String path, ZKMBeanInfo bean)
-        throws MalformedObjectNameException {
-        if(path==null)
-            return null;
-        StringBuilder beanName = new StringBuilder(getDomainName() + ":");
-        int counter=0;
-        counter=tokenize(beanName,path,counter);
-        tokenize(beanName,bean.getName(),counter);
-        beanName.deleteCharAt(beanName.length()-1);
-        try {
-            return new ObjectName(beanName.toString());
-        } catch (MalformedObjectNameException e) {
-            LOG.warn("Invalid name \"" + beanName.toString() + "\" for class "
-                    + bean.getClass().toString());
-            throw e;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
index 7f437ff..38d79c4 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
@@ -33,7 +33,6 @@ import org.apache.bookkeeper.bookie.BookieCriticalThread;
 import org.apache.bookkeeper.bookie.BookieException;
 import org.apache.bookkeeper.bookie.ExitCode;
 import org.apache.bookkeeper.conf.ServerConfiguration;
-import org.apache.bookkeeper.jmx.BKMBeanRegistry;
 import org.apache.bookkeeper.net.BookieSocketAddress;
 import org.apache.bookkeeper.processor.RequestProcessor;
 import org.apache.bookkeeper.replication.AutoRecoveryMain;
@@ -75,7 +74,6 @@ public class BookieServer {
     int exitCode = ExitCode.OK;
 
     // operation stats
-    protected BookieServerBean jmxBkServerBean;
     AutoRecoveryMain autoRecoveryMain = null;
     private boolean isAutoRecoveryDaemonEnabled;
 
@@ -128,9 +126,6 @@ public class BookieServer {
         running = true;
         deathWatcher = new DeathWatcher(conf);
         deathWatcher.start();
-
-        // register jmx
-        registerJMX();
     }
 
     @VisibleForTesting
@@ -173,33 +168,6 @@ public class BookieServer {
         }
         this.requestProcessor.close();
         running = false;
-
-        // unregister JMX
-        unregisterJMX();
-    }
-
-    protected void registerJMX() {
-        try {
-            jmxBkServerBean = new BookieServerBean(conf, this);
-            BKMBeanRegistry.getInstance().register(jmxBkServerBean, null);
-
-            bookie.registerJMX(jmxBkServerBean);
-        } catch (Exception e) {
-            LOG.warn("Failed to register with JMX", e);
-            jmxBkServerBean = null;
-        }
-    }
-
-    protected void unregisterJMX() {
-        try {
-            bookie.unregisterJMX();
-            if (jmxBkServerBean != null) {
-                BKMBeanRegistry.getInstance().unregister(jmxBkServerBean);
-            }
-        } catch (Exception e) {
-            LOG.warn("Failed to unregister with JMX", e);
-        }
-        jmxBkServerBean = null;
     }
 
     public boolean isRunning() {

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServerBean.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServerBean.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServerBean.java
deleted file mode 100644
index afb763e..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServerBean.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.bookkeeper.proto;
-
-import java.net.UnknownHostException;
-
-import org.apache.bookkeeper.bookie.Bookie;
-import org.apache.bookkeeper.conf.ServerConfiguration;
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
-import org.apache.bookkeeper.proto.BKStats.OpStatData;
-
-/**
- * Bookie Server Bean
- */
-public class BookieServerBean implements BookieServerMXBean, BKMBeanInfo {
-
-    protected final BookieServer bks;
-    protected final ServerConfiguration conf;
-    private final String name;
-
-    public BookieServerBean(ServerConfiguration conf, BookieServer bks) {
-        this.conf = conf;
-        this.bks = bks;
-        name = "BookieServer_" + conf.getBookiePort();
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public boolean isHidden() {
-        return false;
-    }
-
-    @Override
-    public long getNumPacketsReceived() {
-        return ServerStats.getInstance().getPacketsReceived();
-    }
-
-    @Override
-    public long getNumPacketsSent() {
-        return ServerStats.getInstance().getPacketsSent();
-    }
-
-    @Override
-    public OpStatData getAddStats() {
-        return BKStats.getInstance().getOpStats(BKStats.STATS_ADD).toOpStatData();
-    }
-
-    @Override
-    public OpStatData getReadStats() {
-        return BKStats.getInstance().getOpStats(BKStats.STATS_READ).toOpStatData();
-    }
-
-    @Override
-    public String getServerPort() {
-        try {
-            return Bookie.getBookieAddress(conf).toString();
-        } catch (UnknownHostException e) {
-            return "localhost:" + conf.getBookiePort();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServerMXBean.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServerMXBean.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServerMXBean.java
deleted file mode 100644
index 054309f..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServerMXBean.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.bookkeeper.proto;
-
-import org.apache.bookkeeper.proto.BKStats.OpStatData;
-
-/**
- * Bookie Server MBean
- */
-public interface BookieServerMXBean {
-
-    /**
-     * @return packets received
-     */
-    public long getNumPacketsReceived();
-
-    /**
-     * @return packets sent
-     */
-    public long getNumPacketsSent();
-
-    /**
-     * @return add stats
-     */
-    public OpStatData getAddStats();
-
-    /**
-     * @return read stats
-     */
-    public OpStatData getReadStats();
-
-    /**
-     * @return server port
-     */
-    public String getServerPort();
-
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
index 9352db3..6be898d 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/TestSyncThread.java
@@ -39,7 +39,6 @@ import org.apache.bookkeeper.stats.StatsLogger;
 import org.apache.bookkeeper.bookie.CheckpointSource.Checkpoint;
 import org.apache.bookkeeper.bookie.LedgerDirsManager.LedgerDirsListener;
 import org.apache.bookkeeper.bookie.LedgerDirsManager.NoWritableLedgerDirException;
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
 import org.apache.bookkeeper.meta.LedgerManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -346,9 +345,6 @@ public class TestSyncThread {
         }
 
         @Override
-        public BKMBeanInfo getJMXBean() { return null; }
-
-        @Override
         public void registerLedgerDeletionListener(LedgerDeletionListener listener) {
         }
     }

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java
index 0db938b..48b8bab 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java
@@ -60,7 +60,6 @@ import org.apache.bookkeeper.client.BKException;
 import org.apache.bookkeeper.client.BookKeeper.DigestType;
 import org.apache.bookkeeper.client.LedgerMetadata;
 import org.apache.bookkeeper.conf.ServerConfiguration;
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
 import org.apache.bookkeeper.meta.LedgerManager.LedgerRange;
 import org.apache.bookkeeper.meta.LedgerManager.LedgerRangeIterator;
 import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback;
@@ -404,11 +403,6 @@ public class GcLedgersTest extends LedgerManagerTestCase {
         }
 
         @Override
-        public BKMBeanInfo getJMXBean() {
-            return null;
-        }
-
-        @Override
         public EntryLogger getEntryLogger() {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/dd08ce1a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerTestCase.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerTestCase.java
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerTestCase.java
index ac9fe59..d962264 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerTestCase.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerTestCase.java
@@ -35,7 +35,6 @@ import org.apache.bookkeeper.bookie.EntryLocation;
 import org.apache.bookkeeper.bookie.EntryLogger;
 import org.apache.bookkeeper.bookie.LedgerDirsManager;
 import org.apache.bookkeeper.conf.ServerConfiguration;
-import org.apache.bookkeeper.jmx.BKMBeanInfo;
 import org.apache.bookkeeper.stats.StatsLogger;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
 import org.apache.bookkeeper.util.SnapshotMap;
@@ -195,11 +194,6 @@ public abstract class LedgerManagerTestCase extends BookKeeperClusterTestCase
{
         }
 
         @Override
-        public BKMBeanInfo getJMXBean() {
-            return null;
-        }
-
-        @Override
         public EntryLogger getEntryLogger() {
             return null;
         }


Mime
View raw message