* Add Java API 'getRef' to 'Terminated' (#22985) * Expose `ActorRef[Nothing]` as `ActorRef[Void]` in Java API * Expose `ActorRef[Void]` as Java API for more objects
This commit is contained in:
parent
194b223ee0
commit
f038d16ac9
2 changed files with 13 additions and 3 deletions
|
|
@ -43,7 +43,7 @@ public class BehaviorBuilderTest extends JUnitSuite {
|
|||
return Actor.<Message>same();
|
||||
})
|
||||
.onSignal(Terminated.class, (ctx, t) -> {
|
||||
System.out.println("Terminating along with " + t.ref());
|
||||
System.out.println("Terminating along with " + t.getRef());
|
||||
return stopped();
|
||||
})
|
||||
.build();
|
||||
|
|
|
|||
|
|
@ -7,12 +7,18 @@ package akka.typed
|
|||
* Envelope that is published on the eventStream for every message that is
|
||||
* dropped due to overfull queues.
|
||||
*/
|
||||
final case class Dropped(msg: Any, recipient: ActorRef[Nothing])
|
||||
final case class Dropped(msg: Any, recipient: ActorRef[Nothing]) {
|
||||
/** Java API */
|
||||
def getRecipient(): ActorRef[Void] = recipient.asInstanceOf[ActorRef[Void]]
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception that an actor fails with if it does not handle a Terminated message.
|
||||
*/
|
||||
final case class DeathPactException(ref: ActorRef[Nothing]) extends RuntimeException(s"death pact with $ref was triggered")
|
||||
final case class DeathPactException(ref: ActorRef[Nothing]) extends RuntimeException(s"death pact with $ref was triggered") {
|
||||
/** Java API */
|
||||
def getRef(): ActorRef[Void] = ref.asInstanceOf[ActorRef[Void]]
|
||||
}
|
||||
|
||||
/**
|
||||
* Envelope for dead letters.
|
||||
|
|
@ -63,4 +69,8 @@ final case class Terminated(ref: ActorRef[Nothing])(failed: Throwable) extends S
|
|||
def wasFailed: Boolean = failed ne null
|
||||
def failure: Throwable = failed
|
||||
def failureOption: Option[Throwable] = Option(failed)
|
||||
|
||||
/** Java API */
|
||||
def getRef(): ActorRef[Void] = ref.asInstanceOf[ActorRef[Void]]
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue