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