super(builder);
}
- @Override
- public void handleCommand(Object message) throws Exception {
- if (GetLocalShards.INSTANCE.equals(message)) {
- sender().tell(new GetLocalShardsReply(localShards), null);
- } else {
- super.handleCommand(message);
- }
- }
-
/**
* Plug into shard actor creation to replace info with our testing one.
* @param info shard info.
*/
@Override
protected ActorRef newShardActor(ShardInformation info) {
- Map<String, String> peerAddresses = getPeerAddresses(info.getShardName());
ShardInformation newInfo = new ShardInformation(info.getShardName(),
- info.getShardId(), peerAddresses,
+ info.getShardId(), getPeerAddresses(info.getShardName()),
info.getDatastoreContext(),
- TestShard.builder()
- .restoreFromSnapshot(info.getBuilder().getRestoreFromSnapshot()),
+ TestShard.builder().restoreFromSnapshot(info.getBuilder().getRestoreFromSnapshot()),
peerAddressResolver);
newInfo.setSchemaContext(info.getSchemaContext());
newInfo.setActiveMember(info.isActiveMember());
return Props.create(TestShardManager.class, this);
}
}
-
- public static final class GetLocalShards {
- public static final GetLocalShards INSTANCE = new GetLocalShards();
-
- private GetLocalShards() {
-
- }
- }
-
- public static class GetLocalShardsReply {
-
- private final Map<String, ShardInformation> localShards;
-
- public GetLocalShardsReply(Map<String, ShardInformation> localShards) {
- this.localShards = localShards;
- }
-
- public Map<String, ShardInformation> getLocalShards() {
- return localShards;
- }
- }
}