+abstract class LeaderLocalDelegateFactory<M, D, I> extends DelegateFactory<M, D, I> {
+ private final Shard shard;
+
+ protected LeaderLocalDelegateFactory(final Shard shard) {
+ this.shard = Preconditions.checkNotNull(shard);
+ }
+
+ protected final ActorRef getSelf() {
+ return shard.getSelf();
+ }
+
+ protected final Shard getShard() {
+ return shard;
+ }
+
+ protected final String persistenceId() {
+ return shard.persistenceId();
+ }
+
+ protected final void tellSender(final Object message) {
+ shard.getSender().tell(message, getSelf());
+ }
+
+ protected final ActorRef createActor(final Props props) {
+ return shard.getContext().actorOf(props);
+ }
+
+ protected final ActorSelection selectActor(ActorRef ref) {
+ return shard.getContext().system().actorSelection(ref.path());
+ }
+
+ protected final ActorSelection selectActor(ActorPath path) {
+ return shard.getContext().system().actorSelection(path);
+ }
+