private static final Timeout MESSAGE_TIMEOUT = new Timeout(1, TimeUnit.MINUTES);
private final DistributedDataStore datastore;
+ private final EntityOwnerSelectionStrategyConfig strategyConfig;
private final ConcurrentMap<Entity, Entity> registeredEntities = new ConcurrentHashMap<>();
private volatile ActorRef localEntityOwnershipShard;
private volatile DataTree localEntityOwnershipShardDataTree;
- public DistributedEntityOwnershipService(DistributedDataStore datastore) {
- this.datastore = datastore;
+ public DistributedEntityOwnershipService(DistributedDataStore datastore, EntityOwnerSelectionStrategyConfig strategyConfig) {
+ this.datastore = Preconditions.checkNotNull(datastore);
+ this.strategyConfig = Preconditions.checkNotNull(strategyConfig);
}
public void start() {
protected EntityOwnershipShard.Builder newShardBuilder() {
return EntityOwnershipShard.newBuilder().localMemberName(datastore.getActorContext().getCurrentMemberName())
- .ownerSelectionStrategyConfig(EntityOwnerSelectionStrategyConfig.newBuilder().build());
+ .ownerSelectionStrategyConfig(this.strategyConfig);
}
@VisibleForTesting