diff options
author | Diego <diegolparra@gmail.com> | 2014-07-22 16:45:42 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-07-22 16:45:42 -0300 |
commit | f1d995350013ff8ba5e4f4f09bcb023fae347610 (patch) | |
tree | ee490101701e136fddbbcc6c116282cd9a5526e2 /kamon-system-metrics/src/main/scala/kamon/system/native/SigarLoader.scala | |
parent | 5c141733ad39cf2730cf34dc8f3f4a82f0c1b516 (diff) | |
download | Kamon-f1d995350013ff8ba5e4f4f09bcb023fae347610.tar.gz Kamon-f1d995350013ff8ba5e4f4f09bcb023fae347610.tar.bz2 Kamon-f1d995350013ff8ba5e4f4f09bcb023fae347610.zip |
= kamon-system-metrics: SynchronizedSigar in order to share the same instance
Diffstat (limited to 'kamon-system-metrics/src/main/scala/kamon/system/native/SigarLoader.scala')
-rw-r--r-- | kamon-system-metrics/src/main/scala/kamon/system/native/SigarLoader.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kamon-system-metrics/src/main/scala/kamon/system/native/SigarLoader.scala b/kamon-system-metrics/src/main/scala/kamon/system/native/SigarLoader.scala index 6af0a6d2..f1072f56 100644 --- a/kamon-system-metrics/src/main/scala/kamon/system/native/SigarLoader.scala +++ b/kamon-system-metrics/src/main/scala/kamon/system/native/SigarLoader.scala @@ -21,7 +21,8 @@ import java.util import java.util.logging.Logger import java.util.{ ArrayList, List } -import org.hyperic.sigar.{ SigarProxy, SigarProxyCache } +import kamon.system.SynchronizedSigar +import org.hyperic.sigar.SigarProxy import scala.annotation.tailrec import scala.collection.JavaConversions._ @@ -37,7 +38,7 @@ object SigarLoader { private val log = Logger.getLogger("SigarLoader") - def sigarProxy = init(new File(System.getProperty(TmpDir))) + lazy val sigarProxy = init(new File(System.getProperty(TmpDir))) private[native] def init(baseTmp: File): SigarProxy = { val tmpDir = createTmpDir(baseTmp) @@ -46,7 +47,7 @@ object SigarLoader { attachToLibraryPath(tmpDir) try { - val sigar = SigarProxyCache.newInstance() + val sigar = new SynchronizedSigar() sigar.getPid sigar } catch { |