-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Hello! Thanks for the awesome library.
I have a question regarding ScalaRunnableWrapper for Scala 2.13:
akka-sensors/sensors-core/src/main/scala-2.13/akka/sensors/dispatch/ScalaRunnableWrapper.scala
Lines 3 to 16 in 82f28d1
| import akka.dispatch.Batchable | |
| import akka.sensors.dispatch.DispatcherInstrumentationWrapper.Run | |
| import scala.PartialFunction.condOpt | |
| object ScalaRunnableWrapper { | |
| def unapply(runnable: Runnable): Option[Run => Runnable] = | |
| condOpt(runnable) { | |
| case runnable: Batchable => new OverrideBatchable(runnable, _) | |
| } | |
| class OverrideBatchable(self: Runnable, r: Run) extends Batchable with Runnable { | |
| def run(): Unit = r(() => self.run()) | |
| def isBatchable: Boolean = true |
According to the code, the match expects the akka.dispatch.Batchable type. Then, AkkaRunnableWrapper relies on akka.dispatch.Batchable too.
akka-sensors/sensors-core/src/main/scala/akka/sensors/dispatch/InstrumentedDispatchers.scala
Line 61 in 82f28d1
| case runnable: Batchable => new BatchableWrapper(runnable, _) |
If I get it right, the case case ScalaRunnableWrapper(runnable) => runnable(r) will never happen.
akka-sensors/sensors-core/src/main/scala/akka/sensors/dispatch/InstrumentedDispatchers.scala
Lines 106 to 111 in 82f28d1
| def apply(runnableParam: Runnable, r: Run): Runnable = | |
| runnableParam match { | |
| case AkkaRunnableWrapper(runnable) => runnable(r) | |
| case ScalaRunnableWrapper(runnable) => runnable(r) | |
| case runnable => new Default(runnable, r) | |
| } |
I assume, ScalaRunnerWrapper should import scala.concurrent.Batchable instead?