@Test public void testGetShardActorAddress() { ShardPeerAddressResolver resolver = new ShardPeerAddressResolver("config", MEMBER_1); assertEquals("getShardActorAddress", null, resolver.getShardActorAddress("default", MEMBER_2)); Address address2 = new Address("tcp", "system2"); resolver.addPeerAddress(MEMBER_2, address2); assertEquals("getPeerAddress", address2, resolver.getPeerAddress(MEMBER_2)); Address address3 = new Address("tcp", "system3"); resolver.addPeerAddress(MEMBER_3, address3); assertEquals("getPeerAddress", address3, resolver.getPeerAddress(MEMBER_3)); assertEquals("getShardActorAddress", address2.toString() + "/user/shardmanager-config/member-2-shard-default-config", resolver.getShardActorAddress("default", MEMBER_2)); assertEquals("getShardActorAddress", address3.toString() + "/user/shardmanager-config/member-3-shard-default-config", resolver.getShardActorAddress("default", MEMBER_3)); assertEquals("getShardActorAddress", address2.toString() + "/user/shardmanager-config/member-2-shard-topology-config", resolver.getShardActorAddress("topology", MEMBER_2)); resolver.removePeerAddress(MEMBER_2); assertEquals("getShardActorAddress", null, resolver.getShardActorAddress("default", MEMBER_2)); assertEquals("getShardActorAddress", null, resolver.getShardActorAddress("topology", MEMBER_2)); assertEquals("getShardActorAddress", address3.toString() + "/user/shardmanager-config/member-3-shard-default-config", resolver.getShardActorAddress("default", MEMBER_3)); }
String getShardActorAddress(final String shardName, final MemberName memberName) { Address memberAddress = memberNameToAddress.get(memberName); if (memberAddress != null) { return getShardManagerActorPathBuilder(memberAddress).append("/").append( getShardIdentifier(memberName, shardName)).toString(); } return null; }
ShardPeerAddressResolver implements PeerAddressResolver { String getShardActorAddress(final String shardName, final MemberName memberName) { Address memberAddress = memberNameToAddress.get(memberName); if (memberAddress != null) { return getShardManagerActorPathBuilder(memberAddress).append("/").append( getShardIdentifier(memberName, shardName)).toString(); } return null; } }
ShardPeerAddressResolver implements PeerAddressResolver { String getShardActorAddress(final String shardName, final MemberName memberName) { Address memberAddress = memberNameToAddress.get(memberName); if (memberAddress != null) { return getShardManagerActorPathBuilder(memberAddress).append("/").append( getShardIdentifier(memberName, shardName)).toString(); } return null; } ShardPeerAddressResolver(final String shardManagerType, final MemberName localMemberName); }
ShardPeerAddressResolver implements PeerAddressResolver { String getShardActorAddress(final String shardName, final MemberName memberName) { Address memberAddress = memberNameToAddress.get(memberName); if (memberAddress != null) { return getShardManagerActorPathBuilder(memberAddress).append("/").append( getShardIdentifier(memberName, shardName)).toString(); } return null; } ShardPeerAddressResolver(final String shardManagerType, final MemberName localMemberName); @Override String resolve(final String peerId); @Override void setResolved(final String peerId, final String address); }
ShardPeerAddressResolver implements PeerAddressResolver { String getShardActorAddress(final String shardName, final MemberName memberName) { Address memberAddress = memberNameToAddress.get(memberName); if (memberAddress != null) { return getShardManagerActorPathBuilder(memberAddress).append("/").append( getShardIdentifier(memberName, shardName)).toString(); } return null; } ShardPeerAddressResolver(final String shardManagerType, final MemberName localMemberName); @Override String resolve(final String peerId); @Override void setResolved(final String peerId, final String address);  }