You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by iv...@apache.org on 2012/03/19 13:04:52 UTC

svn commit: r1302392 - in /zookeeper/bookkeeper/trunk: ./ bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/ hedwig-server/src/main/java/org/apache/hedwig/server/jmx/

Author: ivank
Date: Mon Mar 19 12:04:51 2012
New Revision: 1302392

URL: http://svn.apache.org/viewvc?rev=1302392&view=rev
Log:
BOOKKEEPER-96: extends zookeeper JMX to monitor and manage hedwig server (sijie via ivank)

Added:
    zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/
    zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigJMXService.java
    zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanInfo.java
    zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanRegistry.java
Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1302392&r1=1302391&r2=1302392&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Mon Mar 19 12:04:51 2012
@@ -94,6 +94,8 @@ Trunk (unreleased changes)
 
         BOOKKEEPER-168: Message bounding on subscriptions (ivank)
 
+        BOOKKEEPER-96: extends zookeeper JMX to monitor and manage hedwig server (sijie via ivank)
+
       bookkeeper-benchmark/
 	BOOKKEEPER-158: Move latest benchmarking code into trunk (ivank via fpj)
 

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java?rev=1302392&r1=1302391&r2=1302392&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java (original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/jmx/BKMBeanRegistry.java Mon Mar 19 12:04:51 2012
@@ -41,6 +41,10 @@ public class BKMBeanRegistry extends MBe
     public static BKMBeanRegistry getInstance(){
         return instance;
     }
+
+    protected String getDomainName() {
+        return DOMAIN;
+    }
     
     /**
      * This takes a path, such as /a/b/c, and converts it to 
@@ -68,7 +72,7 @@ public class BKMBeanRegistry extends MBe
         throws MalformedObjectNameException {
         if(path==null)
             return null;
-        StringBuilder beanName = new StringBuilder(DOMAIN + ":");
+        StringBuilder beanName = new StringBuilder(getDomainName() + ":");
         int counter=0;
         counter=tokenize(beanName,path,counter);
         tokenize(beanName,bean.getName(),counter);

Added: zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigJMXService.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigJMXService.java?rev=1302392&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigJMXService.java (added)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigJMXService.java Mon Mar 19 12:04:51 2012
@@ -0,0 +1,37 @@
+/**
+ * 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.hedwig.server.jmx;
+
+/**
+ * An implementor of this interface is basiclly responsible for jmx beans.
+ */
+public interface HedwigJMXService {
+    /**
+     * register jmx
+     *
+     * @param parent
+     *          Parent JMX Bean
+     */
+    public void registerJMX(HedwigMBeanInfo parent);
+
+    /**
+     * unregister jmx
+     */
+    public void unregisterJMX();
+}

Added: zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanInfo.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanInfo.java?rev=1302392&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanInfo.java (added)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanInfo.java Mon Mar 19 12:04:51 2012
@@ -0,0 +1,27 @@
+/**
+ * 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.hedwig.server.jmx;
+
+import org.apache.zookeeper.jmx.ZKMBeanInfo;
+
+/**
+ * Hedwig MBean info interface.
+ */
+public interface HedwigMBeanInfo extends ZKMBeanInfo {
+}

Added: zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanRegistry.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanRegistry.java?rev=1302392&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanRegistry.java (added)
+++ zookeeper/bookkeeper/trunk/hedwig-server/src/main/java/org/apache/hedwig/server/jmx/HedwigMBeanRegistry.java Mon Mar 19 12:04:51 2012
@@ -0,0 +1,48 @@
+/**
+ * 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.hedwig.server.jmx;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.bookkeeper.jmx.BKMBeanRegistry;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class provides a unified interface for registering/unregistering of
+ * Hedwig MBeans with the platform MBean server.
+ */
+public class HedwigMBeanRegistry extends BKMBeanRegistry {
+
+    static final String SERVICE = "org.apache.HedwigServer";
+
+    static HedwigMBeanRegistry instance = new HedwigMBeanRegistry();
+
+    public static HedwigMBeanRegistry getInstance(){
+        return instance;
+    }
+
+    @Override
+    protected String getDomainName() {
+        return SERVICE;
+    }
+
+}