[ 
https://issues.apache.org/jira/browse/HADOOP-12908?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Zhuge updated HADOOP-12908:
--------------------------------
    Attachment: HADOOP-12908-001.patch

Patch 001:
* Make JvmPauseMonitor a singleton
* Inherit JvmPauseMonitor from a new class AbstractSingletonService which 
allows a service to shared by multiple owners and makes sure 
{{serviceInit/serviceStart/serviceStop}} is only called once.
* Move JvmPauseMonitor related test cases from TestJvmMetrics to a new 
TestJvmPauseMonitor

Passed test 
{{TestMiniDFSCluster,TestMiniYarnCluster,TestJvmMetrics,TestJvmPauseMonitor}}.

> Make JvmPauseMonitor a singleton
> --------------------------------
>
>                 Key: HADOOP-12908
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12908
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 2.7.2
>            Reporter: John Zhuge
>            Assignee: John Zhuge
>            Priority: Minor
>         Attachments: HADOOP-12908-001.patch
>
>
> Make JvmPauseMonitor a singleton just as JvmMetrics because there is no use 
> case to run multiple instances per JVM. No need for 
> {{TestMetrics$setPauseMonitor}} any more. Initialization code can be 
> simplified.
> For example, this code segment
> {noformat}
>     pauseMonitor = new JvmPauseMonitor();
>     addService(pauseMonitor);
>     jm.setPauseMonitor(pauseMonitor);
> {noformat}
> becomes
> {noformat}
>     addService(JvmPauseMonitor.INSTANCE);
> {noformat}
> And this code segment
> {noformat}
>       pauseMonitor = new JvmPauseMonitor();
>       pauseMonitor.init(config);
>       pauseMonitor.start();
>       metrics.getJvmMetrics().setPauseMonitor(pauseMonitor);
> {noformat}
> becomes
> {noformat}
>       pauseMonitor.INSTANCE.init(config);
>       pauseMonitor.INSTANCE.start();
> {noformat}



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

Reply via email to