1 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
3 import java.util.concurrent.TimeUnit;
5 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
6 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory;
7 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
8 import org.osgi.framework.BundleContext;
10 import scala.concurrent.duration.Duration;
12 public class DistributedConfigDataStoreProviderModule extends
13 org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedConfigDataStoreProviderModule {
14 private BundleContext bundleContext;
16 public DistributedConfigDataStoreProviderModule(
17 org.opendaylight.controller.config.api.ModuleIdentifier identifier,
18 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
19 super(identifier, dependencyResolver);
22 public DistributedConfigDataStoreProviderModule(
23 org.opendaylight.controller.config.api.ModuleIdentifier identifier,
24 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
25 org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedConfigDataStoreProviderModule oldModule,
26 java.lang.AutoCloseable oldInstance) {
27 super(identifier, dependencyResolver, oldModule, oldInstance);
31 public void customValidation() {
32 // add custom validation form module attributes here.
36 public java.lang.AutoCloseable createInstance() {
38 ConfigProperties props = getConfigProperties();
40 props = new ConfigProperties();
43 DatastoreContext datastoreContext = DatastoreContext.newBuilder()
44 .dataStoreType("config")
45 .dataStoreProperties(InMemoryDOMDataStoreConfigProperties.create(
46 props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue(),
47 props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue(),
48 props.getMaxShardDataChangeListenerQueueSize().getValue().intValue(),
49 props.getMaxShardDataStoreExecutorQueueSize().getValue().intValue()))
50 .shardTransactionIdleTimeout(Duration.create(
51 props.getShardTransactionIdleTimeoutInMinutes().getValue(), TimeUnit.MINUTES))
52 .operationTimeoutInSeconds(props.getOperationTimeoutInSeconds().getValue())
53 .shardJournalRecoveryLogBatchSize(props.getShardJournalRecoveryLogBatchSize().
54 getValue().intValue())
55 .shardSnapshotBatchCount(props.getShardSnapshotBatchCount().getValue().intValue())
56 .shardSnapshotDataThresholdPercentage(props.getShardSnapshotDataThresholdPercentage().getValue().intValue())
57 .shardHeartbeatIntervalInMillis(props.getShardHearbeatIntervalInMillis().getValue())
58 .shardInitializationTimeout(props.getShardInitializationTimeoutInSeconds().getValue(),
60 .shardLeaderElectionTimeout(props.getShardLeaderElectionTimeoutInSeconds().getValue(),
62 .shardTransactionCommitTimeoutInSeconds(
63 props.getShardTransactionCommitTimeoutInSeconds().getValue().intValue())
64 .shardTransactionCommitQueueCapacity(
65 props.getShardTransactionCommitQueueCapacity().getValue().intValue())
66 .persistent(props.getPersistent().booleanValue())
67 .shardIsolatedLeaderCheckIntervalInMillis(
68 props.getShardIsolatedLeaderCheckIntervalInMillis().getValue())
69 .shardElectionTimeoutFactor(props.getShardElectionTimeoutFactor().getValue())
70 .transactionCreationInitialRateLimit(props.getTxCreationInitialRateLimit().getValue())
73 return DistributedDataStoreFactory.createInstance(getConfigSchemaServiceDependency(),
74 datastoreContext, bundleContext);
77 public void setBundleContext(BundleContext bundleContext) {
78 this.bundleContext = bundleContext;