- //format and pattern should be in sync
- private final String format = "%s-shard-%s-%s";
- private static final Pattern pattern = Pattern.compile("(\\S+)-shard-(\\S+)-(\\S+)");
+ private ShardIdentifier(String shardName, MemberName memberName, String type) {
+ this.shardName = Preconditions.checkNotNull(shardName, "shardName should not be null");
+ this.memberName = Preconditions.checkNotNull(memberName, "memberName should not be null");
+ this.type = Preconditions.checkNotNull(type, "type should not be null");
+
+ fullName = memberName.getName() + "-shard-" + shardName + "-" + type;
+ }