actor: allow seamless access to untyped extensions given typed ActorSystem (#28294)
* actor: allow seamless access to untyped extensions given typed ActorSystem * add overrides with concrete type for Java API everywhere
This commit is contained in:
parent
2c96a57d89
commit
702b6a7f41
70 changed files with 192 additions and 49 deletions
|
|
@ -10,7 +10,6 @@ import akka.actor.typed.ActorSystem;
|
|||
import akka.actor.typed.Behavior;
|
||||
import akka.actor.typed.javadsl.AbstractBehavior;
|
||||
import akka.actor.typed.javadsl.ActorContext;
|
||||
import akka.actor.typed.javadsl.Adapter;
|
||||
import akka.actor.typed.javadsl.Behaviors;
|
||||
import akka.actor.typed.javadsl.Receive;
|
||||
import akka.actor.typed.javadsl.AskPattern;
|
||||
|
|
@ -31,7 +30,7 @@ public interface ResumableProjectionExample {
|
|||
throws Exception {
|
||||
|
||||
final MyJavadslReadJournal readJournal =
|
||||
PersistenceQuery.get(Adapter.toClassic(system))
|
||||
PersistenceQuery.get(system)
|
||||
.getReadJournalFor(
|
||||
MyJavadslReadJournal.class, "akka.persistence.query.my-read-journal");
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
package docs.extension
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
import akka.actor.Actor
|
||||
import akka.actor.ClassicActorSystemProvider
|
||||
import akka.testkit.AkkaSpec
|
||||
|
||||
//#extension
|
||||
|
|
@ -42,6 +44,7 @@ object CountExtension extends ExtensionId[CountExtensionImpl] with ExtensionIdPr
|
|||
* Java API: retrieve the Count extension for the given system.
|
||||
*/
|
||||
override def get(system: ActorSystem): CountExtensionImpl = super.get(system)
|
||||
override def get(system: ClassicActorSystemProvider): CountExtensionImpl = super.get(system)
|
||||
}
|
||||
//#extensionid
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,13 @@ import akka.actor.Extension
|
|||
import akka.actor.ExtensionId
|
||||
import akka.actor.ExtensionIdProvider
|
||||
import akka.actor.ExtendedActorSystem
|
||||
|
||||
import scala.concurrent.duration.Duration
|
||||
import com.typesafe.config.Config
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
import akka.actor.ClassicActorSystemProvider
|
||||
|
||||
//#imports
|
||||
|
||||
import akka.actor.Actor
|
||||
|
|
@ -39,6 +42,7 @@ object Settings extends ExtensionId[SettingsImpl] with ExtensionIdProvider {
|
|||
* Java API: retrieve the Settings extension for the given system.
|
||||
*/
|
||||
override def get(system: ActorSystem): SettingsImpl = super.get(system)
|
||||
override def get(system: ClassicActorSystemProvider): SettingsImpl = super.get(system)
|
||||
}
|
||||
//#extensionid
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue