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

ASF GitHub Bot commented on STORM-1611:
---------------------------------------

Github user redsanket commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1195#discussion_r56659070
  
    --- Diff: storm-core/src/jvm/org/apache/storm/pacemaker/Pacemaker.java ---
    @@ -0,0 +1,372 @@
    +/**
    + * 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.storm.pacemaker;
    +
    +import org.apache.storm.generated.HBMessage;
    +import org.apache.storm.generated.HBMessageData;
    +import org.apache.storm.generated.HBPulse;
    +import org.apache.storm.generated.HBNodes;
    +import org.apache.storm.generated.HBServerMessageType;
    +import org.apache.storm.utils.ConfigUtils;
    +import org.apache.storm.utils.Utils;
    +import org.apache.storm.utils.VersionInfo;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4J;
    +
    +
    +import javax.management.*;
    +import java.lang.management.ManagementFactory;
    +import java.util.ArrayList;
    +import java.util.HashSet;
    +import java.util.Map;
    +import java.util.Set;
    +import java.util.concurrent.Callable;
    +import java.util.concurrent.ConcurrentHashMap;
    +import java.util.concurrent.atomic.AtomicInteger;
    +
    +public class Pacemaker implements IServerMessageHandler {
    +
    +    private static final Logger LOG = 
LoggerFactory.getLogger(Pacemaker.class);
    +
    +    private Map<String, byte[]> heartbeats;
    +    private PacemakerStats lastOneMinStats;
    +    private PacemakerStats pacemakerStats;
    +    private Map conf;
    +    private final long sleepSeconds = 60;
    +
    +    private boolean isDaemon = true;
    +    private boolean startImmediately = true;
    +
    +    private static class PacemakerStats {
    +        public AtomicInteger sendPulseCount = new AtomicInteger();
    +        public AtomicInteger totalReceivedSize = new AtomicInteger();
    +        public AtomicInteger getPulseCount = new AtomicInteger();
    +        public AtomicInteger totalSentSize = new AtomicInteger();
    +        public AtomicInteger largestHeartbeatSize = new AtomicInteger();
    +        public AtomicInteger averageHeartbeatSize = new AtomicInteger();
    +        private AtomicInteger totalKeys = new AtomicInteger();
    +    }
    +    private static class PaceMakerDynamicMBean implements DynamicMBean{
    +
    +        private final MBeanInfo mBeanInfo;
    +        private final static String [] attributeNames = new String []{
    +                "send-pulse-count",
    +                "total-received-size",
    +                "get-pulse-count",
    +                "total-sent-size",
    +                "largest-heartbeat-size",
    +                "average-heartbeat-size",
    +                "total-keys"
    +        };
    +        private static String attributeType = 
"java.util.concurrent.atomic.AtomicInteger";
    +
    +        private static final MBeanAttributeInfo[] attributeInfos = new 
MBeanAttributeInfo[] { 
    +                        new MBeanAttributeInfo("send-pulse-count", 
attributeType, "send-pulse-count", true, false, false),
    +                        new MBeanAttributeInfo("total-received-size", 
attributeType, "total-received-size", true, false, false),
    +                        new MBeanAttributeInfo("get-pulse-count", 
attributeType, "get-pulse-count", true, false, false),
    +                        new MBeanAttributeInfo("total-sent-size", 
attributeType, "total-sent-size", true, false, false),
    +                        new MBeanAttributeInfo("largest-heartbeat-size", 
attributeType, "largest-heartbeat-size", true, false, false),
    +                        new MBeanAttributeInfo("average-heartbeat-size", 
attributeType, "average-heartbeat-size", true, false, false),
    +                        new MBeanAttributeInfo("total-keys", 
attributeType, "total-keys", true, false, false)
    +        };
    +        private PacemakerStats stats;
    +
    +        public PaceMakerDynamicMBean(PacemakerStats stats) {
    --- End diff --
    
    minor nit "Pacemaker" instead of "PaceMaker"


> port org.apache.storm.pacemaker.pacemaker to java
> -------------------------------------------------
>
>                 Key: STORM-1611
>                 URL: https://issues.apache.org/jira/browse/STORM-1611
>             Project: Apache Storm
>          Issue Type: New Feature
>            Reporter: John Fang
>            Assignee: John Fang
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to