1 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
3 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
4 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory;
5 import org.osgi.framework.BundleContext;
7 public class DistributedOperationalDataStoreProviderModule extends
8 org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedOperationalDataStoreProviderModule {
9 private BundleContext bundleContext;
11 public DistributedOperationalDataStoreProviderModule(
12 org.opendaylight.controller.config.api.ModuleIdentifier identifier,
13 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
14 super(identifier, dependencyResolver);
17 public DistributedOperationalDataStoreProviderModule(
18 org.opendaylight.controller.config.api.ModuleIdentifier identifier,
19 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
20 org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedOperationalDataStoreProviderModule oldModule,
21 java.lang.AutoCloseable oldInstance) {
22 super(identifier, dependencyResolver, oldModule, oldInstance);
26 public void customValidation() {
27 // add custom validation form module attributes here.
31 public boolean canReuseInstance(AbstractDistributedOperationalDataStoreProviderModule oldModule) {
36 public java.lang.AutoCloseable createInstance() {
38 OperationalProperties props = getOperationalProperties();
40 props = new OperationalProperties();
43 DatastoreContext datastoreContext = DatastoreContext.newBuilder()
44 .dataStoreType("operational")
45 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
46 .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue())
47 .maxShardDataChangeListenerQueueSize(props.getMaxShardDataChangeListenerQueueSize().getValue().intValue())
48 .maxShardDataStoreExecutorQueueSize(props.getMaxShardDataStoreExecutorQueueSize().getValue().intValue())
49 .shardTransactionIdleTimeoutInMinutes(props.getShardTransactionIdleTimeoutInMinutes().getValue())
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.getShardHeartbeatIntervalInMillis().getValue())
56 .shardInitializationTimeoutInSeconds(props.getShardInitializationTimeoutInSeconds().getValue())
57 .shardLeaderElectionTimeoutInSeconds(props.getShardLeaderElectionTimeoutInSeconds().getValue())
58 .shardTransactionCommitTimeoutInSeconds(
59 props.getShardTransactionCommitTimeoutInSeconds().getValue().intValue())
60 .shardTransactionCommitQueueCapacity(
61 props.getShardTransactionCommitQueueCapacity().getValue().intValue())
62 .persistent(props.getPersistent().booleanValue())
63 .shardIsolatedLeaderCheckIntervalInMillis(
64 props.getShardIsolatedLeaderCheckIntervalInMillis().getValue())
65 .shardElectionTimeoutFactor(props.getShardElectionTimeoutFactor().getValue())
66 .transactionCreationInitialRateLimit(props.getTransactionCreationInitialRateLimit().getValue())
67 .shardBatchedModificationCount(props.getShardBatchedModificationCount().getValue().intValue())
68 .shardCommitQueueExpiryTimeoutInSeconds(
69 props.getShardCommitQueueExpiryTimeoutInSeconds().getValue().intValue())
70 .transactionDebugContextEnabled(props.getTransactionDebugContextEnabled())
71 .customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
74 return DistributedDataStoreFactory.createInstance(getOperationalSchemaServiceDependency(),
75 datastoreContext, bundleContext);
78 public void setBundleContext(BundleContext bundleContext) {
79 this.bundleContext = bundleContext;