return new ObjectName(builder.toString());
}
+ /**
+ * This method is a wrapper for registerMBean with void return type so it can be invoked by dependency
+ * injection frameworks such as Spring and Blueprint.
+ */
+ public void register() {
+ registerMBean();
+ }
+
/**
* Registers this bean with the platform MBean server with the domain defined by
* {@link #BASE_JMX_PREFIX}.
return registered;
}
+ /**
+ * This method is a wrapper for unregisterMBean with void return type so it can be invoked by dependency
+ * injection frameworks such as Spring and Blueprint.
+ */
+ public void unregister() {
+ unregisterMBean();
+ }
+
/**
* Unregisters this bean with the platform MBean server.
*
private static final String PRE_COMMIT = "PRE_COMMIT";
private static final String COMMIT = "COMMIT";
- private final DurationStatisticsTracker commitStatsTracker = DurationStatisticsTracker.createConcurrent();
+ private final DurationStatisticsTracker commitStatsTracker;
/**
* This executor is used to execute Future listener callback Runnables async.
private final Executor clientFutureCallbackExecutor;
public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, Executor listenableFutureExecutor) {
+ this(datastores, listenableFutureExecutor, DurationStatisticsTracker.createConcurrent());
+ }
+
+ public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, Executor listenableFutureExecutor,
+ DurationStatisticsTracker commitStatsTracker) {
super(datastores);
this.clientFutureCallbackExecutor = Preconditions.checkNotNull(listenableFutureExecutor);
+ this.commitStatsTracker = Preconditions.checkNotNull(commitStatsTracker);
}
public DurationStatisticsTracker getCommitStatsTracker() {
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorSystem;
+import org.opendaylight.controller.cluster.ActorSystemProvider;
import org.opendaylight.controller.cluster.datastore.config.Configuration;
import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
import org.opendaylight.controller.cluster.datastore.messages.DatastoreSnapshot;
private static final Logger LOG = LoggerFactory.getLogger(DistributedDataStoreFactory.class);
public static DistributedDataStore createInstance(SchemaService schemaService,
- DatastoreContext datastoreContext, DatastoreSnapshot restoreFromSnapshot, ActorSystem actorSystem,
- BundleContext bundleContext) {
+ DatastoreContext datastoreContext, DatastoreSnapshotRestore datastoreSnapshotRestore,
+ ActorSystemProvider actorSystemProvider, BundleContext bundleContext) {
LOG.info("Create data store instance of type : {}", datastoreContext.getDataStoreName());
+ ActorSystem actorSystem = actorSystemProvider.getActorSystem();
+ DatastoreSnapshot restoreFromSnapshot = datastoreSnapshotRestore.getAndRemove(
+ datastoreContext.getDataStoreName());
DatastoreContextIntrospector introspector = new DatastoreContextIntrospector(datastoreContext);
DatastoreContextConfigAdminOverlay overlay = new DatastoreContextConfigAdminOverlay(
introspector, bundleContext);
@Override
public java.lang.AutoCloseable createInstance() {
- ConfigProperties props = getConfigProperties();
+ DatastoreContext datastoreContext = newDatastoreContext(getConfigProperties());
+
+ return DistributedDataStoreFactory.createInstance(getConfigSchemaServiceDependency(),
+ datastoreContext, DatastoreSnapshotRestore.instance(),
+ getConfigActorSystemProviderDependency(), bundleContext);
+ }
+
+ public static DatastoreContext newDatastoreContext() {
+ return newDatastoreContext(null);
+ }
+
+ private static DatastoreContext newDatastoreContext(ConfigProperties inProps) {
+ ConfigProperties props = inProps;
if(props == null) {
props = new ConfigProperties();
}
- DatastoreContext datastoreContext = DatastoreContext.newBuilder()
+ return DatastoreContext.newBuilder()
.logicalStoreType(LogicalDatastoreType.CONFIGURATION)
.maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
.maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue())
.customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
.shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue())
.build();
-
- return DistributedDataStoreFactory.createInstance(getConfigSchemaServiceDependency(),
- datastoreContext, DatastoreSnapshotRestore.instance().getAndRemove(datastoreContext.getDataStoreName()),
- getConfigActorSystemProviderDependency().getActorSystem(), bundleContext);
}
public void setBundleContext(BundleContext bundleContext) {
@Override
public java.lang.AutoCloseable createInstance() {
+ DatastoreContext datastoreContext = newDatastoreContext(getOperationalProperties());
- OperationalProperties props = getOperationalProperties();
+ return DistributedDataStoreFactory.createInstance(getOperationalSchemaServiceDependency(),
+ datastoreContext, DatastoreSnapshotRestore.instance(),
+ getOperationalActorSystemProviderDependency(), bundleContext);
+ }
+
+ public static DatastoreContext newDatastoreContext() {
+ return newDatastoreContext(null);
+ }
+
+ private static DatastoreContext newDatastoreContext(OperationalProperties inProps) {
+ OperationalProperties props = inProps;
if(props == null) {
props = new OperationalProperties();
}
- DatastoreContext datastoreContext = DatastoreContext.newBuilder()
+ return DatastoreContext.newBuilder()
.logicalStoreType(LogicalDatastoreType.OPERATIONAL)
.maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
.maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue())
.customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
.shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue())
.build();
-
- return DistributedDataStoreFactory.createInstance(getOperationalSchemaServiceDependency(),
- datastoreContext, DatastoreSnapshotRestore.instance().getAndRemove(datastoreContext.getDataStoreName()),
- getOperationalActorSystemProviderDependency().getActorSystem(), bundleContext);
}
public void setBundleContext(BundleContext bundleContext) {
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0">
+
+ <cm:property-placeholder persistent-id="org.opendaylight.controller.cluster.datastore.broker" update-strategy="none">
+ <cm:default-properties>
+ <cm:property name="max-data-broker-future-callback-queue-size" value="1000"/>
+ <cm:property name="max-data-broker-future-callback-pool-size" value="20"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <reference id="schemaService" interface="org.opendaylight.controller.sal.core.api.model.SchemaService" />
+
+ <!-- ActorSystemProvider -->
+
+ <bean id="actorSystemProvider" class="org.opendaylight.controller.config.yang.config.actor_system_provider.impl.ActorSystemProviderImpl"
+ destroy-method="close">
+ <argument ref="blueprintBundleContext"/>
+ </bean>
+
+ <service ref="actorSystemProvider" interface="org.opendaylight.controller.cluster.ActorSystemProvider"/>
+
+ <!-- Distributed Config Datastore -->
+
+ <bean id="datastoreSnapshotRestore" class="org.opendaylight.controller.cluster.datastore.DatastoreSnapshotRestore"
+ factory-method="instance" />
+
+ <bean id="configDatastoreContext" class="org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedConfigDataStoreProviderModule"
+ factory-method="newDatastoreContext" />
+
+ <bean id="configDatastore" class="org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory"
+ factory-method="createInstance" destroy-method="close">
+ <argument ref="schemaService"/>
+ <argument ref="configDatastoreContext"/>
+ <argument ref="datastoreSnapshotRestore"/>
+ <argument ref="actorSystemProvider"/>
+ <argument ref="blueprintBundleContext"/>
+ </bean>
+
+ <!-- Distributed Operational Datastore -->
+
+ <bean id="operDatastoreContext" class="org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedOperationalDataStoreProviderModule"
+ factory-method="newDatastoreContext" />
+
+ <bean id="operDatastore" class="org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory"
+ factory-method="createInstance" destroy-method="close">
+ <argument ref="schemaService"/>
+ <argument ref="operDatastoreContext"/>
+ <argument ref="datastoreSnapshotRestore"/>
+ <argument ref="actorSystemProvider"/>
+ <argument ref="blueprintBundleContext"/>
+ </bean>
+
+ <!-- Concurrent DOMDataBroker -->
+
+ <bean id="listenableFutureExecutor" class="org.opendaylight.yangtools.util.concurrent.SpecialExecutors"
+ factory-method="newBlockingBoundedCachedThreadPool">
+ <argument value="${max-data-broker-future-callback-pool-size}"/>
+ <argument value="${max-data-broker-future-callback-queue-size}"/>
+ <argument value="CommitFutures"/>
+ </bean>
+
+ <bean id="commitStatsTracker" class="org.opendaylight.yangtools.util.DurationStatisticsTracker"
+ factory-method="createConcurrent"/>
+
+ <bean id="clusteredDOMDataBroker" class="org.opendaylight.controller.cluster.datastore.ConcurrentDOMDataBroker"
+ destroy-method="close">
+ <argument>
+ <map>
+ <entry key="CONFIGURATION" value-ref="configDatastore"/>
+ <entry key="OPERATIONAL" value-ref="operDatastore"/>
+ </map>
+ </argument>
+ <argument ref="listenableFutureExecutor"/>
+ <argument ref="commitStatsTracker"/>
+ </bean>
+
+ <service ref="clusteredDOMDataBroker" interface="org.opendaylight.controller.md.sal.dom.api.DOMDataBroker"
+ odl:type="default"/>
+
+ <!-- JMX beans for the data broker -->
+
+ <bean id="commitStatsMXBean" class="org.opendaylight.controller.md.sal.dom.broker.impl.jmx.CommitStatsMXBeanImpl"
+ init-method="register" destroy-method="unregister">
+ <argument ref="commitStatsTracker"/>
+ <argument value="DOMDataBroker"/>
+ </bean>
+
+ <bean id="threadStatsMXBean" class="org.opendaylight.controller.md.sal.common.util.jmx.ThreadExecutorStatsMXBeanImpl"
+ factory-method="create" destroy-method="unregister">
+ <argument ref="listenableFutureExecutor"/>
+ <argument value="CommitFutureExecutorStats"/>
+ <argument value="DOMDataBroker"/>
+ <argument><null/></argument>
+ </bean>
+
+ <!-- Distributed EntityOwnershipService -->
+
+ <bean id="selectionStrategyConfig" class="org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfigReader"
+ factory-method="loadStrategyWithConfig">
+ <argument ref="blueprintBundleContext"/>
+ </bean>
+
+ <bean id="distributedEntityOwnershipService" class="org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipService"
+ factory-method="start" destroy-method="close">
+ <argument>
+ <bean factory-ref="operDatastore" factory-method="getActorContext"/>
+ </argument>
+ <argument ref="selectionStrategyConfig"/>
+ </bean>
+
+ <service ref="distributedEntityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"
+ odl:type="default"/>
+
+</blueprint>
\ No newline at end of file
}
leaf shard-election-timeout-factor {
- default 2;
+ default 20;
type non-zero-uint32-type;
description "The multiplication factor to be used to determine shard election timeout. The shard election timeout
is determined by multiplying shard-heartbeat-interval-in-millis with the shard-election-timeout-factor";