use of org.opendaylight.controller.cluster.datastore.config.Configuration in project controller by opendaylight.
the class DistributedShardedDOMDataTree method createPrefixConfigShard.
private static void createPrefixConfigShard(final AbstractDataStore dataStore) {
Configuration configuration = dataStore.getActorContext().getConfiguration();
Collection<MemberName> memberNames = configuration.getUniqueMemberNamesForAllShards();
CreateShard createShardMessage = new CreateShard(new ModuleShardConfiguration(PrefixShards.QNAME.getNamespace(), "prefix-shard-configuration", ClusterUtils.PREFIX_CONFIG_SHARD_ID, ModuleShardStrategy.NAME, memberNames), Shard.builder(), dataStore.getActorContext().getDatastoreContext());
dataStore.getActorContext().getShardManager().tell(createShardMessage, noSender());
}
use of org.opendaylight.controller.cluster.datastore.config.Configuration in project controller by opendaylight.
the class DistributedEntityOwnershipService method start.
public static DistributedEntityOwnershipService start(final ActorContext context, final EntityOwnerSelectionStrategyConfig strategyConfig) {
ActorRef shardManagerActor = context.getShardManager();
Configuration configuration = context.getConfiguration();
Collection<MemberName> entityOwnersMemberNames = configuration.getUniqueMemberNamesForAllShards();
CreateShard createShard = new CreateShard(new ModuleShardConfiguration(EntityOwners.QNAME.getNamespace(), "entity-owners", ENTITY_OWNERSHIP_SHARD_NAME, ModuleShardStrategy.NAME, entityOwnersMemberNames), newShardBuilder(context, strategyConfig), null);
Future<Object> createFuture = context.executeOperationAsync(shardManagerActor, createShard, MESSAGE_TIMEOUT);
createFuture.onComplete(new OnComplete<Object>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
if (failure != null) {
LOG.error("Failed to create {} shard", ENTITY_OWNERSHIP_SHARD_NAME, failure);
} else {
LOG.info("Successfully created {} shard", ENTITY_OWNERSHIP_SHARD_NAME);
}
}
}, context.getClientDispatcher());
return new DistributedEntityOwnershipService(context);
}
Aggregations