Untyped actor systems currently only support specifying dispatchers via a name reference to the config. The other selectors can be revived when other ways of configuring dispatchers are available for untyped actor systems (see #17568).
This commit is contained in:
parent
ab76b6b64d
commit
fef57ea034
3 changed files with 4 additions and 60 deletions
|
|
@ -10,7 +10,4 @@ public class DispatcherSelectorTest {
|
||||||
|
|
||||||
private DispatcherSelector def = DispatcherSelector.defaultDispatcher();
|
private DispatcherSelector def = DispatcherSelector.defaultDispatcher();
|
||||||
private DispatcherSelector conf = DispatcherSelector.fromConfig("somepath");
|
private DispatcherSelector conf = DispatcherSelector.fromConfig("somepath");
|
||||||
private DispatcherSelector ex = DispatcherSelector.fromExecutor((Executor) null);
|
|
||||||
private DispatcherSelector ec = DispatcherSelector.fromExecutionContext((ExecutionContext) null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,11 @@
|
||||||
*/
|
*/
|
||||||
package akka.actor.typed
|
package akka.actor.typed
|
||||||
|
|
||||||
import java.util.concurrent.Executor
|
import akka.annotation.ApiMayChange
|
||||||
|
import akka.annotation.DoNotInherit
|
||||||
import akka.annotation.{ ApiMayChange, DoNotInherit, InternalApi }
|
import akka.annotation.InternalApi
|
||||||
|
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
import scala.concurrent.ExecutionContext
|
|
||||||
import scala.reflect.ClassTag
|
import scala.reflect.ClassTag
|
||||||
|
|
||||||
object Props {
|
object Props {
|
||||||
|
|
@ -68,16 +67,6 @@ abstract class Props private[akka] () extends Product with Serializable {
|
||||||
*/
|
*/
|
||||||
def withDispatcherFromConfig(path: String): Props = DispatcherFromConfig(path, this)
|
def withDispatcherFromConfig(path: String): Props = DispatcherFromConfig(path, this)
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepend a selection of the given executor to this Props.
|
|
||||||
*/
|
|
||||||
def withDispatcherFromExecutor(executor: Executor): Props = DispatcherFromExecutor(executor, this)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepend a selection of the given execution context to this Props.
|
|
||||||
*/
|
|
||||||
def withDispatcherFromExecutionContext(ec: ExecutionContext): Props = DispatcherFromExecutionContext(ec, this)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the first occurrence of a configuration node of the given type, falling
|
* Find the first occurrence of a configuration node of the given type, falling
|
||||||
* back to the provided default if none is found.
|
* back to the provided default if none is found.
|
||||||
|
|
@ -149,7 +138,7 @@ private[akka] case object EmptyProps extends Props {
|
||||||
* Not intended for user extension.
|
* Not intended for user extension.
|
||||||
*/
|
*/
|
||||||
@DoNotInherit
|
@DoNotInherit
|
||||||
abstract class DispatcherSelector extends Props
|
sealed abstract class DispatcherSelector extends Props
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factories for [[DispatcherSelector]]s which describe which thread pool shall be used to run
|
* Factories for [[DispatcherSelector]]s which describe which thread pool shall be used to run
|
||||||
|
|
@ -179,20 +168,6 @@ object DispatcherSelector {
|
||||||
* ActorSystem terminates.
|
* ActorSystem terminates.
|
||||||
*/
|
*/
|
||||||
def fromConfig(path: String): DispatcherSelector = DispatcherFromConfig(path)
|
def fromConfig(path: String): DispatcherSelector = DispatcherFromConfig(path)
|
||||||
|
|
||||||
/**
|
|
||||||
* Directly use the given Executor whenever the actor needs to be run.
|
|
||||||
* No attempt will be made to shut down this thread pool when the [[ActorSystem]] terminates.
|
|
||||||
*/
|
|
||||||
def fromExecutor(executor: Executor): DispatcherSelector = DispatcherFromExecutor(executor)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Directly use the given ExecutionContext whenever the actor needs to be run.
|
|
||||||
* No attempt will be made to shut down this thread pool when the [[ActorSystem]] terminates.
|
|
||||||
*/
|
|
||||||
def fromExecutionContext(executionContext: ExecutionContext): DispatcherSelector =
|
|
||||||
DispatcherFromExecutionContext(executionContext)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -226,27 +201,3 @@ object DispatcherDefault {
|
||||||
private[akka] final case class DispatcherFromConfig(path: String, next: Props = Props.empty) extends DispatcherSelector {
|
private[akka] final case class DispatcherFromConfig(path: String, next: Props = Props.empty) extends DispatcherSelector {
|
||||||
override def withNext(next: Props): Props = copy(next = next)
|
override def withNext(next: Props): Props = copy(next = next)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Directly use the given Executor whenever the actor needs to be run.
|
|
||||||
* No attempt will be made to shut down this thread pool, even if it is an
|
|
||||||
* instance of ExecutorService.
|
|
||||||
*
|
|
||||||
* INTERNAL API
|
|
||||||
*/
|
|
||||||
@InternalApi
|
|
||||||
private[akka] final case class DispatcherFromExecutor(executor: Executor, next: Props = Props.empty) extends DispatcherSelector {
|
|
||||||
override def withNext(next: Props): Props = copy(next = next)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Directly use the given ExecutionContext whenever the actor needs to be run.
|
|
||||||
* No attempt will be made to shut down this thread pool, even if it is an
|
|
||||||
* instance of ExecutorService.
|
|
||||||
*
|
|
||||||
* INTERNAL API
|
|
||||||
*/
|
|
||||||
@InternalApi
|
|
||||||
private[akka] final case class DispatcherFromExecutionContext(ec: ExecutionContext, next: Props = Props.empty) extends DispatcherSelector {
|
|
||||||
override def withNext(next: Props): Props = copy(next = next)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,6 @@ import scala.compat.java8.FutureConverters
|
||||||
selector match {
|
selector match {
|
||||||
case DispatcherDefault(_) ⇒ untyped.dispatcher
|
case DispatcherDefault(_) ⇒ untyped.dispatcher
|
||||||
case DispatcherFromConfig(str, _) ⇒ untyped.dispatchers.lookup(str)
|
case DispatcherFromConfig(str, _) ⇒ untyped.dispatchers.lookup(str)
|
||||||
case DispatcherFromExecutionContext(_, _) ⇒
|
|
||||||
throw new UnsupportedOperationException("Cannot use DispatcherFromExecutionContext with ActorSystemAdapter")
|
|
||||||
case DispatcherFromExecutor(_, _) ⇒
|
|
||||||
throw new UnsupportedOperationException("Cannot use DispatcherFromExecutor with ActorSystemAdapter")
|
|
||||||
}
|
}
|
||||||
override def shutdown(): Unit = () // there was no shutdown in untyped Akka
|
override def shutdown(): Unit = () // there was no shutdown in untyped Akka
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue