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

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_r56387356
  
    --- Diff: storm-core/src/clj/org/apache/storm/pacemaker/pacemaker.clj ---
    @@ -1,242 +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.
    -
    -(ns org.apache.storm.pacemaker.pacemaker
    -  (:import [org.apache.storm.pacemaker PacemakerServer 
IServerMessageHandler]
    -           [java.util.concurrent ConcurrentHashMap]
    -           [java.util.concurrent.atomic AtomicInteger]
    -           [org.apache.storm.generated HBNodes
    -            HBServerMessageType HBMessage HBMessageData HBPulse]
    -           [org.apache.storm.utils VersionInfo ConfigUtils]
    -           [uk.org.lidalia.sysoutslf4j.context SysOutOverSLF4J])
    -  (:use [clojure.string :only [replace-first split]]
    -        [org.apache.storm log config util])
    -  (:require [clojure.java.jmx :as jmx])
    -  (:gen-class))
    -
    -(def STORM-VERSION (VersionInfo/getVersion))
    -
    -;; Stats Functions
    -
    -(def sleep-seconds 60)
    -
    -
    -(defn- check-and-set-loop [stats key new & {:keys [compare new-fn]
    -                                            :or {compare (fn [new old] 
true)
    -                                                 new-fn (fn [new old] 
new)}}]
    -  (loop []
    -    (let [old (.get (key stats))
    -          new (new-fn new old)]
    -      (if (compare new old)
    -        (if (.compareAndSet (key stats) old new)
    -          nil
    -          (recur))
    -        nil))))
    -
    -(defn- set-average [stats size]
    -  (check-and-set-loop
    -   stats
    -   :average-heartbeat-size
    -   size
    -   :new-fn (fn [new old]
    -            (let [count (.get (:send-pulse-count stats))]
    -                                        ; Weighted average
    -              (/ (+ new (* count old)) (+ count 1))))))
    -
    -(defn- set-largest [stats size]
    -  (check-and-set-loop
    -   stats
    -   :largest-heartbeat-size
    -   size
    -   :compare #'>))
    -
    -(defn- report-stats [heartbeats stats last-five-s]
    -  (loop []
    -    (let [send-count (.getAndSet (:send-pulse-count stats) 0)
    -          received-size (.getAndSet (:total-received-size stats) 0)
    -          get-count (.getAndSet (:get-pulse-count stats) 0)
    -          sent-size (.getAndSet (:total-sent-size stats) 0)
    -          largest (.getAndSet (:largest-heartbeat-size stats) 0)
    -          average (.getAndSet (:average-heartbeat-size stats) 0)
    -          total-keys (.size heartbeats)]
    -      (log-debug "\nReceived " send-count " heartbeats totaling " 
received-size " bytes,\n"
    -                 "Sent " get-count " heartbeats totaling " sent-size " 
bytes,\n"
    -                 "The largest heartbeat was " largest " bytes,\n"
    -                 "The average heartbeat was " average " bytes,\n"
    -                 "Pacemaker contained " total-keys " total keys\n"
    -                 "in the last " sleep-seconds " second(s)")
    -      (dosync (ref-set last-five-s
    -                       {:send-pulse-count send-count
    -                        :total-received-size received-size
    -                        :get-pulse-count get-count
    -                        :total-sent-size sent-size
    -                        :largest-heartbeat-size largest
    -                        :average-heartbeat-size average
    -                        :total-keys total-keys})))
    -    (Thread/sleep (* 1000 sleep-seconds))
    -    (recur)))
    -
    -;; JMX stuff
    -(defn register [last-five-s]
    -  (jmx/register-mbean
    -    (jmx/create-bean
    -      last-five-s)
    -    "org.apache.storm.pacemaker.pacemaker:stats=Stats_Last_5_Seconds"))
    --- End diff --
    
    Just curious where is the jmx related code implemented. Am I missing 
something or is it implemented else where


> 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