Make ClassicActorSystemProvider.classicSystem public API

See @28818
This commit is contained in:
Enno Runne 2020-03-31 09:42:55 +02:00
parent 89f920a198
commit 27b1c73d90
5 changed files with 9 additions and 15 deletions

View file

@ -66,7 +66,7 @@ import org.slf4j.LoggerFactory
override def provider: ActorRefProvider = throw new UnsupportedOperationException("no provider")
// stream materialization etc. using stub not supported
override private[akka] def classicSystem =
override def classicSystem =
throw new UnsupportedOperationException("no classic actor system available")
// impl InternalRecipientRef

View file

@ -51,7 +51,7 @@ import org.slf4j.{ Logger, LoggerFactory }
import ActorRefAdapter.sendSystemMessage
override private[akka] def classicSystem: classic.ActorSystem = system
override def classicSystem: classic.ActorSystem = system
// Members declared in akka.actor.typed.ActorRef
override def tell(msg: T): Unit = {
@ -155,12 +155,5 @@ private[akka] object ActorSystemAdapter {
new LoadTypedExtensions(system)
}
def toClassic[U](sys: ActorSystem[_]): classic.ActorSystem =
sys match {
case adapter: ActorSystemAdapter[_] => adapter.classicSystem
case _ =>
throw new UnsupportedOperationException(
"Only adapted classic ActorSystem permissible " +
s"($sys of class ${sys.getClass.getName})")
}
def toClassic[U](sys: ActorSystem[_]): classic.ActorSystem = sys.classicSystem
}

View file

@ -74,7 +74,7 @@ package object adapter {
* Extension methods added to [[akka.actor.typed.ActorSystem]].
*/
implicit class TypedActorSystemOps(val sys: ActorSystem[_]) extends AnyVal {
def toClassic: akka.actor.ActorSystem = ActorSystemAdapter.toClassic(sys)
def toClassic: akka.actor.ActorSystem = sys.classicSystem
/**
* INTERNAL API

View file

@ -976,7 +976,7 @@ private[akka] class ActorSystemImpl(
def /(actorName: String): ActorPath = guardian.path / actorName
def /(path: Iterable[String]): ActorPath = guardian.path / path
override private[akka] def classicSystem: ActorSystem = this
override def classicSystem: ActorSystem = this
// Used for ManifestInfo.checkSameVersion
private def allModules: List[String] =

View file

@ -15,9 +15,10 @@ import akka.annotation.InternalApi
@DoNotInherit
trait ClassicActorSystemProvider {
/** INTERNAL API */
@InternalApi
private[akka] def classicSystem: ActorSystem
/**
* Allows access to the classic `akka.actor.ActorSystem` even for `akka.actor.typed.ActorSystem[_]`s.
*/
def classicSystem: ActorSystem
}
/**