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.DatastoreSnapshotRestore;
5 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory;
6 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
7 import org.osgi.framework.BundleContext;
9 public class DistributedOperationalDataStoreProviderModule extends
10 org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedOperationalDataStoreProviderModule {
11 private BundleContext bundleContext;
13 public DistributedOperationalDataStoreProviderModule(
14 org.opendaylight.controller.config.api.ModuleIdentifier identifier,
15 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
16 super(identifier, dependencyResolver);
19 public DistributedOperationalDataStoreProviderModule(
20 org.opendaylight.controller.config.api.ModuleIdentifier identifier,
21 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
22 org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedOperationalDataStoreProviderModule oldModule,
23 java.lang.AutoCloseable oldInstance) {
24 super(identifier, dependencyResolver, oldModule, oldInstance);
28 public void customValidation() {
29 // add custom validation form module attributes here.
33 public boolean canReuseInstance(AbstractDistributedOperationalDataStoreProviderModule oldModule) {
38 public java.lang.AutoCloseable createInstance() {
40 OperationalProperties props = getOperationalProperties();
42 props = new OperationalProperties();
45 DatastoreContext datastoreContext = DatastoreContext.newBuilder()
46 .logicalStoreType(LogicalDatastoreType.OPERATIONAL)
47 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
48 .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue())
49 .maxShardDataChangeListenerQueueSize(props.getMaxShardDataChangeListenerQueueSize().getValue().intValue())
50 .maxShardDataStoreExecutorQueueSize(props.getMaxShardDataStoreExecutorQueueSize().getValue().intValue())
51 .shardTransactionIdleTimeoutInMinutes(props.getShardTransactionIdleTimeoutInMinutes().getValue())
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.getShardHeartbeatIntervalInMillis().getValue())
58 .shardInitializationTimeoutInSeconds(props.getShardInitializationTimeoutInSeconds().getValue())
59 .shardLeaderElectionTimeoutInSeconds(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.getTransactionCreationInitialRateLimit().getValue())
69 .shardBatchedModificationCount(props.getShardBatchedModificationCount().getValue().intValue())
70 .shardCommitQueueExpiryTimeoutInSeconds(
71 props.getShardCommitQueueExpiryTimeoutInSeconds().getValue().intValue())
72 .transactionDebugContextEnabled(props.getTransactionDebugContextEnabled())
73 .customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
74 .shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue())
77 return DistributedDataStoreFactory.createInstance(getOperationalSchemaServiceDependency(),
78 datastoreContext, DatastoreSnapshotRestore.instance().getAndRemove(datastoreContext.getDataStoreType()),
79 getOperationalActorSystemProviderDependency().getActorSystem(), bundleContext);
82 public void setBundleContext(BundleContext bundleContext) {
83 this.bundleContext = bundleContext;