From a74379942b2c672c9ba507093f27ead5693c1240 Mon Sep 17 00:00:00 2001 From: Diego Date: Tue, 13 Dec 2016 13:06:29 -0300 Subject: wip --- .../util/executors/ExecutorMetricRecorder.scala | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'kamon-core/src/main') diff --git a/kamon-core/src/main/scala/kamon/util/executors/ExecutorMetricRecorder.scala b/kamon-core/src/main/scala/kamon/util/executors/ExecutorMetricRecorder.scala index 732e189e..a4bca570 100644 --- a/kamon-core/src/main/scala/kamon/util/executors/ExecutorMetricRecorder.scala +++ b/kamon-core/src/main/scala/kamon/util/executors/ExecutorMetricRecorder.scala @@ -1,6 +1,6 @@ /* * ========================================================================================= - * Copyright © 2013-2015 the kamon project + * Copyright © 2013-2016 the kamon project * * 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 @@ -23,7 +23,7 @@ import kamon.util.executors.ForkJoinPools.ForkJoinMetrics import scala.concurrent.forkjoin.ForkJoinPool -object ForkJoinPools { +object ForkJoinPools extends ForkJoinLowPriority { trait ForkJoinMetrics[T] { def getParallelism(fjp: T): Long def getPoolSize(fjp: T): Long @@ -33,16 +33,6 @@ object ForkJoinPools { def getQueuedSubmissionCount(fjp: T): Long } - implicit object ScalaForkJoin extends ForkJoinMetrics[ForkJoinPool] { - def getParallelism(fjp: ForkJoinPool) = fjp.getParallelism - def getPoolSize(fjp: ForkJoinPool) = fjp.getPoolSize.toLong - def getRunningThreadCount(fjp: ForkJoinPool) = fjp.getActiveThreadCount.toLong - def getActiveThreadCount(fjp: ForkJoinPool) = fjp.getRunningThreadCount.toLong - def getQueuedTaskCount(fjp: ForkJoinPool) = fjp.getQueuedTaskCount - def getQueuedSubmissionCount(fjp: ForkJoinPool) = fjp.getQueuedSubmissionCount - - } - implicit object JavaForkJoin extends ForkJoinMetrics[JavaForkJoinPool] { def getParallelism(fjp: JavaForkJoinPool) = fjp.getParallelism def getPoolSize(fjp: JavaForkJoinPool) = fjp.getPoolSize.toLong @@ -50,7 +40,17 @@ object ForkJoinPools { def getActiveThreadCount(fjp: JavaForkJoinPool) = fjp.getRunningThreadCount.toLong def getQueuedTaskCount(fjp: JavaForkJoinPool) = fjp.getQueuedTaskCount def getQueuedSubmissionCount(fjp: JavaForkJoinPool) = fjp.getQueuedSubmissionCount + } +} +trait ForkJoinLowPriority { + implicit object ScalaForkJoin extends ForkJoinMetrics[ForkJoinPool] { + def getParallelism(fjp: ForkJoinPool) = fjp.getParallelism + def getPoolSize(fjp: ForkJoinPool) = fjp.getPoolSize.toLong + def getRunningThreadCount(fjp: ForkJoinPool) = fjp.getActiveThreadCount.toLong + def getActiveThreadCount(fjp: ForkJoinPool) = fjp.getRunningThreadCount.toLong + def getQueuedTaskCount(fjp: ForkJoinPool) = fjp.getQueuedTaskCount + def getQueuedSubmissionCount(fjp: ForkJoinPool) = fjp.getQueuedSubmissionCount } } @@ -96,4 +96,4 @@ object ThreadPoolExecutorMetrics { def category: String = cat def createRecorder(instrumentFactory: InstrumentFactory) = new ThreadPoolExecutorMetrics(tpe, instrumentFactory) } -} \ No newline at end of file +} -- cgit v1.2.3