diff options
author | Diego <diegolparra@gmail.com> | 2014-07-23 21:01:27 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-07-23 21:01:27 -0300 |
commit | c7a6d66636518a73cae4b79f20e1737f3f02e2ec (patch) | |
tree | 1d64840a058f9f3510e23e5c1530f50272b31461 /kamon-system-metrics/src/main/java/kamon/system | |
parent | c1157ec8812d8ac7522910df105400050d521000 (diff) | |
download | Kamon-c7a6d66636518a73cae4b79f20e1737f3f02e2ec.tar.gz Kamon-c7a6d66636518a73cae4b79f20e1737f3f02e2ec.tar.bz2 Kamon-c7a6d66636518a73cae4b79f20e1737f3f02e2ec.zip |
= kamon-system-metrics: Initialization-on-demand holder idiom in order to load one instance of Sigar
Diffstat (limited to 'kamon-system-metrics/src/main/java/kamon/system')
-rw-r--r-- | kamon-system-metrics/src/main/java/kamon/system/SigarHolder.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kamon-system-metrics/src/main/java/kamon/system/SigarHolder.java b/kamon-system-metrics/src/main/java/kamon/system/SigarHolder.java new file mode 100644 index 00000000..d00750df --- /dev/null +++ b/kamon-system-metrics/src/main/java/kamon/system/SigarHolder.java @@ -0,0 +1,30 @@ +/* + * ========================================================================================= + * Copyright © 2013-2014 the kamon project <http://kamon.io/> + * + * Licensed 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 kamon.system; + +import kamon.system.sigar.SigarLoader; +import org.hyperic.sigar.SigarProxy; + +public class SigarHolder { + private static class LazySigarHolder { + static final SigarProxy instance = SigarLoader.sigarProxy(); + } + + public static SigarProxy instance() { + return LazySigarHolder.instance; + } +} |