Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala 2.13: ScalaRunnableWrapper uses akka.dispatch.Batchable #311

Open
iRevive opened this issue Mar 16, 2023 · 0 comments
Open

Scala 2.13: ScalaRunnableWrapper uses akka.dispatch.Batchable #311

iRevive opened this issue Mar 16, 2023 · 0 comments

Comments

@iRevive
Copy link
Contributor

iRevive commented Mar 16, 2023

Hello! Thanks for the awesome library.

I have a question regarding ScalaRunnableWrapper for Scala 2.13:

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.

case runnable: Batchable => new BatchableWrapper(runnable, _)

If I get it right, the case case ScalaRunnableWrapper(runnable) => runnable(r) will never happen.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant