Fix warnings/javadocs in sal-distributed-datastore 39/46639/4
authorTom Pantelis <tpanteli@brocade.com>
Thu, 6 Oct 2016 22:46:11 +0000 (18:46 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Fri, 7 Oct 2016 15:50:02 +0000 (15:50 +0000)
First off, I apologize for the size of this patch. There's a ton of classes
in this project and I didn't even get to all of them (will follow-up). While
a lot of files were touched, the changes were mostly small.

Fixed a lot of checkstyle warnings and cleaned up javadocs. Most of the
warnings/changes were for:
 - white space before if/for/while/catch
 - white space before beginning brace
 - line too long
 - illegal catching of Exception (suppressed)
 - variable name too short
 - indentation
 - missing period after first sentence in javadoc
 - missing first sentence in javadoc
 - missing <p/> in javadoc

Change-Id: Id56d874a8fbcbbc9285279a71c0a5aba393653a9
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
165 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBroker.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMTransactionFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBroker.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/DOMBrokerReadOnlyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/DOMBrokerReadWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/DOMBrokerTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/DOMBrokerWriteOnlyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ShardedDOMStoreReadTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ShardedDOMStoreReadWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ShardedDOMStoreWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractDataListenerSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractShardDataTreeNotificationPublisherActorProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractShardDataTreeTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContextFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ChainedCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapper.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CohortEntry.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CompositeDataTreeCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCandidatePayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerRegistrationActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorRegistry.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortRegistrationProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextConfigAdminOverlay.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospector.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreSnapshotRestore.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DebugThreePhaseCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DefaultShardDataChangeListenerPublisher.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DelayedListenerRegistration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DelegateFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ForwardingDataTreeChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendHistoryMetadataBuilder.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LeaderLocalDelegateFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalThreePhaseCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionFactoryImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OperationCallback.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OperationLimiter.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataChangeListenerPublisherActorProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeChangeListenerPublisherActorProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeMetadata.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeNotificationPublisherActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTransactionParent.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManagerSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardRecoveryCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionActorFactory.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFactory.java with 80% similarity]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionMessageRetrySupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SingleCommitCohortProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TerminationMonitor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextWrapper.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionOperation.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionRateLimitingCallback.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionReadyReplyMapper.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/Configuration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ConfigurationImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/FileModuleShardConfigProvider.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ModuleConfig.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/LocalShardNotFoundException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/NotInitializedException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/PrimaryNotFoundException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/TimeoutException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifier.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardManagerIdentifier.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardMBeanFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsMXBean.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AddShardReplica.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistrationReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataTreeChangeListenerRegistration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataTreeChangeListenerRegistrationReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataExists.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindLocalShard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/LocalShardFound.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/LocalShardNotFound.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterDataTreeChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RemoveShardReplica.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/UpdateSchemaContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/VersionedExternalizableMessage.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/CompositeModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/Modification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbortTransactionPayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractIdentifiablePayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractVersionedShardDataTreeSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/CommitTransactionPayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/DataTreeCandidateInputOutput.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/DeletedDataTreeCandidateNode.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/FrontendShardDataTreeSnapshotMetadata.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/MetadataShardDataTreeSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ModifiedDataTreeCandidateNode.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/PayloadVersion.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshotMetadata.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/AbstractShardManagerCreator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardInformation.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerGetSnapshotReplyActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerInfo.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerInfoMBean.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardPeerAddressResolver.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/DataTreeModificationOutput.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/Dispatchers.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeAggregator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeXMLOutput.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/PruningDataTreeModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/TransactionRateLimiter.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderModule.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/ActorSystemProviderModuleFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/concurrent_data_broker/DomConcurrentDataBrokerModule.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/concurrent_data_broker/DomConcurrentDataBrokerModuleFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedConfigDataStoreProviderModule.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedConfigDataStoreProviderModuleFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModuleFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/ForwardingDistributedDataStore.java

index 52837183b5c933a4b71f491d63d16961e75899ac..45b82ddec5f660a33d28e623076096c7a63aa664 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.cluster.databroker;
 
 import static com.google.common.base.Preconditions.checkState;
 package org.opendaylight.controller.cluster.databroker;
 
 import static com.google.common.base.Preconditions.checkState;
+
 import com.google.common.collect.ImmutableMap;
 import java.util.Collections;
 import java.util.EnumMap;
 import com.google.common.collect.ImmutableMap;
 import java.util.Collections;
 import java.util.EnumMap;
@@ -53,13 +54,15 @@ abstract class AbstractDOMBroker extends AbstractDOMTransactionFactory<DOMStore>
         }
 
         if (treeChange) {
         }
 
         if (treeChange) {
-            extensions = ImmutableMap.<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension>of(DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
+            extensions = ImmutableMap.of(DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
                 @Override
                 @Override
-                public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(final DOMDataTreeIdentifier treeId, final L listener) {
+                public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
+                        final DOMDataTreeIdentifier treeId, final L listener) {
                     DOMStore publisher = getTxFactories().get(treeId.getDatastoreType());
                     checkState(publisher != null, "Requested logical data store is not available.");
 
                     DOMStore publisher = getTxFactories().get(treeId.getDatastoreType());
                     checkState(publisher != null, "Requested logical data store is not available.");
 
-                    return ((DOMStoreTreeChangePublisher) publisher).registerTreeChangeListener(treeId.getRootIdentifier(), listener);
+                    return ((DOMStoreTreeChangePublisher) publisher).registerTreeChangeListener(
+                            treeId.getRootIdentifier(), listener);
                 }
             });
         } else {
                 }
             });
         } else {
@@ -72,6 +75,7 @@ abstract class AbstractDOMBroker extends AbstractDOMTransactionFactory<DOMStore>
     }
 
     @Override
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         super.close();
 
     public void close() {
         super.close();
 
@@ -91,8 +95,8 @@ abstract class AbstractDOMBroker extends AbstractDOMTransactionFactory<DOMStore>
 
     @Override
     public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
 
     @Override
     public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
-                                                                                  final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
-
+            final YangInstanceIdentifier path, final DOMDataChangeListener listener,
+            final DataChangeScope triggeringScope) {
         DOMStore potentialStore = getTxFactories().get(store);
         checkState(potentialStore != null, "Requested logical data store is not available.");
         return potentialStore.registerChangeListener(path, listener, triggeringScope);
         DOMStore potentialStore = getTxFactories().get(store);
         checkState(potentialStore != null, "Requested logical data store is not available.");
         return potentialStore.registerChangeListener(path, listener, triggeringScope);
@@ -107,7 +111,8 @@ abstract class AbstractDOMBroker extends AbstractDOMTransactionFactory<DOMStore>
     public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
         checkNotClosed();
 
     public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
         checkNotClosed();
 
-        final Map<LogicalDatastoreType, DOMStoreTransactionChain> backingChains = new EnumMap<>(LogicalDatastoreType.class);
+        final Map<LogicalDatastoreType, DOMStoreTransactionChain> backingChains =
+                new EnumMap<>(LogicalDatastoreType.class);
         for (Map.Entry<LogicalDatastoreType, DOMStore> entry : getTxFactories().entrySet()) {
             backingChains.put(entry.getKey(), entry.getValue().createTransactionChain());
         }
         for (Map.Entry<LogicalDatastoreType, DOMStore> entry : getTxFactories().entrySet()) {
             backingChains.put(entry.getKey(), entry.getValue().createTransactionChain());
         }
index 0570e72860789c18b1cb5db873eb2713a582ee69..d03378558838c985765c56bdf1e7edb8061fb446 100644 (file)
@@ -22,28 +22,28 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 public abstract class AbstractDOMBrokerTransaction<T extends DOMStoreTransaction> implements
         AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
 public abstract class AbstractDOMBrokerTransaction<T extends DOMStoreTransaction> implements
         AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
-    private EnumMap<LogicalDatastoreType, T> backingTxs;
+    private final EnumMap<LogicalDatastoreType, T> backingTxs;
     private final Object identifier;
     private final Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories;
 
     /**
     private final Object identifier;
     private final Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories;
 
     /**
-     *
      * Creates new composite Transactions.
      *
      * Creates new composite Transactions.
      *
-     * @param identifier
-     *            Identifier of transaction.
+     * @param identifier Identifier of transaction.
      */
      */
-    protected AbstractDOMBrokerTransaction(final Object identifier, Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories) {
+    protected AbstractDOMBrokerTransaction(final Object identifier,
+            Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories) {
         this.identifier = Preconditions.checkNotNull(identifier, "Identifier should not be null");
         this.identifier = Preconditions.checkNotNull(identifier, "Identifier should not be null");
-        this.storeTxFactories = Preconditions.checkNotNull(storeTxFactories, "Store Transaction Factories should not be null");
+        this.storeTxFactories = Preconditions.checkNotNull(storeTxFactories,
+                "Store Transaction Factories should not be null");
         this.backingTxs = new EnumMap<>(LogicalDatastoreType.class);
     }
 
     /**
      * Returns subtransaction associated with supplied key.
      *
         this.backingTxs = new EnumMap<>(LogicalDatastoreType.class);
     }
 
     /**
      * Returns subtransaction associated with supplied key.
      *
-     * @param key
-     * @return
+     * @param key the data store type key
+     * @return the subtransaction
      * @throws NullPointerException
      *             if key is null
      * @throws IllegalArgumentException
      * @throws NullPointerException
      *             if key is null
      * @throws IllegalArgumentException
@@ -53,7 +53,7 @@ public abstract class AbstractDOMBrokerTransaction<T extends DOMStoreTransaction
         Preconditions.checkNotNull(key, "key must not be null.");
 
         T ret = backingTxs.get(key);
         Preconditions.checkNotNull(key, "key must not be null.");
 
         T ret = backingTxs.get(key);
-        if(ret == null){
+        if (ret == null) {
             ret = createTransaction(key);
             backingTxs.put(key, ret);
         }
             ret = createTransaction(key);
             backingTxs.put(key, ret);
         }
@@ -76,6 +76,7 @@ public abstract class AbstractDOMBrokerTransaction<T extends DOMStoreTransaction
         return identifier;
     }
 
         return identifier;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     protected void closeSubtransactions() {
         /*
          * We share one exception for all failures, which are added
     protected void closeSubtransactions() {
         /*
          * We share one exception for all failures, which are added
@@ -101,7 +102,7 @@ public abstract class AbstractDOMBrokerTransaction<T extends DOMStoreTransaction
         }
     }
 
         }
     }
 
-    protected DOMStoreTransactionFactory getTxFactory(LogicalDatastoreType type){
+    protected DOMStoreTransactionFactory getTxFactory(LogicalDatastoreType type) {
         return storeTxFactories.get(type);
     }
 }
         return storeTxFactories.get(type);
     }
 }
index f0eebe331ed203c97594f9f503cd5d20f0cf30ce..54f4e825d012a98bda5b739d52e407003b6a5de6 100644 (file)
@@ -36,11 +36,13 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
         extends AbstractDOMBrokerTransaction<T> implements DOMDataWriteTransaction {
 
     @SuppressWarnings("rawtypes")
         extends AbstractDOMBrokerTransaction<T> implements DOMDataWriteTransaction {
 
     @SuppressWarnings("rawtypes")
-    private static final AtomicReferenceFieldUpdater<AbstractDOMBrokerWriteTransaction, AbstractDOMTransactionFactory> IMPL_UPDATER =
-            AtomicReferenceFieldUpdater.newUpdater(AbstractDOMBrokerWriteTransaction.class, AbstractDOMTransactionFactory.class, "commitImpl");
+    private static final AtomicReferenceFieldUpdater<AbstractDOMBrokerWriteTransaction, AbstractDOMTransactionFactory>
+            IMPL_UPDATER = AtomicReferenceFieldUpdater.newUpdater(AbstractDOMBrokerWriteTransaction.class,
+                    AbstractDOMTransactionFactory.class, "commitImpl");
     @SuppressWarnings("rawtypes")
     private static final AtomicReferenceFieldUpdater<AbstractDOMBrokerWriteTransaction, Future> FUTURE_UPDATER =
     @SuppressWarnings("rawtypes")
     private static final AtomicReferenceFieldUpdater<AbstractDOMBrokerWriteTransaction, Future> FUTURE_UPDATER =
-            AtomicReferenceFieldUpdater.newUpdater(AbstractDOMBrokerWriteTransaction.class, Future.class, "commitFuture");
+            AtomicReferenceFieldUpdater.newUpdater(AbstractDOMBrokerWriteTransaction.class, Future.class,
+                    "commitFuture");
     private static final Logger LOG = LoggerFactory.getLogger(AbstractDOMBrokerWriteTransaction.class);
     private static final Future<?> CANCELLED_FUTURE = Futures.immediateCancelledFuture();
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractDOMBrokerWriteTransaction.class);
     private static final Future<?> CANCELLED_FUTURE = Futures.immediateCancelledFuture();
 
@@ -55,7 +57,7 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
      * Future task of transaction commit. It starts off as null, but is
      * set appropriately on {@link #submit()} and {@link #cancel()} via
      * {@link AtomicReferenceFieldUpdater#lazySet(Object, Object)}.
      * Future task of transaction commit. It starts off as null, but is
      * set appropriately on {@link #submit()} and {@link #cancel()} via
      * {@link AtomicReferenceFieldUpdater#lazySet(Object, Object)}.
-     *
+     * <p/>
      * Lazy set is safe for use because it is only referenced to in the
      * {@link #cancel()} slow path, where we will busy-wait for it. The
      * fast path gets the benefit of a store-store barrier instead of the
      * Lazy set is safe for use because it is only referenced to in the
      * {@link #cancel()} slow path, where we will busy-wait for it. The
      * fast path gets the benefit of a store-store barrier instead of the
@@ -64,13 +66,15 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
     private volatile Future<?> commitFuture;
 
     protected AbstractDOMBrokerWriteTransaction(final Object identifier,
     private volatile Future<?> commitFuture;
 
     protected AbstractDOMBrokerWriteTransaction(final Object identifier,
-                                            final Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories, final AbstractDOMTransactionFactory<?> commitImpl) {
+            final Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories,
+            final AbstractDOMTransactionFactory<?> commitImpl) {
         super(identifier, storeTxFactories);
         this.commitImpl = Preconditions.checkNotNull(commitImpl, "commitImpl must not be null.");
     }
 
     @Override
         super(identifier, storeTxFactories);
         this.commitImpl = Preconditions.checkNotNull(commitImpl, "commitImpl must not be null.");
     }
 
     @Override
-    public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+    public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
+            final NormalizedNode<?, ?> data) {
         checkRunning(commitImpl);
         checkInstanceIdentifierReferencesData(path,data);
         getSubtransaction(store).write(path, data);
         checkRunning(commitImpl);
         checkInstanceIdentifierReferencesData(path,data);
         getSubtransaction(store).write(path, data);
@@ -80,7 +84,7 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
             final NormalizedNode<?, ?> data) {
         final PathArgument lastArg = path.getLastPathArgument();
         Preconditions.checkArgument(
             final NormalizedNode<?, ?> data) {
         final PathArgument lastArg = path.getLastPathArgument();
         Preconditions.checkArgument(
-                (lastArg == data.getIdentifier()) || (lastArg != null && lastArg.equals(data.getIdentifier())),
+                lastArg == data.getIdentifier() || lastArg != null && lastArg.equals(data.getIdentifier()),
                 "Instance identifier references %s but data identifier is %s", lastArg, data);
     }
 
                 "Instance identifier references %s but data identifier is %s", lastArg, data);
     }
 
@@ -91,7 +95,8 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
     }
 
     @Override
     }
 
     @Override
-    public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+    public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
+            final NormalizedNode<?, ?> data) {
         checkRunning(commitImpl);
         checkInstanceIdentifierReferencesData(path, data);
         getSubtransaction(store).merge(path, data);
         checkRunning(commitImpl);
         checkInstanceIdentifierReferencesData(path, data);
         getSubtransaction(store).merge(path, data);
index c25109517674fe41ed8049010001e9cf495bcb79..43db918156a22762a099e2330ff77fb7b63d4982 100644 (file)
@@ -35,24 +35,26 @@ public abstract class AbstractDOMTransactionFactory<T extends DOMStoreTransactio
 
     /**
      * Implementations must return unique identifier for each and every call of
 
     /**
      * Implementations must return unique identifier for each and every call of
-     * this method;
+     * this method.
      *
      * @return new Unique transaction identifier.
      */
     protected abstract Object newTransactionIdentifier();
 
     /**
      *
      * @return new Unique transaction identifier.
      */
     protected abstract Object newTransactionIdentifier();
 
     /**
+     * Submits a transaction asynchronously for commit.
      *
      *
-     * @param transaction
-     * @param cohorts
-     * @return
+     * @param transaction the transaction to submit
+     * @param cohorts the associated cohorts
+     * @return a resulting Future
      */
      */
-    protected abstract CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
-                                                                                   final Collection<DOMStoreThreePhaseCommitCohort> cohorts);
+    protected abstract CheckedFuture<Void,TransactionCommitFailedException> submit(DOMDataWriteTransaction transaction,
+            Collection<DOMStoreThreePhaseCommitCohort> cohorts);
 
     /**
 
     /**
+     * Creates a new read-only transaction.
      *
      *
-     * @return
+     * @return the transaction instance
      */
     public final DOMDataReadOnlyTransaction newReadOnlyTransaction() {
         checkNotClosed();
      */
     public final DOMDataReadOnlyTransaction newReadOnlyTransaction() {
         checkNotClosed();
@@ -62,8 +64,9 @@ public abstract class AbstractDOMTransactionFactory<T extends DOMStoreTransactio
 
 
     /**
 
 
     /**
+     * Creates a new write-only transaction.
      *
      *
-     * @return
+     * @return the transaction instance
      */
     public final DOMDataWriteTransaction newWriteOnlyTransaction() {
         checkNotClosed();
      */
     public final DOMDataWriteTransaction newWriteOnlyTransaction() {
         checkNotClosed();
@@ -73,8 +76,9 @@ public abstract class AbstractDOMTransactionFactory<T extends DOMStoreTransactio
 
 
     /**
 
 
     /**
+     * Creates a new read-write transaction.
      *
      *
-     * @return
+     * @return the transaction instance
      */
     public final DOMDataReadWriteTransaction newReadWriteTransaction() {
         checkNotClosed();
      */
     public final DOMDataReadWriteTransaction newReadWriteTransaction() {
         checkNotClosed();
index bdaa6db6c1a1f1d3fc08b10c25f8f83ee27b5a60..2eeb955b4fe3b782f86c551a084bad15a2e9ac1e 100644 (file)
@@ -59,12 +59,13 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
      */
     private final Executor clientFutureCallbackExecutor;
 
      */
     private final Executor clientFutureCallbackExecutor;
 
-    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, Executor listenableFutureExecutor) {
+    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
+            Executor listenableFutureExecutor) {
         this(datastores, listenableFutureExecutor, DurationStatisticsTracker.createConcurrent());
     }
 
         this(datastores, listenableFutureExecutor, DurationStatisticsTracker.createConcurrent());
     }
 
-    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, Executor listenableFutureExecutor,
-            DurationStatisticsTracker commitStatsTracker) {
+    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
+            Executor listenableFutureExecutor, DurationStatisticsTracker commitStatsTracker) {
         super(datastores);
         this.clientFutureCallbackExecutor = Preconditions.checkNotNull(listenableFutureExecutor);
         this.commitStatsTracker = Preconditions.checkNotNull(commitStatsTracker);
         super(datastores);
         this.clientFutureCallbackExecutor = Preconditions.checkNotNull(listenableFutureExecutor);
         this.commitStatsTracker = Preconditions.checkNotNull(commitStatsTracker);
@@ -82,7 +83,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
         Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
         LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier());
 
         Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
         LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier());
 
-        if(cohorts.isEmpty()){
+        if (cohorts.isEmpty()) {
             return Futures.immediateCheckedFuture(null);
         }
 
             return Futures.immediateCheckedFuture(null);
         }
 
@@ -113,7 +114,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
                             new TransactionCommitFailedException(
                                             "Can Commit failed, no detailed cause available."));
                 } else {
                             new TransactionCommitFailedException(
                                             "Can Commit failed, no detailed cause available."));
                 } else {
-                    if(!cohortIterator.hasNext()) {
+                    if (!cohortIterator.hasNext()) {
                         // All cohorts completed successfully - we can move on to the preCommit phase
                         doPreCommit(startTime, clientSubmitFuture, transaction, cohorts);
                     } else {
                         // All cohorts completed successfully - we can move on to the preCommit phase
                         doPreCommit(startTime, clientSubmitFuture, transaction, cohorts);
                     } else {
@@ -124,9 +125,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable failure) {
                 handleException(clientSubmitFuture, transaction, cohorts, CAN_COMMIT,
                 handleException(clientSubmitFuture, transaction, cohorts, CAN_COMMIT,
-                        TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER, t);
+                        TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER, failure);
             }
         };
 
             }
         };
 
@@ -144,7 +145,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
         FutureCallback<Void> futureCallback = new FutureCallback<Void>() {
             @Override
             public void onSuccess(Void notUsed) {
         FutureCallback<Void> futureCallback = new FutureCallback<Void>() {
             @Override
             public void onSuccess(Void notUsed) {
-                if(!cohortIterator.hasNext()) {
+                if (!cohortIterator.hasNext()) {
                     // All cohorts completed successfully - we can move on to the commit phase
                     doCommit(startTime, clientSubmitFuture, transaction, cohorts);
                 } else {
                     // All cohorts completed successfully - we can move on to the commit phase
                     doCommit(startTime, clientSubmitFuture, transaction, cohorts);
                 } else {
@@ -154,9 +155,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable failure) {
                 handleException(clientSubmitFuture, transaction, cohorts, PRE_COMMIT,
                 handleException(clientSubmitFuture, transaction, cohorts, PRE_COMMIT,
-                        TransactionCommitFailedExceptionMapper.PRE_COMMIT_MAPPER, t);
+                        TransactionCommitFailedExceptionMapper.PRE_COMMIT_MAPPER, failure);
             }
         };
 
             }
         };
 
@@ -174,7 +175,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
         FutureCallback<Void> futureCallback = new FutureCallback<Void>() {
             @Override
             public void onSuccess(Void notUsed) {
         FutureCallback<Void> futureCallback = new FutureCallback<Void>() {
             @Override
             public void onSuccess(Void notUsed) {
-                if(!cohortIterator.hasNext()) {
+                if (!cohortIterator.hasNext()) {
                     // All cohorts completed successfully - we're done.
                     commitStatsTracker.addDuration(System.nanoTime() - startTime);
 
                     // All cohorts completed successfully - we're done.
                     commitStatsTracker.addDuration(System.nanoTime() - startTime);
 
@@ -186,9 +187,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable throwable) {
                 handleException(clientSubmitFuture, transaction, cohorts, COMMIT,
                 handleException(clientSubmitFuture, transaction, cohorts, COMMIT,
-                        TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER, t);
+                        TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER, throwable);
             }
         };
 
             }
         };
 
@@ -200,21 +201,21 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             final DOMDataWriteTransaction transaction,
             final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
             final String phase, final TransactionCommitFailedExceptionMapper exMapper,
             final DOMDataWriteTransaction transaction,
             final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
             final String phase, final TransactionCommitFailedExceptionMapper exMapper,
-            final Throwable t) {
+            final Throwable throwable) {
 
         if (clientSubmitFuture.isDone()) {
             // We must have had failures from multiple cohorts.
             return;
         }
 
 
         if (clientSubmitFuture.isDone()) {
             // We must have had failures from multiple cohorts.
             return;
         }
 
-        LOG.warn("Tx: {} Error during phase {}, starting Abort", transaction.getIdentifier(), phase, t);
+        LOG.warn("Tx: {} Error during phase {}, starting Abort", transaction.getIdentifier(), phase, throwable);
         final Exception e;
         final Exception e;
-        if(t instanceof NoShardLeaderException || t instanceof ShardLeaderNotRespondingException) {
-            e = new DataStoreUnavailableException(t.getMessage(), t);
-        } else if (t instanceof Exception) {
-            e = (Exception)t;
+        if (throwable instanceof NoShardLeaderException || throwable instanceof ShardLeaderNotRespondingException) {
+            e = new DataStoreUnavailableException(throwable.getMessage(), throwable);
+        } else if (throwable instanceof Exception) {
+            e = (Exception)throwable;
         } else {
         } else {
-            e = new RuntimeException("Unexpected error occurred", t);
+            e = new RuntimeException("Unexpected error occurred", throwable);
         }
 
         final TransactionCommitFailedException clientException = exMapper.apply(e);
         }
 
         final TransactionCommitFailedException clientException = exMapper.apply(e);
@@ -223,9 +224,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
 
         @SuppressWarnings("unchecked")
         ListenableFuture<Void>[] canCommitFutures = new ListenableFuture[cohorts.size()];
 
         @SuppressWarnings("unchecked")
         ListenableFuture<Void>[] canCommitFutures = new ListenableFuture[cohorts.size()];
-        int i = 0;
+        int index = 0;
         for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
         for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
-            canCommitFutures[i++] = cohort.abort();
+            canCommitFutures[index++] = cohort.abort();
         }
 
         ListenableFuture<List<Void>> combinedFuture = Futures.allAsList(canCommitFutures);
         }
 
         ListenableFuture<List<Void>> combinedFuture = Futures.allAsList(canCommitFutures);
@@ -237,8 +238,8 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(Throwable t) {
-                LOG.error("Tx: {} Error during Abort.", transaction.getIdentifier(), t);
+            public void onFailure(Throwable failure) {
+                LOG.error("Tx: {} Error during Abort.", transaction.getIdentifier(), failure);
 
                 // Propagate the original exception as that is what caused the Tx to fail and is
                 // what's interesting to the client.
 
                 // Propagate the original exception as that is what caused the Tx to fail and is
                 // what's interesting to the client.
@@ -254,7 +255,6 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
      * the thread that completed this future, as a common use case is to pass an executor that runs
      * tasks in the same thread as the caller (ie MoreExecutors#sameThreadExecutor)
      * to {@link #addListener}.
      * the thread that completed this future, as a common use case is to pass an executor that runs
      * tasks in the same thread as the caller (ie MoreExecutors#sameThreadExecutor)
      * to {@link #addListener}.
-     *
      * FIXME: This class should probably be moved to yangtools common utils for re-usability and
      * unified with AsyncNotifyingListenableFutureTask.
      */
      * FIXME: This class should probably be moved to yangtools common utils for re-usability and
      * unified with AsyncNotifyingListenableFutureTask.
      */
index 64d79cb637ce51e4d4b208fc20527e93c8c28593..3575731511a183ec36f64a5645d77aac84e00f59 100644 (file)
@@ -27,7 +27,8 @@ public class DOMBrokerReadOnlyTransaction
      *
      * @param identifier Identifier of transaction.
      */
      *
      * @param identifier Identifier of transaction.
      */
-    protected DOMBrokerReadOnlyTransaction(Object identifier, Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories) {
+    protected DOMBrokerReadOnlyTransaction(Object identifier,
+            Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories) {
         super(identifier, storeTxFactories);
     }
 
         super(identifier, storeTxFactories);
     }
 
index 58dcedce6283eeb42e1d8d162f77b7671a3e7d3f..a2693a61719699cdc699b279a5aa0e76a54e845d 100644 (file)
@@ -21,13 +21,16 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class DOMBrokerReadWriteTransaction
         extends AbstractDOMBrokerWriteTransaction<DOMStoreReadWriteTransaction> implements DOMDataReadWriteTransaction {
 
 public class DOMBrokerReadWriteTransaction
         extends AbstractDOMBrokerWriteTransaction<DOMStoreReadWriteTransaction> implements DOMDataReadWriteTransaction {
+
     /**
     /**
-     * Creates new composite Transactions.
+     * Constructs an instance.
      *
      *
-     * @param identifier Identifier of transaction.
-     * @param storeTxFactories
+     * @param identifier identifier of transaction.
+     * @param storeTxFactories the backing transaction store factories
      */
      */
-    protected DOMBrokerReadWriteTransaction(Object identifier, Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory>  storeTxFactories, final AbstractDOMTransactionFactory<?> commitImpl) {
+    protected DOMBrokerReadWriteTransaction(Object identifier,
+            Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory>  storeTxFactories,
+            final AbstractDOMTransactionFactory<?> commitImpl) {
         super(identifier, storeTxFactories, commitImpl);
     }
 
         super(identifier, storeTxFactories, commitImpl);
     }
 
@@ -48,6 +51,4 @@ public class DOMBrokerReadWriteTransaction
     protected DOMStoreReadWriteTransaction createTransaction(LogicalDatastoreType key) {
         return getTxFactory(key).newReadWriteTransaction();
     }
     protected DOMStoreReadWriteTransaction createTransaction(LogicalDatastoreType key) {
         return getTxFactory(key).newReadWriteTransaction();
     }
-
-
 }
 }
index aef9f0d47f3b41c21419097d83df67358238f966..4bc22e4643144ca23fbe6d948a3b0f89f7374474 100644 (file)
@@ -50,6 +50,7 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
     private volatile int counter = 0;
 
     /**
     private volatile int counter = 0;
 
     /**
+     * Constructs an instance.
      *
      * @param chainId
      *            ID of transaction chain
      *
      * @param chainId
      *            ID of transaction chain
@@ -60,9 +61,8 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
      * @throws NullPointerException
      *             If any of arguments is null.
      */
      * @throws NullPointerException
      *             If any of arguments is null.
      */
-    public DOMBrokerTransactionChain(final long chainId,
-                                     final Map<LogicalDatastoreType, DOMStoreTransactionChain> chains,
-                                     AbstractDOMBroker broker, final TransactionChainListener listener) {
+    DOMBrokerTransactionChain(final long chainId, final Map<LogicalDatastoreType, DOMStoreTransactionChain> chains,
+            AbstractDOMBroker broker, final TransactionChainListener listener) {
         super(chains);
         this.chainId = chainId;
         this.broker = Preconditions.checkNotNull(broker);
         super(chains);
         this.chainId = chainId;
         this.broker = Preconditions.checkNotNull(broker);
@@ -94,8 +94,8 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(final Throwable t) {
-                transactionFailed(transaction, t);
+            public void onFailure(final Throwable failure) {
+                transactionFailed(transaction, failure);
             }
         });
 
             }
         });
 
@@ -136,4 +136,4 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
         LOG.debug("Transaction chain {} failed.", this, cause);
         listener.onTransactionChainFailed(this, tx, cause);
     }
         LOG.debug("Transaction chain {} failed.", this, cause);
         listener.onTransactionChainFailed(this, tx, cause);
     }
-}
\ No newline at end of file
+}
index 7ad68f29d68fdd143db65d7487039370841b5ef2..65f11c227401d6ef49cd69df2482f1e93cc51ab9 100644 (file)
@@ -14,12 +14,12 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionFactory;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 
 public class DOMBrokerWriteOnlyTransaction extends AbstractDOMBrokerWriteTransaction<DOMStoreWriteTransaction> {
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 
 public class DOMBrokerWriteOnlyTransaction extends AbstractDOMBrokerWriteTransaction<DOMStoreWriteTransaction> {
+
     /**
     /**
-     * Creates new composite Transactions.
+     * Constructs an instance.
      *
      *
-     * @param identifier
-     *            Identifier of transaction.
-     * @param storeTxFactories
+     * @param identifier identifier of transaction.
+     * @param storeTxFactories the backing transaction store factories
      */
     public DOMBrokerWriteOnlyTransaction(Object identifier,
             Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories,
      */
     public DOMBrokerWriteOnlyTransaction(Object identifier,
             Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories,
index cadb61a4607417c7c422dddf0bfe12c82ad4d404..1badccb8627c28d87483ee52bab12568e80ad07b 100644 (file)
@@ -33,7 +33,8 @@ class ShardedDOMStoreReadTransaction extends AbstractShardedTransaction implemen
     }
 
     @Override
     }
 
     @Override
-    public final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final YangInstanceIdentifier path) {
+    public final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
+            final YangInstanceIdentifier path) {
         return transaction().read(path);
     }
 
         return transaction().read(path);
     }
 
index 7172770f77fb72137db4907366da406bbdc0f7f5..55139d3440ba5147377b2842bea2b7caf4252907 100644 (file)
@@ -19,8 +19,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  *
  * @author Robert Varga
  */
  *
  * @author Robert Varga
  */
-final class ShardedDOMStoreReadWriteTransaction extends ShardedDOMStoreReadTransaction implements DOMStoreReadWriteTransaction {
-
+final class ShardedDOMStoreReadWriteTransaction extends ShardedDOMStoreReadTransaction
+       implements DOMStoreReadWriteTransaction {
     ShardedDOMStoreReadWriteTransaction(final ClientTransaction tx) {
         super(tx);
     }
     ShardedDOMStoreReadWriteTransaction(final ClientTransaction tx) {
         super(tx);
     }
index 6161620583cf6985dd31ec040ccfdb297dd0be4e..4c804d762b1cd5d46974847b6614bb30f699c8f2 100644 (file)
@@ -45,7 +45,7 @@ final class ShardedDOMStoreWriteTransaction extends AbstractShardedTransaction i
     }
 
     @Override
     }
 
     @Override
-    public final void close() {
+    public void close() {
         transaction().abort();
     }
 }
         transaction().abort();
     }
 }
index a253b794db15871f69117f291be14ef4d1193a23..f23f9567a7ddace8fd25ecdf8e651e94efcd1ed1 100644 (file)
@@ -21,9 +21,9 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-abstract class AbstractDataListenerSupport<L extends EventListener, R extends ListenerRegistrationMessage,
-        D extends DelayedListenerRegistration<L, R>, LR extends ListenerRegistration<L>>
-                extends LeaderLocalDelegateFactory<R, LR, Optional<DataTreeCandidate>> {
+abstract class AbstractDataListenerSupport<L extends EventListener, M extends ListenerRegistrationMessage,
+        D extends DelayedListenerRegistration<L, M>, R extends ListenerRegistration<L>>
+                extends LeaderLocalDelegateFactory<M, R, Optional<DataTreeCandidate>> {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     private final ArrayList<D> delayedListenerRegistrations = new ArrayList<>();
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     private final ArrayList<D> delayedListenerRegistrations = new ArrayList<>();
@@ -39,12 +39,12 @@ abstract class AbstractDataListenerSupport<L extends EventListener, R extends Li
         log.debug("{}: onLeadershipChange, isLeader: {}, hasLeader : {}", persistenceId(), isLeader, hasLeader);
 
         final EnableNotification msg = new EnableNotification(isLeader);
         log.debug("{}: onLeadershipChange, isLeader: {}, hasLeader : {}", persistenceId(), isLeader, hasLeader);
 
         final EnableNotification msg = new EnableNotification(isLeader);
-        for(ActorSelection dataChangeListener : actors) {
+        for (ActorSelection dataChangeListener : actors) {
             dataChangeListener.tell(msg, getSelf());
         }
 
             dataChangeListener.tell(msg, getSelf());
         }
 
-        if(hasLeader) {
-            for(D reg : delayedListenerOnAllRegistrations) {
+        if (hasLeader) {
+            for (D reg : delayedListenerOnAllRegistrations) {
                 reg.createDelegate(this);
             }
 
                 reg.createDelegate(this);
             }
 
@@ -52,8 +52,8 @@ abstract class AbstractDataListenerSupport<L extends EventListener, R extends Li
             delayedListenerOnAllRegistrations.trimToSize();
         }
 
             delayedListenerOnAllRegistrations.trimToSize();
         }
 
-        if(isLeader) {
-            for(D reg : delayedListenerRegistrations) {
+        if (isLeader) {
+            for (D reg : delayedListenerRegistrations) {
                 reg.createDelegate(this);
             }
 
                 reg.createDelegate(this);
             }
 
@@ -63,18 +63,18 @@ abstract class AbstractDataListenerSupport<L extends EventListener, R extends Li
     }
 
     @Override
     }
 
     @Override
-    void onMessage(R message, boolean isLeader, boolean hasLeader) {
+    void onMessage(M message, boolean isLeader, boolean hasLeader) {
         log.debug("{}: {} for {}, leader: {}", persistenceId(), logName(), message.getPath(), isLeader);
 
         final ListenerRegistration<L> registration;
         log.debug("{}: {} for {}, leader: {}", persistenceId(), logName(), message.getPath(), isLeader);
 
         final ListenerRegistration<L> registration;
-        if((hasLeader && message.isRegisterOnAllInstances()) || isLeader) {
-            final Entry<LR, Optional<DataTreeCandidate>> res = createDelegate(message);
+        if (hasLeader && message.isRegisterOnAllInstances() || isLeader) {
+            final Entry<R, Optional<DataTreeCandidate>> res = createDelegate(message);
             registration = res.getKey();
         } else {
             log.debug("{}: Shard is not the leader - delaying registration", persistenceId());
 
             D delayedReg = newDelayedListenerRegistration(message);
             registration = res.getKey();
         } else {
             log.debug("{}: Shard is not the leader - delaying registration", persistenceId());
 
             D delayedReg = newDelayedListenerRegistration(message);
-            if(message.isRegisterOnAllInstances()) {
+            if (message.isRegisterOnAllInstances()) {
                 delayedListenerOnAllRegistrations.add(delayedReg);
             } else {
                 delayedListenerRegistrations.add(delayedReg);
                 delayedListenerOnAllRegistrations.add(delayedReg);
             } else {
                 delayedListenerRegistrations.add(delayedReg);
@@ -99,7 +99,7 @@ abstract class AbstractDataListenerSupport<L extends EventListener, R extends Li
         actors.add(actor);
     }
 
         actors.add(actor);
     }
 
-    protected abstract D newDelayedListenerRegistration(R message);
+    protected abstract D newDelayedListenerRegistration(M message);
 
     protected abstract ActorRef newRegistrationActor(ListenerRegistration<L> registration);
 
 
     protected abstract ActorRef newRegistrationActor(ListenerRegistration<L> registration);
 
index 61a22d4c2c958be3dddd5a0197710f3339b9919f..b7356d28bcc5dc5331832c883b9d739e2557feac 100644 (file)
@@ -23,7 +23,8 @@ import org.slf4j.LoggerFactory;
  */
 @NotThreadSafe
 abstract class AbstractShardDataTreeNotificationPublisherActorProxy implements ShardDataTreeNotificationPublisher {
  */
 @NotThreadSafe
 abstract class AbstractShardDataTreeNotificationPublisherActorProxy implements ShardDataTreeNotificationPublisher {
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractShardDataTreeNotificationPublisherActorProxy.class);
+    private static final Logger LOG = LoggerFactory.getLogger(
+            AbstractShardDataTreeNotificationPublisherActorProxy.class);
 
     private final ActorContext actorContext;
     private final String actorName;
 
     private final ActorContext actorContext;
     private final String actorName;
@@ -50,14 +51,15 @@ abstract class AbstractShardDataTreeNotificationPublisherActorProxy implements S
     }
 
     private ActorRef getNotifierActor() {
     }
 
     private ActorRef getNotifierActor() {
-        if(notifierActor == null) {
+        if (notifierActor == null) {
             LOG.debug("Creating actor {}", actorName);
 
             String dispatcher = new Dispatchers(actorContext.system().dispatchers()).getDispatcherPath(
                     Dispatchers.DispatcherType.Notification);
             notifierActor = actorContext.actorOf(ShardDataTreeNotificationPublisherActor.props(actorName)
                     .withDispatcher(dispatcher).withMailbox(
             LOG.debug("Creating actor {}", actorName);
 
             String dispatcher = new Dispatchers(actorContext.system().dispatchers()).getDispatcherPath(
                     Dispatchers.DispatcherType.Notification);
             notifierActor = actorContext.actorOf(ShardDataTreeNotificationPublisherActor.props(actorName)
                     .withDispatcher(dispatcher).withMailbox(
-                            org.opendaylight.controller.cluster.datastore.utils.ActorContext.BOUNDED_MAILBOX), actorName);
+                            org.opendaylight.controller.cluster.datastore.utils.ActorContext.BOUNDED_MAILBOX),
+                    actorName);
         }
 
         return notifierActor;
         }
 
         return notifierActor;
index 377af4d5d70c6eae9314eaad135a84374aa8b519..f7f8af292310e76e5213e47052abef3669351f30 100644 (file)
@@ -57,7 +57,8 @@ abstract class AbstractShardDataTreeTransaction<T extends DataTreeSnapshot> {
 
     @Override
     public final String toString() {
 
     @Override
     public final String toString() {
-        return MoreObjects.toStringHelper(this).add("id", id).add("closed", closed).add("snapshot", snapshot).toString();
+        return MoreObjects.toStringHelper(this).add("id", id).add("closed", closed).add("snapshot", snapshot)
+                .toString();
     }
 
     abstract void abort();
     }
 
     abstract void abort();
index 057dbfa56abd0f08f10477eba6c93df42afd46de..6c4fc6097d5adf2d3d3bb771f5b67647f64b74f8 100644 (file)
@@ -50,7 +50,7 @@ abstract class AbstractTransactionContext implements TransactionContext {
         handOffComplete = true;
     }
 
         handOffComplete = true;
     }
 
-    protected boolean isOperationHandOffComplete(){
+    protected boolean isOperationHandOffComplete() {
         return handOffComplete;
     }
 
         return handOffComplete;
     }
 
index b5afd596bf3b1ded0abdbaceb9c80e309ccaacda..69c69bb84b395dc5d89db35f74cdd44343987c95 100644 (file)
@@ -62,7 +62,9 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
         return historyId;
     }
 
         return historyId;
     }
 
-    private TransactionContext maybeCreateLocalTransactionContext(final TransactionProxy parent, final String shardName) {
+    @SuppressWarnings("checkstyle:IllegalCatch")
+    private TransactionContext maybeCreateLocalTransactionContext(final TransactionProxy parent,
+            final String shardName) {
         final LocalTransactionFactory local = knownLocal.get(shardName);
         if (local != null) {
             LOG.debug("Tx {} - Creating local component for shard {} using factory {}", parent.getIdentifier(),
         final LocalTransactionFactory local = knownLocal.get(shardName);
         if (local != null) {
             LOG.debug("Tx {} - Creating local component for shard {} using factory {}", parent.getIdentifier(),
@@ -70,7 +72,7 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
 
             try {
                 return createLocalTransactionContext(local, parent);
 
             try {
                 return createLocalTransactionContext(local, parent);
-            } catch(Exception e) {
+            } catch (Exception e) {
                 return new NoOpTransactionContext(e, parent.getIdentifier());
             }
         }
                 return new NoOpTransactionContext(e, parent.getIdentifier());
             }
         }
@@ -80,16 +82,14 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
 
     private void onFindPrimaryShardSuccess(PrimaryShardInfo primaryShardInfo, TransactionProxy parent,
             String shardName, TransactionContextWrapper transactionContextWrapper) {
 
     private void onFindPrimaryShardSuccess(PrimaryShardInfo primaryShardInfo, TransactionProxy parent,
             String shardName, TransactionContextWrapper transactionContextWrapper) {
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Tx {}: Found primary {} for shard {}", parent.getIdentifier(),
-                    primaryShardInfo.getPrimaryShardActor(), shardName);
-        }
+        LOG.debug("Tx {}: Found primary {} for shard {}", parent.getIdentifier(),
+                primaryShardInfo.getPrimaryShardActor(), shardName);
 
         updateShardInfo(shardName, primaryShardInfo);
 
         try {
             TransactionContext localContext = maybeCreateLocalTransactionContext(parent, shardName);
 
         updateShardInfo(shardName, primaryShardInfo);
 
         try {
             TransactionContext localContext = maybeCreateLocalTransactionContext(parent, shardName);
-            if(localContext != null) {
+            if (localContext != null) {
                 transactionContextWrapper.executePriorTransactionOperations(localContext);
             } else {
                 RemoteTransactionContextSupport remote = new RemoteTransactionContextSupport(transactionContextWrapper,
                 transactionContextWrapper.executePriorTransactionOperations(localContext);
             } else {
                 RemoteTransactionContextSupport remote = new RemoteTransactionContextSupport(transactionContextWrapper,
@@ -113,14 +113,15 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
         }
     }
 
         }
     }
 
-    final TransactionContextWrapper newTransactionContextWrapper(final TransactionProxy parent, final String shardName) {
+    final TransactionContextWrapper newTransactionContextWrapper(final TransactionProxy parent,
+            final String shardName) {
         final TransactionContextWrapper transactionContextWrapper =
                 new TransactionContextWrapper(parent.getIdentifier(), actorContext);
 
         Future<PrimaryShardInfo> findPrimaryFuture = findPrimaryShard(shardName, parent.getIdentifier());
         final TransactionContextWrapper transactionContextWrapper =
                 new TransactionContextWrapper(parent.getIdentifier(), actorContext);
 
         Future<PrimaryShardInfo> findPrimaryFuture = findPrimaryShard(shardName, parent.getIdentifier());
-        if(findPrimaryFuture.isCompleted()) {
+        if (findPrimaryFuture.isCompleted()) {
             Try<PrimaryShardInfo> maybe = findPrimaryFuture.value().get();
             Try<PrimaryShardInfo> maybe = findPrimaryFuture.value().get();
-            if(maybe.isSuccess()) {
+            if (maybe.isSuccess()) {
                 onFindPrimaryShardSuccess(maybe.get(), parent, shardName, transactionContextWrapper);
             } else {
                 onFindPrimaryShardFailure(maybe.failed().get(), parent, shardName, transactionContextWrapper);
                 onFindPrimaryShardSuccess(maybe.get(), parent, shardName, transactionContextWrapper);
             } else {
                 onFindPrimaryShardFailure(maybe.failed().get(), parent, shardName, transactionContextWrapper);
@@ -144,13 +145,13 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
     private void updateShardInfo(final String shardName, final PrimaryShardInfo primaryShardInfo) {
         final Optional<DataTree> maybeDataTree = primaryShardInfo.getLocalShardDataTree();
         if (maybeDataTree.isPresent()) {
     private void updateShardInfo(final String shardName, final PrimaryShardInfo primaryShardInfo) {
         final Optional<DataTree> maybeDataTree = primaryShardInfo.getLocalShardDataTree();
         if (maybeDataTree.isPresent()) {
-            if(!knownLocal.containsKey(shardName)) {
+            if (!knownLocal.containsKey(shardName)) {
                 LOG.debug("Shard {} resolved to local data tree - adding local factory", shardName);
 
                 F factory = factoryForShard(shardName, primaryShardInfo.getPrimaryShardActor(), maybeDataTree.get());
                 knownLocal.putIfAbsent(shardName, factory);
             }
                 LOG.debug("Shard {} resolved to local data tree - adding local factory", shardName);
 
                 F factory = factoryForShard(shardName, primaryShardInfo.getPrimaryShardActor(), maybeDataTree.get());
                 knownLocal.putIfAbsent(shardName, factory);
             }
-        } else if(knownLocal.containsKey(shardName)) {
+        } else if (knownLocal.containsKey(shardName)) {
             LOG.debug("Shard {} invalidating local data tree", shardName);
 
             knownLocal.remove(shardName);
             LOG.debug("Shard {} invalidating local data tree", shardName);
 
             knownLocal.remove(shardName);
@@ -183,8 +184,8 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
      * Create local transaction factory for specified shard, backed by specified shard leader
      * and data tree instance.
      *
      * Create local transaction factory for specified shard, backed by specified shard leader
      * and data tree instance.
      *
-     * @param shardName
-     * @param shardLeader
+     * @param shardName the shard name
+     * @param shardLeader the shard leader
      * @param dataTree Backing data tree instance. The data tree may only be accessed in
      *                 read-only manner.
      * @return Transaction factory for local use.
      * @param dataTree Backing data tree instance. The data tree may only be accessed in
      *                 read-only manner.
      * @return Transaction factory for local use.
@@ -196,7 +197,8 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
      * be waited for before the next transaction is allocated.
      * @param cohortFutures Collection of futures
      */
      * be waited for before the next transaction is allocated.
      * @param cohortFutures Collection of futures
      */
-    protected abstract <T> void onTransactionReady(@Nonnull TransactionIdentifier transaction, @Nonnull Collection<Future<T>> cohortFutures);
+    protected abstract <T> void onTransactionReady(@Nonnull TransactionIdentifier transaction,
+            @Nonnull Collection<Future<T>> cohortFutures);
 
     /**
      * Callback invoked when the internal TransactionContext has been created for a transaction.
 
     /**
      * Callback invoked when the internal TransactionContext has been created for a transaction.
@@ -208,7 +210,7 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
     private static TransactionContext createLocalTransactionContext(final LocalTransactionFactory factory,
                                                                     final TransactionProxy parent) {
 
     private static TransactionContext createLocalTransactionContext(final LocalTransactionFactory factory,
                                                                     final TransactionProxy parent) {
 
-        switch(parent.getType()) {
+        switch (parent.getType()) {
             case READ_ONLY:
                 final DOMStoreReadTransaction readOnly = factory.newReadOnlyTransaction(parent.getIdentifier());
                 return new LocalTransactionContext(readOnly, parent.getIdentifier(), factory) {
             case READ_ONLY:
                 final DOMStoreReadTransaction readOnly = factory.newReadOnlyTransaction(parent.getIdentifier());
                 return new LocalTransactionContext(readOnly, parent.getIdentifier(), factory) {
@@ -248,8 +250,8 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
                         throw new UnsupportedOperationException();
                     }
                 };
                         throw new UnsupportedOperationException();
                     }
                 };
-             default:
-                 throw new IllegalArgumentException("Invalid transaction type: " + parent.getType());
+            default:
+                throw new IllegalArgumentException("Invalid transaction type: " + parent.getType());
         }
     }
 }
         }
     }
 }
index 401c15b542e61ad7befa9bee17c0bcb0bb2febb2..799dd6eb1bcddc382c48a244bb9ba081377334ad 100644 (file)
@@ -24,7 +24,8 @@ final class ChainedCommitCohort extends ShardDataTreeCohort {
     private final ShardDataTreeTransactionChain chain;
     private final ShardDataTreeCohort delegate;
 
     private final ShardDataTreeTransactionChain chain;
     private final ShardDataTreeCohort delegate;
 
-    ChainedCommitCohort(final ShardDataTreeTransactionChain chain, final ReadWriteShardDataTreeTransaction transaction, final ShardDataTreeCohort delegate) {
+    ChainedCommitCohort(final ShardDataTreeTransactionChain chain, final ReadWriteShardDataTreeTransaction transaction,
+            final ShardDataTreeCohort delegate) {
         this.transaction = Preconditions.checkNotNull(transaction);
         this.delegate = Preconditions.checkNotNull(delegate);
         this.chain = Preconditions.checkNotNull(chain);
         this.transaction = Preconditions.checkNotNull(transaction);
         this.delegate = Preconditions.checkNotNull(delegate);
         this.chain = Preconditions.checkNotNull(chain);
@@ -41,9 +42,9 @@ final class ChainedCommitCohort extends ShardDataTreeCohort {
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(final Throwable t) {
-                LOG.error("Transaction {} commit failed, cannot recover", transaction, t);
-                callback.onFailure(t);
+            public void onFailure(final Throwable failure) {
+                LOG.error("Transaction {} commit failed, cannot recover", transaction, failure);
+                callback.onFailure(failure);
             }
         });
     }
             }
         });
     }
@@ -87,4 +88,4 @@ final class ChainedCommitCohort extends ShardDataTreeCohort {
     public State getState() {
         return delegate.getState();
     }
     public State getState() {
         return delegate.getState();
     }
-}
\ No newline at end of file
+}
index 368796cd0a6e3e8472a3cd9dc6da4359d04877e0..02fb3946b907fe7d784ec19647153a88490944b9 100644 (file)
@@ -14,6 +14,8 @@ import org.opendaylight.controller.cluster.access.concepts.MemberName;
 
 public interface ClusterWrapper {
     void subscribeToMemberEvents(ActorRef actorRef);
 
 public interface ClusterWrapper {
     void subscribeToMemberEvents(ActorRef actorRef);
+
     MemberName getCurrentMemberName();
     MemberName getCurrentMemberName();
+
     Address getSelfAddress();
 }
     Address getSelfAddress();
 }
index 56229132f34c3dec9a61ea1ea4377831f2af3274..38d23f6884ca949e121579da0fb669391ffc058e 100644 (file)
@@ -21,24 +21,23 @@ public class ClusterWrapperImpl implements ClusterWrapper {
     private final MemberName currentMemberName;
     private final Address selfAddress;
 
     private final MemberName currentMemberName;
     private final Address selfAddress;
 
-    public ClusterWrapperImpl(ActorSystem actorSystem){
+    public ClusterWrapperImpl(ActorSystem actorSystem) {
         Preconditions.checkNotNull(actorSystem, "actorSystem should not be null");
 
         cluster = Cluster.get(actorSystem);
 
         Preconditions.checkState(cluster.getSelfRoles().size() > 0,
         Preconditions.checkNotNull(actorSystem, "actorSystem should not be null");
 
         cluster = Cluster.get(actorSystem);
 
         Preconditions.checkState(cluster.getSelfRoles().size() > 0,
-            "No akka roles were specified\n" +
-                "One way to specify the member name is to pass a property on the command line like so\n" +
-                "   -Dakka.cluster.roles.0=member-3\n" +
-                "member-3 here would be the name of the member"
-        );
+            "No akka roles were specified.\n"
+            + "One way to specify the member name is to pass a property on the command line like so\n"
+            + "   -Dakka.cluster.roles.0=member-3\n"
+            + "member-3 here would be the name of the member");
 
         currentMemberName = MemberName.forName(cluster.getSelfRoles().iterator().next());
         selfAddress = cluster.selfAddress();
     }
 
     @Override
 
         currentMemberName = MemberName.forName(cluster.getSelfRoles().iterator().next());
         selfAddress = cluster.selfAddress();
     }
 
     @Override
-    public void subscribeToMemberEvents(ActorRef actorRef){
+    public void subscribeToMemberEvents(ActorRef actorRef) {
         Preconditions.checkNotNull(actorRef, "actorRef should not be null");
 
         cluster.subscribe(actorRef, ClusterEvent.initialStateAsEvents(),
         Preconditions.checkNotNull(actorRef, "actorRef should not be null");
 
         cluster.subscribe(actorRef, ClusterEvent.initialStateAsEvents(),
index 767749af29900a2c298758ec78e54e26768b8dc7..f585bb66c35a985c12fd73a0b83dedf91a10f62b 100644 (file)
@@ -80,16 +80,17 @@ final class CohortEntry {
         return lastBatchedModificationsException;
     }
 
         return lastBatchedModificationsException;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     void applyModifications(final Iterable<Modification> modifications) {
         totalBatchedModificationsReceived++;
     void applyModifications(final Iterable<Modification> modifications) {
         totalBatchedModificationsReceived++;
-        if(lastBatchedModificationsException == null) {
+        if (lastBatchedModificationsException == null) {
             for (Modification modification : modifications) {
             for (Modification modification : modifications) {
-                    try {
-                        modification.apply(transaction.getSnapshot());
-                    } catch (RuntimeException e) {
-                        lastBatchedModificationsException = e;
-                        throw e;
-                    }
+                try {
+                    modification.apply(transaction.getSnapshot());
+                } catch (RuntimeException e) {
+                    lastBatchedModificationsException = e;
+                    throw e;
+                }
             }
         }
     }
             }
         }
     }
@@ -115,7 +116,7 @@ final class CohortEntry {
 
         cohort = transaction.ready();
 
 
         cohort = transaction.ready();
 
-        if(cohortDecorator != null) {
+        if (cohortDecorator != null) {
             // Call the hook for unit tests.
             cohort = cohortDecorator.decorate(transactionID, cohort);
         }
             // Call the hook for unit tests.
             cohort = cohortDecorator.decorate(transactionID, cohort);
         }
@@ -152,4 +153,4 @@ final class CohortEntry {
                 .append(doImmediateCommit).append("]");
         return builder.toString();
     }
                 .append(doImmediateCommit).append("]");
         return builder.toString();
     }
-}
\ No newline at end of file
+}
index 8115473a0565fb2c3865f4bc03e7216a8029a579..05b9981113a039a75b3679698d9ddd61e8d97318 100644 (file)
@@ -13,7 +13,6 @@ import akka.actor.Status.Failure;
 import akka.dispatch.ExecutionContexts;
 import akka.dispatch.Futures;
 import akka.dispatch.Recover;
 import akka.dispatch.ExecutionContexts;
 import akka.dispatch.Futures;
 import akka.dispatch.Recover;
-import akka.japi.Function;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
 import com.google.common.base.Preconditions;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
 import com.google.common.base.Preconditions;
@@ -33,9 +32,8 @@ import scala.concurrent.Await;
 import scala.concurrent.Future;
 
 /**
 import scala.concurrent.Future;
 
 /**
- *
  * Composite cohort, which coordinates multiple user-provided cohorts as if it was only one cohort.
  * Composite cohort, which coordinates multiple user-provided cohorts as if it was only one cohort.
- *
+ * <p/>
  * It tracks current operation and list of cohorts which successfuly finished previous phase in
  * case, if abort is necessary to invoke it only on cohort steps which are still active.
  *
  * It tracks current operation and list of cohorts which successfuly finished previous phase in
  * case, if abort is necessary to invoke it only on cohort steps which are still active.
  *
@@ -73,13 +71,10 @@ class CompositeDataTreeCohort {
         COMMITED,
         /**
          * Some of cohorts responsed back with unsuccessful message.
         COMMITED,
         /**
          * Some of cohorts responsed back with unsuccessful message.
-         *
          */
         FAILED,
         /**
          */
         FAILED,
         /**
-         *
          * Abort message was send to all cohorts which responded with success previously.
          * Abort message was send to all cohorts which responded with success previously.
-         *
          */
         ABORTED
     }
          */
         ABORTED
     }
@@ -110,14 +105,9 @@ class CompositeDataTreeCohort {
     void canCommit(final DataTreeCandidate tip) throws ExecutionException, TimeoutException {
         Collection<CanCommit> messages = registry.createCanCommitMessages(txId, tip, schema);
         // FIXME: Optimize empty collection list with pre-created futures, containing success.
     void canCommit(final DataTreeCandidate tip) throws ExecutionException, TimeoutException {
         Collection<CanCommit> messages = registry.createCanCommitMessages(txId, tip, schema);
         // FIXME: Optimize empty collection list with pre-created futures, containing success.
-        Future<Iterable<Object>> canCommitsFuture =
-                Futures.traverse(messages, new Function<CanCommit, Future<Object>>() {
-                    @Override
-                    public Future<Object> apply(final CanCommit input) {
-                        return Patterns.ask(input.getCohort(), input, timeout).recover(EXCEPTION_TO_MESSAGE,
-                                ExecutionContexts.global());
-                    }
-                }, ExecutionContexts.global());
+        Future<Iterable<Object>> canCommitsFuture = Futures.traverse(messages,
+            input -> Patterns.ask(input.getCohort(), input, timeout).recover(EXCEPTION_TO_MESSAGE,
+                    ExecutionContexts.global()), ExecutionContexts.global());
         changeStateFrom(State.IDLE, State.CAN_COMMIT_SENT);
         processResponses(canCommitsFuture, State.CAN_COMMIT_SENT, State.CAN_COMMIT_SUCCESSFUL);
     }
         changeStateFrom(State.IDLE, State.CAN_COMMIT_SENT);
         processResponses(canCommitsFuture, State.CAN_COMMIT_SENT, State.CAN_COMMIT_SUCCESSFUL);
     }
@@ -145,18 +135,13 @@ class CompositeDataTreeCohort {
     }
 
     private Future<Iterable<Object>> sendMesageToSuccessful(final Object message) {
     }
 
     private Future<Iterable<Object>> sendMesageToSuccessful(final Object message) {
-        return Futures.traverse(successfulFromPrevious, new Function<DataTreeCohortActor.Success, Future<Object>>() {
-
-            @Override
-            public Future<Object> apply(final DataTreeCohortActor.Success cohortResponse) throws Exception {
-                return Patterns.ask(cohortResponse.getCohort(), message, timeout);
-            }
-
-        }, ExecutionContexts.global());
+        return Futures.traverse(successfulFromPrevious, cohortResponse -> Patterns.ask(
+                cohortResponse.getCohort(), message, timeout), ExecutionContexts.global());
     }
 
     }
 
-    private void processResponses(final Future<Iterable<Object>> resultsFuture, final State currentState, final State afterState)
-            throws TimeoutException, ExecutionException {
+    @SuppressWarnings("checkstyle:IllegalCatch")
+    private void processResponses(final Future<Iterable<Object>> resultsFuture, final State currentState,
+            final State afterState) throws TimeoutException, ExecutionException {
         final Iterable<Object> results;
         try {
             results = Await.result(resultsFuture, timeout.duration());
         final Iterable<Object> results;
         try {
             results = Await.result(resultsFuture, timeout.duration());
index d572beb4d4d668dfc574599ea51cced32a27fd54..b79f3045f63dbeadbe9b52f5929b35793aeb5a4d 100644 (file)
@@ -20,16 +20,14 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
 
 /**
+ * Actor for a DataChangeListener.
+ *
  * @Deprecated Replaced by {@link DataTreeChangeListener}
  */
 @Deprecated
 public class DataChangeListener extends AbstractUntypedActor {
  * @Deprecated Replaced by {@link DataTreeChangeListener}
  */
 @Deprecated
 public class DataChangeListener extends AbstractUntypedActor {
-    private static final Logger LOG = LoggerFactory.getLogger(DataChangeListener.class);
-
     private final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener;
     private boolean notificationsEnabled = false;
 
     private final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener;
     private boolean notificationsEnabled = false;
 
@@ -39,9 +37,9 @@ public class DataChangeListener extends AbstractUntypedActor {
 
     @Override
     public void handleReceive(Object message) {
 
     @Override
     public void handleReceive(Object message) {
-        if (message instanceof DataChanged){
+        if (message instanceof DataChanged) {
             dataChanged(message);
             dataChanged(message);
-        } else if (message instanceof EnableNotification){
+        } else if (message instanceof EnableNotification) {
             enableNotification((EnableNotification) message);
         } else {
             unknownMessage(message);
             enableNotification((EnableNotification) message);
         } else {
             unknownMessage(message);
@@ -50,14 +48,15 @@ public class DataChangeListener extends AbstractUntypedActor {
 
     private void enableNotification(EnableNotification message) {
         notificationsEnabled = message.isEnabled();
 
     private void enableNotification(EnableNotification message) {
         notificationsEnabled = message.isEnabled();
-        LOG.debug("{} notifications for listener {}", (notificationsEnabled ? "Enabled" : "Disabled"),
+        LOG.debug("{} notifications for listener {}", notificationsEnabled ? "Enabled" : "Disabled",
                 listener);
     }
 
                 listener);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void dataChanged(Object message) {
 
         // Do nothing if notifications are not enabled
     private void dataChanged(Object message) {
 
         // Do nothing if notifications are not enabled
-        if(!notificationsEnabled) {
+        if (!notificationsEnabled) {
             LOG.debug("Notifications not enabled for listener {} - dropping change notification", listener);
             return;
         }
             LOG.debug("Notifications not enabled for listener {} - dropping change notification", listener);
             return;
         }
@@ -73,7 +72,7 @@ public class DataChangeListener extends AbstractUntypedActor {
             LOG.error( String.format( "Error notifying listener %s", this.listener ), e );
         }
 
             LOG.error( String.format( "Error notifying listener %s", this.listener ), e );
         }
 
-        if(isValidSender(getSender())) {
+        if (isValidSender(getSender())) {
             getSender().tell(DataChangedReply.INSTANCE, getSelf());
         }
     }
             getSender().tell(DataChangedReply.INSTANCE, getSelf());
         }
     }
index afec1a07d484d0852abe626d1a387e607014b8c6..d70dcb22e4778eebc1219b105245715f23418dc9 100644 (file)
@@ -18,9 +18,9 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
- * DataChangeListenerProxy represents a single remote DataChangeListener
+ * DataChangeListenerProxy represents a single remote DataChangeListener.
  */
  */
-public class DataChangeListenerProxy implements AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>{
+public class DataChangeListenerProxy implements AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
     private final ActorSelection dataChangeListenerActor;
 
     public DataChangeListenerProxy(ActorSelection dataChangeListenerActor) {
     private final ActorSelection dataChangeListenerActor;
 
     public DataChangeListenerProxy(ActorSelection dataChangeListenerActor) {
index 29e4a1a9fcfb20ae33091ca0ebc9e90264a676d0..06ad83c99035843358c86268130c4dacd5fead4c 100644 (file)
@@ -38,15 +38,15 @@ public class DataChangeListenerRegistrationActor extends AbstractUntypedActor {
         }
     }
 
         }
     }
 
-    public static Props props(
-        final ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+    public static Props props(final ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier,
+            NormalizedNode<?, ?>>> registration) {
         return Props.create(new DataChangeListenerRegistrationCreator(registration));
     }
 
     private void closeListenerRegistration() {
         registration.close();
 
         return Props.create(new DataChangeListenerRegistrationCreator(registration));
     }
 
     private void closeListenerRegistration() {
         registration.close();
 
-        if(isValidSender(getSender())) {
+        if (isValidSender(getSender())) {
             getSender().tell(CloseDataChangeListenerRegistrationReply.INSTANCE, getSelf());
         }
 
             getSender().tell(CloseDataChangeListenerRegistrationReply.INSTANCE, getSelf());
         }
 
index 534beead0ed4d256c4626870fbee54582add8d9f..9eba41aac73efb900bd33b3fe52e43c33e655eff 100644 (file)
@@ -49,8 +49,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
     private boolean closed = false;
 
     public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
     private boolean closed = false;
 
     public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
-                                                              DataChangeListenerRegistrationProxy (
-            String shardName, ActorContext actorContext, L listener) {
+            DataChangeListenerRegistrationProxy(String shardName, ActorContext actorContext, L listener) {
         this.shardName = shardName;
         this.actorContext = actorContext;
         this.listener = listener;
         this.shardName = shardName;
         this.actorContext = actorContext;
         this.listener = listener;
@@ -72,20 +71,20 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
     }
 
     private void setListenerRegistrationActor(ActorSelection listenerRegistrationActor) {
     }
 
     private void setListenerRegistrationActor(ActorSelection listenerRegistrationActor) {
-        if(listenerRegistrationActor == null) {
+        if (listenerRegistrationActor == null) {
             return;
         }
 
         boolean sendCloseMessage = false;
             return;
         }
 
         boolean sendCloseMessage = false;
-        synchronized(this) {
-            if(closed) {
+        synchronized (this) {
+            if (closed) {
                 sendCloseMessage = true;
             } else {
                 this.listenerRegistrationActor = listenerRegistrationActor;
             }
         }
 
                 sendCloseMessage = true;
             } else {
                 this.listenerRegistrationActor = listenerRegistrationActor;
             }
         }
 
-        if(sendCloseMessage) {
+        if (sendCloseMessage) {
             listenerRegistrationActor.tell(CloseDataChangeListenerRegistration.INSTANCE, null);
         }
     }
             listenerRegistrationActor.tell(CloseDataChangeListenerRegistration.INSTANCE, null);
         }
     }
@@ -99,12 +98,12 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
         findFuture.onComplete(new OnComplete<ActorRef>() {
             @Override
             public void onComplete(Throwable failure, ActorRef shard) {
         findFuture.onComplete(new OnComplete<ActorRef>() {
             @Override
             public void onComplete(Throwable failure, ActorRef shard) {
-                if(failure instanceof LocalShardNotFoundException) {
-                    LOG.debug("No local shard found for {} - DataChangeListener {} at path {} " +
-                            "cannot be registered", shardName, listener, path);
-                } else if(failure != null) {
-                    LOG.error("Failed to find local shard {} - DataChangeListener {} at path {} " +
-                            "cannot be registered: {}", shardName, listener, path, failure);
+                if (failure instanceof LocalShardNotFoundException) {
+                    LOG.debug("No local shard found for {} - DataChangeListener {} at path {} "
+                            "cannot be registered", shardName, listener, path);
+                } else if (failure != null) {
+                    LOG.error("Failed to find local shard {} - DataChangeListener {} at path {} "
+                            "cannot be registered: {}", shardName, listener, path, failure);
                 } else {
                     doRegistration(shard, path, scope);
                 }
                 } else {
                     doRegistration(shard, path, scope);
                 }
@@ -120,10 +119,10 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
                     listener instanceof ClusteredDOMDataChangeListener),
                 actorContext.getDatastoreContext().getShardInitializationTimeout());
 
                     listener instanceof ClusteredDOMDataChangeListener),
                 actorContext.getDatastoreContext().getShardInitializationTimeout());
 
-        future.onComplete(new OnComplete<Object>(){
+        future.onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(Throwable failure, Object result) {
             @Override
             public void onComplete(Throwable failure, Object result) {
-                if(failure != null) {
+                if (failure != null) {
                     LOG.error("Failed to register DataChangeListener {} at path {}",
                             listener, path.toString(), failure);
                 } else {
                     LOG.error("Failed to register DataChangeListener {} at path {}",
                             listener, path.toString(), failure);
                 } else {
@@ -139,17 +138,17 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
     public void close() {
 
         boolean sendCloseMessage;
     public void close() {
 
         boolean sendCloseMessage;
-        synchronized(this) {
+        synchronized (this) {
             sendCloseMessage = !closed && listenerRegistrationActor != null;
             closed = true;
         }
 
             sendCloseMessage = !closed && listenerRegistrationActor != null;
             closed = true;
         }
 
-        if(sendCloseMessage) {
+        if (sendCloseMessage) {
             listenerRegistrationActor.tell(CloseDataChangeListenerRegistration.INSTANCE, ActorRef.noSender());
             listenerRegistrationActor = null;
         }
 
             listenerRegistrationActor.tell(CloseDataChangeListenerRegistration.INSTANCE, ActorRef.noSender());
             listenerRegistrationActor = null;
         }
 
-        if(dataChangeListenerActor != null) {
+        if (dataChangeListenerActor != null) {
             dataChangeListenerActor.tell(PoisonPill.getInstance(), ActorRef.noSender());
             dataChangeListenerActor = null;
         }
             dataChangeListenerActor.tell(PoisonPill.getInstance(), ActorRef.noSender());
             dataChangeListenerActor = null;
         }
index f4b6bcc9fd56801a2ea077151a947627e2099595..26d8fa1b646af75e2775eea23a72d64ae75e28c8 100644 (file)
@@ -42,7 +42,7 @@ final class DataChangeListenerSupport extends AbstractDataListenerSupport<
 
         // Now store a reference to the data change listener so it can be notified
         // at a later point if notifications should be enabled or disabled
 
         // Now store a reference to the data change listener so it can be notified
         // at a later point if notifications should be enabled or disabled
-        if(!message.isRegisterOnAllInstances()) {
+        if (!message.isRegisterOnAllInstances()) {
             addListenerActor(dataChangeListenerPath);
         }
 
             addListenerActor(dataChangeListenerPath);
         }
 
index f40438b269e2fdaf571e0d12b914ea38af3831e0..d11ce38d72e7a6edd60711d446f268c90e457569 100644 (file)
@@ -20,6 +20,8 @@ import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payloa
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
 /**
+ * Payload wrapper for a DataTreeCandidatePayload.
+ *
  * @deprecated Deprecated in Boron in favor of CommitTransactionPayload
  */
 @Deprecated
  * @deprecated Deprecated in Boron in favor of CommitTransactionPayload
  */
 @Deprecated
@@ -28,6 +30,9 @@ final class DataTreeCandidatePayload extends Payload implements Externalizable,
 
     private transient byte[] serialized;
 
 
     private transient byte[] serialized;
 
+    // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+    // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+    @SuppressWarnings("checkstyle:RedundantModifier")
     public DataTreeCandidatePayload() {
         // Required by Externalizable
     }
     public DataTreeCandidatePayload() {
         // Required by Externalizable
     }
@@ -37,6 +42,8 @@ final class DataTreeCandidatePayload extends Payload implements Externalizable,
     }
 
     /**
     }
 
     /**
+     * Creates a DataTreeCandidatePayload.
+     *
      * @deprecated Use CommitTransactionPayload instead
      */
     @Deprecated
      * @deprecated Use CommitTransactionPayload instead
      */
     @Deprecated
index 03978f2b66387bcd483b05bcc58c4afb9ac7db8b..b3e0fb6d6f5d7a11c1afd8ae181a6221ea4c568a 100644 (file)
@@ -15,15 +15,12 @@ import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChangedReply;
 import org.opendaylight.controller.cluster.datastore.messages.EnableNotification;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChangedReply;
 import org.opendaylight.controller.cluster.datastore.messages.EnableNotification;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Proxy actor which acts as a facade to the user-provided listener. Responsible for decapsulating
  * DataTreeChanged messages and dispatching their context to the user.
  */
 final class DataTreeChangeListenerActor extends AbstractUntypedActor {
 
 /**
  * Proxy actor which acts as a facade to the user-provided listener. Responsible for decapsulating
  * DataTreeChanged messages and dispatching their context to the user.
  */
 final class DataTreeChangeListenerActor extends AbstractUntypedActor {
-    private static final Logger LOG = LoggerFactory.getLogger(DataTreeChangeListenerActor.class);
     private final DOMDataTreeChangeListener listener;
     private boolean notificationsEnabled = false;
 
     private final DOMDataTreeChangeListener listener;
     private boolean notificationsEnabled = false;
 
@@ -42,6 +39,7 @@ final class DataTreeChangeListenerActor extends AbstractUntypedActor {
         }
     }
 
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void dataChanged(final DataTreeChanged message) {
         // Do nothing if notifications are not enabled
         if (!notificationsEnabled) {
     private void dataChanged(final DataTreeChanged message) {
         // Do nothing if notifications are not enabled
         if (!notificationsEnabled) {
@@ -67,7 +65,7 @@ final class DataTreeChangeListenerActor extends AbstractUntypedActor {
 
     private void enableNotification(final EnableNotification message) {
         notificationsEnabled = message.isEnabled();
 
     private void enableNotification(final EnableNotification message) {
         notificationsEnabled = message.isEnabled();
-        LOG.debug("{} notifications for listener {}", (notificationsEnabled ? "Enabled" : "Disabled"),
+        LOG.debug("{} notifications for listener {}", notificationsEnabled ? "Enabled" : "Disabled",
                 listener);
     }
 
                 listener);
     }
 
index a45ae52afd4abde5f7bb8fd10df8063c7d571a38..4776f2e0438b43cc256286f68a0969ce3f542993 100644 (file)
@@ -41,11 +41,12 @@ final class DataTreeChangeListenerProxy<T extends DOMDataTreeChangeListener> ext
     @GuardedBy("this")
     private ActorSelection listenerRegistrationActor;
 
     @GuardedBy("this")
     private ActorSelection listenerRegistrationActor;
 
-    public DataTreeChangeListenerProxy(final ActorContext actorContext, final T listener) {
+    DataTreeChangeListenerProxy(final ActorContext actorContext, final T listener) {
         super(listener);
         this.actorContext = Preconditions.checkNotNull(actorContext);
         this.dataChangeListenerActor = actorContext.getActorSystem().actorOf(
         super(listener);
         this.actorContext = Preconditions.checkNotNull(actorContext);
         this.dataChangeListenerActor = actorContext.getActorSystem().actorOf(
-            DataTreeChangeListenerActor.props(getInstance()).withDispatcher(actorContext.getNotificationDispatcherPath()));
+                DataTreeChangeListenerActor.props(getInstance())
+                    .withDispatcher(actorContext.getNotificationDispatcherPath()));
     }
 
     @Override
     }
 
     @Override
@@ -64,11 +65,11 @@ final class DataTreeChangeListenerProxy<T extends DOMDataTreeChangeListener> ext
             @Override
             public void onComplete(final Throwable failure, final ActorRef shard) {
                 if (failure instanceof LocalShardNotFoundException) {
             @Override
             public void onComplete(final Throwable failure, final ActorRef shard) {
                 if (failure instanceof LocalShardNotFoundException) {
-                    LOG.debug("No local shard found for {} - DataTreeChangeListener {} at path {} " +
-                            "cannot be registered", shardName, getInstance(), treeId);
+                    LOG.debug("No local shard found for {} - DataTreeChangeListener {} at path {} "
+                            "cannot be registered", shardName, getInstance(), treeId);
                 } else if (failure != null) {
                 } else if (failure != null) {
-                    LOG.error("Failed to find local shard {} - DataTreeChangeListener {} at path {} " +
-                            "cannot be registered: {}", shardName, getInstance(), treeId, failure);
+                    LOG.error("Failed to find local shard {} - DataTreeChangeListener {} at path {} "
+                            "cannot be registered: {}", shardName, getInstance(), treeId, failure);
                 } else {
                     doRegistration(shard, treeId);
                 }
                 } else {
                     doRegistration(shard, treeId);
                 }
@@ -100,7 +101,7 @@ final class DataTreeChangeListenerProxy<T extends DOMDataTreeChangeListener> ext
                         getInstance() instanceof ClusteredDOMDataTreeChangeListener),
                 actorContext.getDatastoreContext().getShardInitializationTimeout());
 
                         getInstance() instanceof ClusteredDOMDataTreeChangeListener),
                 actorContext.getDatastoreContext().getShardInitializationTimeout());
 
-        future.onComplete(new OnComplete<Object>(){
+        future.onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(final Throwable failure, final Object result) {
                 if (failure != null) {
             @Override
             public void onComplete(final Throwable failure, final Object result) {
                 if (failure != null) {
index 5994f30ab007df13a347359972b1b9287e2bf59b..79da59f9645949c91383abf860cccfa93393cfdd 100644 (file)
@@ -32,7 +32,7 @@ public final class DataTreeChangeListenerRegistrationActor extends AbstractUntyp
     protected void handleReceive(Object message) throws Exception {
         if (message instanceof CloseDataTreeChangeListenerRegistration) {
             registration.close();
     protected void handleReceive(Object message) throws Exception {
         if (message instanceof CloseDataTreeChangeListenerRegistration) {
             registration.close();
-            if(isValidSender(getSender())) {
+            if (isValidSender(getSender())) {
                 getSender().tell(CloseDataTreeChangeListenerRegistrationReply.getInstance(), getSelf());
             }
 
                 getSender().tell(CloseDataTreeChangeListenerRegistrationReply.getInstance(), getSelf());
             }
 
@@ -46,7 +46,8 @@ public final class DataTreeChangeListenerRegistrationActor extends AbstractUntyp
         return Props.create(new DataTreeChangeListenerRegistrationCreator(registration));
     }
 
         return Props.create(new DataTreeChangeListenerRegistrationCreator(registration));
     }
 
-    private static final class DataTreeChangeListenerRegistrationCreator implements Creator<DataTreeChangeListenerRegistrationActor> {
+    private static final class DataTreeChangeListenerRegistrationCreator
+            implements Creator<DataTreeChangeListenerRegistrationActor> {
         private static final long serialVersionUID = 1L;
         final ListenerRegistration<DOMDataTreeChangeListener> registration;
 
         private static final long serialVersionUID = 1L;
         final ListenerRegistration<DOMDataTreeChangeListener> registration;
 
index fa55523db0087467d4919075cbc39abc2a46621b..f039ab707ba76fa4749c7895469d2c5af40b12ba 100644 (file)
@@ -19,7 +19,8 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
 final class DataTreeChangeListenerSupport extends AbstractDataListenerSupport<DOMDataTreeChangeListener,
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
 final class DataTreeChangeListenerSupport extends AbstractDataListenerSupport<DOMDataTreeChangeListener,
-        RegisterDataTreeChangeListener, DelayedDataTreeListenerRegistration, ListenerRegistration<DOMDataTreeChangeListener>> {
+        RegisterDataTreeChangeListener, DelayedDataTreeListenerRegistration,
+        ListenerRegistration<DOMDataTreeChangeListener>> {
     DataTreeChangeListenerSupport(final Shard shard) {
         super(shard);
     }
     DataTreeChangeListenerSupport(final Shard shard) {
         super(shard);
     }
@@ -36,7 +37,7 @@ final class DataTreeChangeListenerSupport extends AbstractDataListenerSupport<DO
 
         // Now store a reference to the data change listener so it can be notified
         // at a later point if notifications should be enabled or disabled
 
         // Now store a reference to the data change listener so it can be notified
         // at a later point if notifications should be enabled or disabled
-        if(!message.isRegisterOnAllInstances()) {
+        if (!message.isRegisterOnAllInstances()) {
             addListenerActor(dataChangeListenerPath);
         }
 
             addListenerActor(dataChangeListenerPath);
         }
 
@@ -54,7 +55,8 @@ final class DataTreeChangeListenerSupport extends AbstractDataListenerSupport<DO
     }
 
     @Override
     }
 
     @Override
-    protected DelayedDataTreeListenerRegistration newDelayedListenerRegistration(RegisterDataTreeChangeListener message) {
+    protected DelayedDataTreeListenerRegistration newDelayedListenerRegistration(
+            RegisterDataTreeChangeListener message) {
         return new DelayedDataTreeListenerRegistration(message);
     }
 
         return new DelayedDataTreeListenerRegistration(message);
     }
 
index 10ffe1f7b7dd40793820caa078b58be7855a65e1..0be8f0986557f75a763b557c3c62f84fb63b682d 100644 (file)
@@ -20,15 +20,12 @@ import org.opendaylight.mdsal.common.api.ThreePhaseCommitStep;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCandidate;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCandidate;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Proxy actor which acts as a facade to the user-provided commit cohort. Responsible for
  * decapsulating DataTreeChanged messages and dispatching their context to the user.
  */
 final class DataTreeCohortActor extends AbstractUntypedActor {
 
 /**
  * Proxy actor which acts as a facade to the user-provided commit cohort. Responsible for
  * decapsulating DataTreeChanged messages and dispatching their context to the user.
  */
 final class DataTreeCohortActor extends AbstractUntypedActor {
-    private static final Logger LOG = LoggerFactory.getLogger(DataTreeCohortActor.class);
     private final CohortBehaviour<?> idleState = new Idle();
     private final DOMDataTreeCommitCohort cohort;
     private CohortBehaviour<?> currentState = idleState;
     private final CohortBehaviour<?> idleState = new Idle();
     private final DOMDataTreeCommitCohort cohort;
     private CohortBehaviour<?> currentState = idleState;
@@ -48,7 +45,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
      *
      * @param <R> Reply message type
      */
      *
      * @param <R> Reply message type
      */
-    static abstract class CommitProtocolCommand<R extends CommitReply> {
+    abstract static class CommitProtocolCommand<R extends CommitReply> {
 
         private final TransactionIdentifier txId;
 
 
         private final TransactionIdentifier txId;
 
@@ -88,7 +85,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
 
     }
 
 
     }
 
-    static abstract class CommitReply {
+    abstract static class CommitReply {
 
         private final ActorRef cohortRef;
         private final TransactionIdentifier txId;
 
         private final ActorRef cohortRef;
         private final TransactionIdentifier txId;
@@ -109,7 +106,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
 
     static final class Success extends CommitReply {
 
 
     static final class Success extends CommitReply {
 
-        public Success(ActorRef cohortRef, TransactionIdentifier txId) {
+        Success(ActorRef cohortRef, TransactionIdentifier txId) {
             super(cohortRef, txId);
         }
 
             super(cohortRef, txId);
         }
 
@@ -117,26 +114,26 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
 
     static final class PreCommit extends CommitProtocolCommand<Success> {
 
 
     static final class PreCommit extends CommitProtocolCommand<Success> {
 
-        public PreCommit(TransactionIdentifier txId) {
+        PreCommit(TransactionIdentifier txId) {
             super(txId);
         }
     }
 
     static final class Abort extends CommitProtocolCommand<Success> {
 
             super(txId);
         }
     }
 
     static final class Abort extends CommitProtocolCommand<Success> {
 
-        public Abort(TransactionIdentifier txId) {
+        Abort(TransactionIdentifier txId) {
             super(txId);
         }
     }
 
     static final class Commit extends CommitProtocolCommand<Success> {
 
             super(txId);
         }
     }
 
     static final class Commit extends CommitProtocolCommand<Success> {
 
-        public Commit(TransactionIdentifier txId) {
+        Commit(TransactionIdentifier txId) {
             super(txId);
         }
     }
 
             super(txId);
         }
     }
 
-    private static abstract class CohortBehaviour<E> {
+    private abstract static class CohortBehaviour<E> {
 
         abstract Class<E> getHandledMessageType();
 
 
         abstract Class<E> getHandledMessageType();
 
@@ -163,6 +160,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
         }
 
         @Override
         }
 
         @Override
+        @SuppressWarnings("checkstyle:IllegalCatch")
         CohortBehaviour<?> process(CanCommit message) {
             final PostCanCommitStep nextStep;
             try {
         CohortBehaviour<?> process(CanCommit message) {
             final PostCanCommitStep nextStep;
             try {
@@ -203,6 +201,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
         }
 
         @Override
         }
 
         @Override
+        @SuppressWarnings("checkstyle:IllegalCatch")
         final CohortBehaviour<?> abort() {
             try {
                 getStep().abort().get();
         final CohortBehaviour<?> abort() {
             try {
                 getStep().abort().get();
@@ -229,6 +228,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
         }
 
         @Override
         }
 
         @Override
+        @SuppressWarnings("checkstyle:IllegalCatch")
         CohortBehaviour<?> process(PreCommit message) {
             final PostPreCommitStep nextStep;
             try {
         CohortBehaviour<?> process(PreCommit message) {
             final PostPreCommitStep nextStep;
             try {
@@ -250,6 +250,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
         }
 
         @Override
         }
 
         @Override
+        @SuppressWarnings("checkstyle:IllegalCatch")
         CohortBehaviour<?> process(Commit message) {
             try {
                 getStep().commit().get();
         CohortBehaviour<?> process(Commit message) {
             try {
                 getStep().commit().get();
index fb3743d426d1ac4636db0d43b8cef37eb7094b27..4364e22d2ba85120e2c162d23f1547578caff589 100644 (file)
@@ -48,7 +48,7 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
 
     private final Map<ActorRef, RegistrationTreeNode<ActorRef>> cohortToNode = new HashMap<>();
 
 
     private final Map<ActorRef, RegistrationTreeNode<ActorRef>> cohortToNode = new HashMap<>();
 
-
+    @SuppressWarnings("checkstyle:IllegalCatch")
     void registerCohort(final ActorRef sender, final RegisterCohort cohort) {
         takeLock();
         try {
     void registerCohort(final ActorRef sender, final RegisterCohort cohort) {
         takeLock();
         try {
@@ -92,7 +92,7 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
         }
     }
 
         }
     }
 
-    static abstract class CohortRegistryCommand {
+    abstract static class CohortRegistryCommand {
 
         private final ActorRef cohort;
 
 
         private final ActorRef cohort;
 
@@ -137,7 +137,8 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
         private final Collection<DataTreeCohortActor.CanCommit> messages =
                 new ArrayList<>();
 
         private final Collection<DataTreeCohortActor.CanCommit> messages =
                 new ArrayList<>();
 
-        CanCommitMessageBuilder(final TransactionIdentifier txId, final DataTreeCandidate candidate, final SchemaContext schema) {
+        CanCommitMessageBuilder(final TransactionIdentifier txId, final DataTreeCandidate candidate,
+                final SchemaContext schema) {
             this.txId = Preconditions.checkNotNull(txId);
             this.candidate = Preconditions.checkNotNull(candidate);
             this.schema = schema;
             this.txId = Preconditions.checkNotNull(txId);
             this.candidate = Preconditions.checkNotNull(candidate);
             this.schema = schema;
@@ -160,8 +161,8 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
             }
         }
 
             }
         }
 
-        private void lookupAndCreateCanCommits(final YangInstanceIdentifier path, final RegistrationTreeNode<ActorRef> regNode,
-                final DataTreeCandidateNode candNode) {
+        private void lookupAndCreateCanCommits(final YangInstanceIdentifier path,
+                final RegistrationTreeNode<ActorRef> regNode, final DataTreeCandidateNode candNode) {
             if (candNode.getModificationType() == ModificationType.UNMODIFIED) {
                 LOG.debug("Skipping unmodified candidate {}", path);
                 return;
             if (candNode.getModificationType() == ModificationType.UNMODIFIED) {
                 LOG.debug("Skipping unmodified candidate {}", path);
                 return;
@@ -189,9 +190,9 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
 
         private void createCanCommits(final Collection<ActorRef> regs, final YangInstanceIdentifier path,
                 final DataTreeCandidateNode node) {
 
         private void createCanCommits(final Collection<ActorRef> regs, final YangInstanceIdentifier path,
                 final DataTreeCandidateNode node) {
-            final DOMDataTreeCandidate candidate = DOMDataTreeCandidateTO.create(treeIdentifier(path), node);
+            final DOMDataTreeCandidate domCandidate = DOMDataTreeCandidateTO.create(treeIdentifier(path), node);
             for (final ActorRef reg : regs) {
             for (final ActorRef reg : regs) {
-                final CanCommit message = new DataTreeCohortActor.CanCommit(txId, candidate, schema, reg);
+                final CanCommit message = new DataTreeCohortActor.CanCommit(txId, domCandidate, schema, reg);
                 messages.add(message);
             }
         }
                 messages.add(message);
             }
         }
index c269312c8dd0aab428ec19e6c3c21e82a6105051..18146b7f1f962c8d183041c8eaee8c481e6327bf 100644 (file)
@@ -76,9 +76,9 @@ public class DataTreeCohortRegistrationProxy<C extends DOMDataTreeCommitCohort>
         future.onComplete(new OnComplete<Object>() {
 
             @Override
         future.onComplete(new OnComplete<Object>() {
 
             @Override
-            public void onComplete(Throwable e, Object val) throws Throwable {
-                if (e != null) {
-                    LOG.error("Unable to register {} as commit cohort", getInstance(), e);
+            public void onComplete(Throwable failure, Object val) {
+                if (failure != null) {
+                    LOG.error("Unable to register {} as commit cohort", getInstance(), failure);
                 }
                 if (isClosed()) {
                     removeRegistration();
                 }
                 if (isClosed()) {
                     removeRegistration();
index cf14ebe28d11b0c39e105ab6396f8aff4c37903a..0536e4b15a382c4913fa29ee292dcfc6c9b4b12f 100644 (file)
@@ -39,7 +39,8 @@ public class DatastoreContext {
     public static final int DEFAULT_JOURNAL_RECOVERY_BATCH_SIZE = 1;
     public static final int DEFAULT_SNAPSHOT_BATCH_COUNT = 20000;
     public static final int DEFAULT_HEARTBEAT_INTERVAL_IN_MILLIS = 500;
     public static final int DEFAULT_JOURNAL_RECOVERY_BATCH_SIZE = 1;
     public static final int DEFAULT_SNAPSHOT_BATCH_COUNT = 20000;
     public static final int DEFAULT_HEARTBEAT_INTERVAL_IN_MILLIS = 500;
-    public static final int DEFAULT_ISOLATED_LEADER_CHECK_INTERVAL_IN_MILLIS = DEFAULT_HEARTBEAT_INTERVAL_IN_MILLIS * 10;
+    public static final int DEFAULT_ISOLATED_LEADER_CHECK_INTERVAL_IN_MILLIS =
+            DEFAULT_HEARTBEAT_INTERVAL_IN_MILLIS * 10;
     public static final int DEFAULT_SHARD_TX_COMMIT_QUEUE_CAPACITY = 50000;
     public static final Timeout DEFAULT_SHARD_INITIALIZATION_TIMEOUT = new Timeout(5, TimeUnit.MINUTES);
     public static final Timeout DEFAULT_SHARD_LEADER_ELECTION_TIMEOUT = new Timeout(30, TimeUnit.SECONDS);
     public static final int DEFAULT_SHARD_TX_COMMIT_QUEUE_CAPACITY = 50000;
     public static final Timeout DEFAULT_SHARD_INITIALIZATION_TIMEOUT = new Timeout(5, TimeUnit.MINUTES);
     public static final Timeout DEFAULT_SHARD_LEADER_ELECTION_TIMEOUT = new Timeout(30, TimeUnit.SECONDS);
@@ -50,10 +51,11 @@ public class DatastoreContext {
     public static final int DEFAULT_TX_CREATION_INITIAL_RATE_LIMIT = 100;
     public static final String UNKNOWN_DATA_STORE_TYPE = "unknown";
     public static final int DEFAULT_SHARD_BATCHED_MODIFICATION_COUNT = 1000;
     public static final int DEFAULT_TX_CREATION_INITIAL_RATE_LIMIT = 100;
     public static final String UNKNOWN_DATA_STORE_TYPE = "unknown";
     public static final int DEFAULT_SHARD_BATCHED_MODIFICATION_COUNT = 1000;
-    public static final long DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS = TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES);
+    public static final long DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS =
+            TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES);
     public static final int DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE = 2048000;
 
     public static final int DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE = 2048000;
 
-    private static final Set<String> globalDatastoreNames = Sets.newConcurrentHashSet();
+    private static final Set<String> GLOBAL_DATASTORE_NAMES = Sets.newConcurrentHashSet();
 
     private InMemoryDOMDataStoreConfigProperties dataStoreProperties;
     private Duration shardTransactionIdleTimeout = DatastoreContext.DEFAULT_SHARD_TRANSACTION_IDLE_TIMEOUT;
 
     private InMemoryDOMDataStoreConfigProperties dataStoreProperties;
     private Duration shardTransactionIdleTimeout = DatastoreContext.DEFAULT_SHARD_TRANSACTION_IDLE_TIMEOUT;
@@ -76,7 +78,7 @@ public class DatastoreContext {
     private String shardManagerPersistenceId;
 
     public static Set<String> getGlobalDatastoreNames() {
     private String shardManagerPersistenceId;
 
     public static Set<String> getGlobalDatastoreNames() {
-        return globalDatastoreNames;
+        return GLOBAL_DATASTORE_NAMES;
     }
 
     private DatastoreContext() {
     }
 
     private DatastoreContext() {
@@ -172,11 +174,11 @@ public class DatastoreContext {
         return configurationReader;
     }
 
         return configurationReader;
     }
 
-    public long getShardElectionTimeoutFactor(){
+    public long getShardElectionTimeoutFactor() {
         return raftConfig.getElectionTimeoutFactor();
     }
 
         return raftConfig.getElectionTimeoutFactor();
     }
 
-    public String getDataStoreName(){
+    public String getDataStoreName() {
         return dataStoreName;
     }
 
         return dataStoreName;
     }
 
@@ -196,12 +198,12 @@ public class DatastoreContext {
         raftConfig.setPeerAddressResolver(resolver);
     }
 
         raftConfig.setPeerAddressResolver(resolver);
     }
 
-    private void setHeartbeatInterval(long shardHeartbeatIntervalInMillis){
+    private void setHeartbeatInterval(long shardHeartbeatIntervalInMillis) {
         raftConfig.setHeartBeatInterval(new FiniteDuration(shardHeartbeatIntervalInMillis,
                 TimeUnit.MILLISECONDS));
     }
 
         raftConfig.setHeartBeatInterval(new FiniteDuration(shardHeartbeatIntervalInMillis,
                 TimeUnit.MILLISECONDS));
     }
 
-    private void setShardJournalRecoveryLogBatchSize(int shardJournalRecoveryLogBatchSize){
+    private void setShardJournalRecoveryLogBatchSize(int shardJournalRecoveryLogBatchSize) {
         raftConfig.setJournalRecoveryLogBatchSize(shardJournalRecoveryLogBatchSize);
     }
 
         raftConfig.setJournalRecoveryLogBatchSize(shardJournalRecoveryLogBatchSize);
     }
 
@@ -267,7 +269,7 @@ public class DatastoreContext {
         private Builder(DatastoreContext datastoreContext) {
             this.datastoreContext = datastoreContext;
 
         private Builder(DatastoreContext datastoreContext) {
             this.datastoreContext = datastoreContext;
 
-            if(datastoreContext.getDataStoreProperties() != null) {
+            if (datastoreContext.getDataStoreProperties() != null) {
                 maxShardDataChangeExecutorPoolSize =
                         datastoreContext.getDataStoreProperties().getMaxDataChangeExecutorPoolSize();
                 maxShardDataChangeExecutorQueueSize =
                 maxShardDataChangeExecutorPoolSize =
                         datastoreContext.getDataStoreProperties().getMaxDataChangeExecutorPoolSize();
                 maxShardDataChangeExecutorQueueSize =
@@ -362,12 +364,12 @@ public class DatastoreContext {
             return shardLeaderElectionTimeout(timeout, TimeUnit.SECONDS);
         }
 
             return shardLeaderElectionTimeout(timeout, TimeUnit.SECONDS);
         }
 
-        public Builder configurationReader(AkkaConfigurationReader configurationReader){
+        public Builder configurationReader(AkkaConfigurationReader configurationReader) {
             datastoreContext.configurationReader = configurationReader;
             return this;
         }
 
             datastoreContext.configurationReader = configurationReader;
             return this;
         }
 
-        public Builder persistent(boolean persistent){
+        public Builder persistent(boolean persistent) {
             datastoreContext.persistent = persistent;
             return this;
         }
             datastoreContext.persistent = persistent;
             return this;
         }
@@ -377,35 +379,35 @@ public class DatastoreContext {
             return this;
         }
 
             return this;
         }
 
-        public Builder shardElectionTimeoutFactor(long shardElectionTimeoutFactor){
+        public Builder shardElectionTimeoutFactor(long shardElectionTimeoutFactor) {
             datastoreContext.setElectionTimeoutFactor(shardElectionTimeoutFactor);
             return this;
         }
 
             datastoreContext.setElectionTimeoutFactor(shardElectionTimeoutFactor);
             return this;
         }
 
-        public Builder transactionCreationInitialRateLimit(long initialRateLimit){
+        public Builder transactionCreationInitialRateLimit(long initialRateLimit) {
             datastoreContext.transactionCreationInitialRateLimit = initialRateLimit;
             return this;
         }
 
             datastoreContext.transactionCreationInitialRateLimit = initialRateLimit;
             return this;
         }
 
-        public Builder logicalStoreType(LogicalDatastoreType logicalStoreType){
+        public Builder logicalStoreType(LogicalDatastoreType logicalStoreType) {
             datastoreContext.logicalStoreType = Preconditions.checkNotNull(logicalStoreType);
 
             // Retain compatible naming
             switch (logicalStoreType) {
             datastoreContext.logicalStoreType = Preconditions.checkNotNull(logicalStoreType);
 
             // Retain compatible naming
             switch (logicalStoreType) {
-            case CONFIGURATION:
-                dataStoreName("config");
-                break;
-            case OPERATIONAL:
-                dataStoreName("operational");
-                break;
-            default:
-                dataStoreName(logicalStoreType.name());
+                case CONFIGURATION:
+                    dataStoreName("config");
+                    break;
+                case OPERATIONAL:
+                    dataStoreName("operational");
+                    break;
+                default:
+                    dataStoreName(logicalStoreType.name());
             }
 
             return this;
         }
 
             }
 
             return this;
         }
 
-        public Builder dataStoreName(String dataStoreName){
+        public Builder dataStoreName(String dataStoreName) {
             datastoreContext.dataStoreName = Preconditions.checkNotNull(dataStoreName);
             datastoreContext.dataStoreMXBeanType = "Distributed" + WordUtils.capitalize(dataStoreName) + "Datastore";
             return this;
             datastoreContext.dataStoreName = Preconditions.checkNotNull(dataStoreName);
             datastoreContext.dataStoreMXBeanType = "Distributed" + WordUtils.capitalize(dataStoreName) + "Datastore";
             return this;
@@ -471,8 +473,8 @@ public class DatastoreContext {
                     maxShardDataChangeExecutorPoolSize, maxShardDataChangeExecutorQueueSize,
                     maxShardDataChangeListenerQueueSize, maxShardDataStoreExecutorQueueSize);
 
                     maxShardDataChangeExecutorPoolSize, maxShardDataChangeExecutorQueueSize,
                     maxShardDataChangeListenerQueueSize, maxShardDataStoreExecutorQueueSize);
 
-            if(datastoreContext.dataStoreName != null) {
-                globalDatastoreNames.add(datastoreContext.dataStoreName);
+            if (datastoreContext.dataStoreName != null) {
+                GLOBAL_DATASTORE_NAMES.add(datastoreContext.dataStoreName);
             }
 
             return datastoreContext;
             }
 
             return datastoreContext;
index fcd72fa74f039059749896862edfad61bc7485a8..abf07ecb40ea94e01ff965eaaa370bc256f24793 100644 (file)
@@ -46,7 +46,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
 
         ServiceReference<ConfigurationAdmin> configAdminServiceReference =
                 bundleContext.getServiceReference(ConfigurationAdmin.class);
 
         ServiceReference<ConfigurationAdmin> configAdminServiceReference =
                 bundleContext.getServiceReference(ConfigurationAdmin.class);
-        if(configAdminServiceReference == null) {
+        if (configAdminServiceReference == null) {
             LOG.warn("No ConfigurationAdmin service found");
         } else {
             overlaySettings(configAdminServiceReference);
             LOG.warn("No ConfigurationAdmin service found");
         } else {
             overlaySettings(configAdminServiceReference);
@@ -60,18 +60,19 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
         this.listener = listener;
     }
 
         this.listener = listener;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void overlaySettings(ServiceReference<ConfigurationAdmin> configAdminServiceReference) {
         try {
             ConfigurationAdmin configAdmin = bundleContext.getService(configAdminServiceReference);
 
             Configuration config = configAdmin.getConfiguration(CONFIG_ID);
     private void overlaySettings(ServiceReference<ConfigurationAdmin> configAdminServiceReference) {
         try {
             ConfigurationAdmin configAdmin = bundleContext.getService(configAdminServiceReference);
 
             Configuration config = configAdmin.getConfiguration(CONFIG_ID);
-            if(config != null) {
+            if (config != null) {
                 Dictionary<String, Object> properties = config.getProperties();
 
                 LOG.debug("Overlaying settings: {}", properties);
 
                 Dictionary<String, Object> properties = config.getProperties();
 
                 LOG.debug("Overlaying settings: {}", properties);
 
-                if(introspector.update(properties)) {
-                    if(listener != null) {
+                if (introspector.update(properties)) {
+                    if (listener != null) {
                         listener.onDatastoreContextUpdated(introspector.newContextFactory());
                     }
                 }
                         listener.onDatastoreContextUpdated(introspector.newContextFactory());
                     }
                 }
@@ -80,7 +81,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
             }
         } catch (IOException e) {
             LOG.error("Error obtaining Configuration for pid {}", CONFIG_ID, e);
             }
         } catch (IOException e) {
             LOG.error("Error obtaining Configuration for pid {}", CONFIG_ID, e);
-        } catch(IllegalStateException e) {
+        } catch (IllegalStateException e) {
             // Ignore - indicates the bundleContext has been closed.
         } finally {
             try {
             // Ignore - indicates the bundleContext has been closed.
         } finally {
             try {
@@ -95,7 +96,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
     public void close() {
         listener = null;
 
     public void close() {
         listener = null;
 
-        if(configListenerServiceRef != null) {
+        if (configListenerServiceRef != null) {
             configListenerServiceRef.unregister();
         }
     }
             configListenerServiceRef.unregister();
         }
     }
@@ -103,7 +104,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
     private class DatastoreConfigurationListener implements ConfigurationListener {
         @Override
         public void configurationEvent(ConfigurationEvent event) {
     private class DatastoreConfigurationListener implements ConfigurationListener {
         @Override
         public void configurationEvent(ConfigurationEvent event) {
-            if(CONFIG_ID.equals(event.getPid()) && event.getType() == ConfigurationEvent.CM_UPDATED) {
+            if (CONFIG_ID.equals(event.getPid()) && event.getType() == ConfigurationEvent.CM_UPDATED) {
                 LOG.debug("configurationEvent: config {} was updated", CONFIG_ID);
                 overlaySettings(event.getReference());
             }
                 LOG.debug("configurationEvent: config {} was updated", CONFIG_ID);
                 overlaySettings(event.getReference());
             }
index 9d4a5c81137808886d1965c78a47c1d359fcc58b..1f0911851089d37aaf33e8d4350c39307394ffbd 100644 (file)
@@ -22,7 +22,6 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.List;
@@ -43,13 +42,13 @@ import org.slf4j.LoggerFactory;
 public class DatastoreContextIntrospector {
     private static final Logger LOG = LoggerFactory.getLogger(DatastoreContextIntrospector.class);
 
 public class DatastoreContextIntrospector {
     private static final Logger LOG = LoggerFactory.getLogger(DatastoreContextIntrospector.class);
 
-    private static final Map<String, Class<?>> dataStorePropTypes = new HashMap<>();
+    private static final Map<String, Class<?>> DATA_STORE_PROP_TYPES = new HashMap<>();
 
 
-    private static final Map<Class<?>, Constructor<?>> constructors = new HashMap<>();
+    private static final Map<Class<?>, Constructor<?>> CONSTRUCTORS = new HashMap<>();
 
 
-    private static final Map<Class<?>, Method> yangTypeGetters = new HashMap<>();
+    private static final Map<Class<?>, Method> YANG_TYPE_GETTERS = new HashMap<>();
 
 
-    private static final Map<String, Method> builderSetters = new HashMap<>();
+    private static final Map<String, Method> BUILDER_SETTERS = new HashMap<>();
 
     static {
         try {
 
     static {
         try {
@@ -66,11 +65,12 @@ public class DatastoreContextIntrospector {
      * constructor that takes a single String argument. For primitive wrappers, this constructor
      * converts from a String representation.
      */
      * constructor that takes a single String argument. For primitive wrappers, this constructor
      * converts from a String representation.
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static void introspectPrimitiveTypes() {
 
         Set<Class<?>> primitives = ImmutableSet.<Class<?>>builder().addAll(
                 Primitives.allWrapperTypes()).add(String.class).build();
     private static void introspectPrimitiveTypes() {
 
         Set<Class<?>> primitives = ImmutableSet.<Class<?>>builder().addAll(
                 Primitives.allWrapperTypes()).add(String.class).build();
-        for(Class<?> primitive: primitives) {
+        for (Class<?> primitive: primitives) {
             try {
                 processPropertyType(primitive);
             } catch (Exception e) {
             try {
                 processPropertyType(primitive);
             } catch (Exception e) {
@@ -86,9 +86,9 @@ public class DatastoreContextIntrospector {
      * the methods that return Builder.
      */
     private static void introspectDatastoreContextBuilder() {
      * the methods that return Builder.
      */
     private static void introspectDatastoreContextBuilder() {
-        for(Method method: Builder.class.getMethods()) {
-            if(Builder.class.equals(method.getReturnType())) {
-                builderSetters.put(method.getName(), method);
+        for (Method method: Builder.class.getMethods()) {
+            if (Builder.class.equals(method.getReturnType())) {
+                BUILDER_SETTERS.put(method.getName(), method);
             }
         }
     }
             }
         }
     }
@@ -101,7 +101,7 @@ public class DatastoreContextIntrospector {
      */
     private static void introspectDataStoreProperties() throws IntrospectionException {
         BeanInfo beanInfo = Introspector.getBeanInfo(DataStoreProperties.class);
      */
     private static void introspectDataStoreProperties() throws IntrospectionException {
         BeanInfo beanInfo = Introspector.getBeanInfo(DataStoreProperties.class);
-        for(PropertyDescriptor desc: beanInfo.getPropertyDescriptors()) {
+        for (PropertyDescriptor desc: beanInfo.getPropertyDescriptors()) {
             processDataStoreProperty(desc.getName(), desc.getPropertyType());
         }
 
             processDataStoreProperty(desc.getName(), desc.getPropertyType());
         }
 
@@ -109,9 +109,9 @@ public class DatastoreContextIntrospector {
         // properties and thus aren't returned from getPropertyDescriptors. A getter starting with
         // "is" is only supported if it returns primitive boolean. So we'll check for these via
         // getMethodDescriptors.
         // properties and thus aren't returned from getPropertyDescriptors. A getter starting with
         // "is" is only supported if it returns primitive boolean. So we'll check for these via
         // getMethodDescriptors.
-        for(MethodDescriptor desc: beanInfo.getMethodDescriptors()) {
+        for (MethodDescriptor desc: beanInfo.getMethodDescriptors()) {
             String methodName = desc.getName();
             String methodName = desc.getName();
-            if(Boolean.class.equals(desc.getMethod().getReturnType()) && methodName.startsWith("is")) {
+            if (Boolean.class.equals(desc.getMethod().getReturnType()) && methodName.startsWith("is")) {
                 String propertyName = WordUtils.uncapitalize(methodName.substring(2));
                 processDataStoreProperty(propertyName, Boolean.class);
             }
                 String propertyName = WordUtils.uncapitalize(methodName.substring(2));
                 processDataStoreProperty(propertyName, Boolean.class);
             }
@@ -121,12 +121,14 @@ public class DatastoreContextIntrospector {
     /**
      * Processes a property defined on the DataStoreProperties interface.
      */
     /**
      * Processes a property defined on the DataStoreProperties interface.
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static void processDataStoreProperty(String name, Class<?> propertyType) {
     private static void processDataStoreProperty(String name, Class<?> propertyType) {
-        Preconditions.checkArgument(builderSetters.containsKey(name), String.format(
-                "DataStoreProperties property \"%s\" does not have corresponding setter in DatastoreContext.Builder", name));
+        Preconditions.checkArgument(BUILDER_SETTERS.containsKey(name), String.format(
+                "DataStoreProperties property \"%s\" does not have corresponding setter in DatastoreContext.Builder",
+                name));
         try {
             processPropertyType(propertyType);
         try {
             processPropertyType(propertyType);
-            dataStorePropTypes.put(name, propertyType);
+            DATA_STORE_PROP_TYPES.put(name, propertyType);
         } catch (Exception e) {
             LOG.error("Error finding constructor for type {}", propertyType, e);
         }
         } catch (Exception e) {
             LOG.error("Error finding constructor for type {}", propertyType, e);
         }
@@ -138,27 +140,25 @@ public class DatastoreContextIntrospector {
      */
     private static void processPropertyType(Class<?> propertyType) throws Exception {
         Class<?> wrappedType = Primitives.wrap(propertyType);
      */
     private static void processPropertyType(Class<?> propertyType) throws Exception {
         Class<?> wrappedType = Primitives.wrap(propertyType);
-        if(constructors.containsKey(wrappedType)) {
+        if (CONSTRUCTORS.containsKey(wrappedType)) {
             return;
         }
 
         // If the type is a primitive (or String type), we look for the constructor that takes a
         // single String argument, which, for primitives, validates and converts from a String
         // representation which is the form we get on ingress.
             return;
         }
 
         // If the type is a primitive (or String type), we look for the constructor that takes a
         // single String argument, which, for primitives, validates and converts from a String
         // representation which is the form we get on ingress.
-        if(propertyType.isPrimitive() || Primitives.isWrapperType(propertyType) ||
-                propertyType.equals(String.class))
-        {
-            constructors.put(wrappedType, propertyType.getConstructor(String.class));
+        if (propertyType.isPrimitive() || Primitives.isWrapperType(propertyType) || propertyType.equals(String.class)) {
+            CONSTRUCTORS.put(wrappedType, propertyType.getConstructor(String.class));
         } else {
             // This must be a yang-defined type. We need to find the constructor that takes a
             // primitive as the only argument. This will be used to construct instances to perform
             // validation (eg range checking). The yang-generated types have a couple single-argument
             // constructors but the one we want has the bean ConstructorProperties annotation.
         } else {
             // This must be a yang-defined type. We need to find the constructor that takes a
             // primitive as the only argument. This will be used to construct instances to perform
             // validation (eg range checking). The yang-generated types have a couple single-argument
             // constructors but the one we want has the bean ConstructorProperties annotation.
-            for(Constructor<?> ctor: propertyType.getConstructors()) {
+            for (Constructor<?> ctor: propertyType.getConstructors()) {
                 ConstructorProperties ctorPropsAnnotation = ctor.getAnnotation(ConstructorProperties.class);
                 ConstructorProperties ctorPropsAnnotation = ctor.getAnnotation(ConstructorProperties.class);
-                if(ctor.getParameterTypes().length == 1 && ctorPropsAnnotation != null) {
+                if (ctor.getParameterTypes().length == 1 && ctorPropsAnnotation != null) {
                     findYangTypeGetter(propertyType, ctorPropsAnnotation.value()[0]);
                     findYangTypeGetter(propertyType, ctorPropsAnnotation.value()[0]);
-                    constructors.put(propertyType, ctor);
+                    CONSTRUCTORS.put(propertyType, ctor);
                     break;
                 }
             }
                     break;
                 }
             }
@@ -170,9 +170,9 @@ public class DatastoreContextIntrospector {
      */
     private static void findYangTypeGetter(Class<?> type, String propertyName)
             throws Exception {
      */
     private static void findYangTypeGetter(Class<?> type, String propertyName)
             throws Exception {
-        for(PropertyDescriptor desc: Introspector.getBeanInfo(type).getPropertyDescriptors()) {
-            if(desc.getName().equals(propertyName)) {
-                yangTypeGetters.put(type, desc.getReadMethod());
+        for (PropertyDescriptor desc: Introspector.getBeanInfo(type).getPropertyDescriptors()) {
+            if (desc.getName().equals(propertyName)) {
+                YANG_TYPE_GETTERS.put(type, desc.getReadMethod());
                 return;
             }
         }
                 return;
             }
         }
@@ -198,7 +198,7 @@ public class DatastoreContextIntrospector {
     }
 
     public synchronized DatastoreContext getShardDatastoreContext(String forShardName) {
     }
 
     public synchronized DatastoreContext getShardDatastoreContext(String forShardName) {
-        if(currentProperties == null) {
+        if (currentProperties == null) {
             return context;
         }
 
             return context;
         }
 
@@ -208,13 +208,13 @@ public class DatastoreContextIntrospector {
 
         List<String> keys = getSortedKeysByDatastoreType(currentProperties.keySet(), dataStoreTypePrefix);
 
 
         List<String> keys = getSortedKeysByDatastoreType(currentProperties.keySet(), dataStoreTypePrefix);
 
-        for(String key: keys) {
+        for (String key: keys) {
             Object value = currentProperties.get(key);
             Object value = currentProperties.get(key);
-            if(key.startsWith(dataStoreTypePrefix)) {
+            if (key.startsWith(dataStoreTypePrefix)) {
                 key = key.replaceFirst(dataStoreTypePrefix, "");
             }
 
                 key = key.replaceFirst(dataStoreTypePrefix, "");
             }
 
-            if(key.startsWith(shardNamePrefix)) {
+            if (key.startsWith(shardNamePrefix)) {
                 key = key.replaceFirst(shardNamePrefix, "");
                 convertValueAndInvokeSetter(key, value, builder);
             }
                 key = key.replaceFirst(shardNamePrefix, "");
                 convertValueAndInvokeSetter(key, value, builder);
             }
@@ -232,7 +232,7 @@ public class DatastoreContextIntrospector {
      */
     public synchronized boolean update(Dictionary<String, Object> properties) {
         currentProperties = null;
      */
     public synchronized boolean update(Dictionary<String, Object> properties) {
         currentProperties = null;
-        if(properties == null || properties.isEmpty()) {
+        if (properties == null || properties.isEmpty()) {
             return false;
         }
 
             return false;
         }
 
@@ -247,23 +247,23 @@ public class DatastoreContextIntrospector {
         List<String> keys = getSortedKeysByDatastoreType(Collections.list(properties.keys()), dataStoreTypePrefix);
 
         boolean updated = false;
         List<String> keys = getSortedKeysByDatastoreType(Collections.list(properties.keys()), dataStoreTypePrefix);
 
         boolean updated = false;
-        for(String key: keys) {
+        for (String key: keys) {
             Object value = properties.get(key);
             mapBuilder.put(key, value);
 
             // If the key is prefixed with the data store type, strip it off.
             Object value = properties.get(key);
             mapBuilder.put(key, value);
 
             // If the key is prefixed with the data store type, strip it off.
-            if(key.startsWith(dataStoreTypePrefix)) {
+            if (key.startsWith(dataStoreTypePrefix)) {
                 key = key.replaceFirst(dataStoreTypePrefix, "");
             }
 
                 key = key.replaceFirst(dataStoreTypePrefix, "");
             }
 
-            if(convertValueAndInvokeSetter(key, value, builder)) {
+            if (convertValueAndInvokeSetter(key, value, builder)) {
                 updated = true;
             }
         }
 
         currentProperties = mapBuilder.build();
 
                 updated = true;
             }
         }
 
         currentProperties = mapBuilder.build();
 
-        if(updated) {
+        if (updated) {
             context = builder.build();
         }
 
             context = builder.build();
         }
 
@@ -275,23 +275,19 @@ public class DatastoreContextIntrospector {
         // Sort the property keys by putting the names prefixed with the data store type last. This
         // is done so data store specific settings are applied after global settings.
         ArrayList<String> keys = new ArrayList<>(inKeys);
         // Sort the property keys by putting the names prefixed with the data store type last. This
         // is done so data store specific settings are applied after global settings.
         ArrayList<String> keys = new ArrayList<>(inKeys);
-        Collections.sort(keys, new Comparator<String>() {
-            @Override
-            public int compare(String key1, String key2) {
-                return key1.startsWith(dataStoreTypePrefix) ? 1 :
-                           key2.startsWith(dataStoreTypePrefix) ? -1 : key1.compareTo(key2);
-            }
-        });
+        Collections.sort(keys, (key1, key2) -> key1.startsWith(dataStoreTypePrefix) ? 1 :
+                   key2.startsWith(dataStoreTypePrefix) ? -1 : key1.compareTo(key2));
         return keys;
     }
 
         return keys;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private boolean convertValueAndInvokeSetter(String inKey, Object inValue, Builder builder) {
         String key = convertToCamelCase(inKey);
 
         try {
             // Convert the value to the right type.
             Object value = convertValue(key, inValue);
     private boolean convertValueAndInvokeSetter(String inKey, Object inValue, Builder builder) {
         String key = convertToCamelCase(inKey);
 
         try {
             // Convert the value to the right type.
             Object value = convertValue(key, inValue);
-            if(value == null) {
+            if (value == null) {
                 return false;
             }
 
                 return false;
             }
 
@@ -299,7 +295,7 @@ public class DatastoreContextIntrospector {
                     key, value, value.getClass().getSimpleName());
 
             // Call the setter method on the Builder instance.
                     key, value, value.getClass().getSimpleName());
 
             // Call the setter method on the Builder instance.
-            Method setter = builderSetters.get(key);
+            Method setter = BUILDER_SETTERS.get(key);
             setter.invoke(builder, constructorValueRecursively(
                     Primitives.wrap(setter.getParameterTypes()[0]), value.toString()));
 
             setter.invoke(builder, constructorValueRecursively(
                     Primitives.wrap(setter.getParameterTypes()[0]), value.toString()));
 
@@ -313,7 +309,7 @@ public class DatastoreContextIntrospector {
 
     private static String convertToCamelCase(String inString) {
         String str = inString.trim();
 
     private static String convertToCamelCase(String inString) {
         String str = inString.trim();
-        if(StringUtils.contains(str, '-') || StringUtils.contains(str, ' ')) {
+        if (StringUtils.contains(str, '-') || StringUtils.contains(str, ' ')) {
             str = inString.replace('-', ' ');
             str = WordUtils.capitalizeFully(str);
             str = StringUtils.deleteWhitespace(str);
             str = inString.replace('-', ' ');
             str = WordUtils.capitalizeFully(str);
             str = StringUtils.deleteWhitespace(str);
@@ -323,8 +319,8 @@ public class DatastoreContextIntrospector {
     }
 
     private Object convertValue(String name, Object from) throws Exception {
     }
 
     private Object convertValue(String name, Object from) throws Exception {
-        Class<?> propertyType = dataStorePropTypes.get(name);
-        if(propertyType == null) {
+        Class<?> propertyType = DATA_STORE_PROP_TYPES.get(name);
+        if (propertyType == null) {
             LOG.debug("Property not found for {}", name);
             return null;
         }
             LOG.debug("Property not found for {}", name);
             return null;
         }
@@ -338,8 +334,8 @@ public class DatastoreContextIntrospector {
         Object converted = constructorValueRecursively(propertyType, from.toString());
 
         // If the converted type is a yang-generated type, call the getter to obtain the actual value.
         Object converted = constructorValueRecursively(propertyType, from.toString());
 
         // If the converted type is a yang-generated type, call the getter to obtain the actual value.
-        Method getter = yangTypeGetters.get(converted.getClass());
-        if(getter != null) {
+        Method getter = YANG_TYPE_GETTERS.get(converted.getClass());
+        if (getter != null) {
             converted = getter.invoke(converted);
         }
 
             converted = getter.invoke(converted);
         }
 
@@ -350,11 +346,11 @@ public class DatastoreContextIntrospector {
         LOG.trace("convertValueRecursively - toType: {}, fromValue {} ({})",
                 toType.getSimpleName(), fromValue, fromValue.getClass().getSimpleName());
 
         LOG.trace("convertValueRecursively - toType: {}, fromValue {} ({})",
                 toType.getSimpleName(), fromValue, fromValue.getClass().getSimpleName());
 
-        Constructor<?> ctor = constructors.get(toType);
+        Constructor<?> ctor = CONSTRUCTORS.get(toType);
 
         LOG.trace("Found {}", ctor);
 
 
         LOG.trace("Found {}", ctor);
 
-        if(ctor == null) {
+        if (ctor == null) {
             throw new IllegalArgumentException(String.format("Constructor not found for type %s", toType));
         }
 
             throw new IllegalArgumentException(String.format("Constructor not found for type %s", toType));
         }
 
@@ -362,7 +358,7 @@ public class DatastoreContextIntrospector {
 
         // Since the original input type is a String, once we find a constructor that takes a String
         // argument, we're done recursing.
 
         // Since the original input type is a String, once we find a constructor that takes a String
         // argument, we're done recursing.
-        if(!ctor.getParameterTypes()[0].equals(String.class)) {
+        if (!ctor.getParameterTypes()[0].equals(String.class)) {
             value = constructorValueRecursively(ctor.getParameterTypes()[0], fromValue);
         }
 
             value = constructorValueRecursively(ctor.getParameterTypes()[0], fromValue);
         }
 
index 52ab3030bff528b4d44027e58757e0d5d3a63e26..87c88179dc2e9f2ebd38d7ec58365209a7b45233 100644 (file)
@@ -46,19 +46,21 @@ public class DatastoreSnapshotRestore {
 
     // synchronize this method so that, in case of concurrent access to getAndRemove(),
     // no one ends up with partially initialized data
 
     // synchronize this method so that, in case of concurrent access to getAndRemove(),
     // no one ends up with partially initialized data
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private synchronized void initialize() {
 
         File restoreDirectoryFile = new File(restoreDirectoryPath);
 
         String[] files = restoreDirectoryFile.list();
     private synchronized void initialize() {
 
         File restoreDirectoryFile = new File(restoreDirectoryPath);
 
         String[] files = restoreDirectoryFile.list();
-        if(files == null || files.length == 0) {
+        if (files == null || files.length == 0) {
             LOG.debug("Restore directory {} does not exist or is empty", restoreDirectoryFile);
             return;
         }
 
             LOG.debug("Restore directory {} does not exist or is empty", restoreDirectoryFile);
             return;
         }
 
-        if(files.length > 1) {
-            LOG.error("Found {} files in clustered datastore restore directory {} - expected 1. No restore will be attempted",
-                    files.length, restoreDirectoryFile);
+        if (files.length > 1) {
+            LOG.error(
+                "Found {} files in clustered datastore restore directory {} - expected 1. No restore will be attempted",
+                files.length, restoreDirectoryFile);
             return;
         }
 
             return;
         }
 
@@ -66,24 +68,25 @@ public class DatastoreSnapshotRestore {
 
         LOG.info("Clustered datastore will be restored from file {}", restoreFile);
 
 
         LOG.info("Clustered datastore will be restored from file {}", restoreFile);
 
-        try(FileInputStream fis = new FileInputStream(restoreFile)) {
+        try (FileInputStream fis = new FileInputStream(restoreFile)) {
             DatastoreSnapshotList snapshots = deserialize(fis);
             LOG.debug("Deserialized {} snapshots", snapshots.size());
 
             DatastoreSnapshotList snapshots = deserialize(fis);
             LOG.debug("Deserialized {} snapshots", snapshots.size());
 
-            for(DatastoreSnapshot snapshot: snapshots) {
+            for (DatastoreSnapshot snapshot: snapshots) {
                 datastoreSnapshots.put(snapshot.getType(), snapshot);
             }
         } catch (Exception e) {
             LOG.error("Error reading clustered datastore restore file {}", restoreFile, e);
         } finally {
                 datastoreSnapshots.put(snapshot.getType(), snapshot);
             }
         } catch (Exception e) {
             LOG.error("Error reading clustered datastore restore file {}", restoreFile, e);
         } finally {
-            if(!restoreFile.delete()) {
+            if (!restoreFile.delete()) {
                 LOG.error("Could not delete clustered datastore restore file {}", restoreFile);
             }
         }
     }
 
                 LOG.error("Could not delete clustered datastore restore file {}", restoreFile);
             }
         }
     }
 
-    private static DatastoreSnapshotList deserialize(InputStream inputStream) throws IOException, ClassNotFoundException {
-        try(ObjectInputStream ois = new ObjectInputStream(inputStream)) {
+    private static DatastoreSnapshotList deserialize(InputStream inputStream)
+            throws IOException, ClassNotFoundException {
+        try (ObjectInputStream ois = new ObjectInputStream(inputStream)) {
             return (DatastoreSnapshotList) ois.readObject();
         }
     }
             return (DatastoreSnapshotList) ois.readObject();
         }
     }
index e0b5c1f9c869ce72e283708f45e620341512ba8b..12778541008b5eb84580be5ef1e828c1b091f428 100644 (file)
@@ -47,9 +47,9 @@ class DebugThreePhaseCommitCohort extends AbstractThreePhaseCommitCohort<Object>
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable failure) {
                 log.warn("Transaction {} failed with error \"{}\" - was allocated in the following context",
                 log.warn("Transaction {} failed with error \"{}\" - was allocated in the following context",
-                        transactionId, t, debugContext);
+                        transactionId, failure, debugContext);
             }
         });
 
             }
         });
 
index bf52aa14c99431a378fc663ba9bb2c66c79a2723..a94773481d91e3e6353f60572a7b3c1fb9e4ff61 100644 (file)
@@ -35,14 +35,16 @@ final class DefaultShardDataChangeListenerPublisher implements ShardDataChangeLi
     private final ListenerTree dataChangeListenerTree = ListenerTree.create();
 
     @Override
     private final ListenerTree dataChangeListenerTree = ListenerTree.create();
 
     @Override
-    public void submitNotification(final DataChangeListenerRegistration<?> listener, final DOMImmutableDataChangeEvent notification) {
+    public void submitNotification(final DataChangeListenerRegistration<?> listener,
+            final DOMImmutableDataChangeEvent notification) {
         LOG.debug("Notifying listener {} about {}", listener.getInstance(), notification);
 
         listener.getInstance().onDataChanged(notification);
     }
 
     @Override
         LOG.debug("Notifying listener {} about {}", listener.getInstance(), notification);
 
         listener.getInstance().onDataChanged(notification);
     }
 
     @Override
-    public void submitNotifications(final DataChangeListenerRegistration<?> listener, final Iterable<DOMImmutableDataChangeEvent> notifications) {
+    public void submitNotifications(final DataChangeListenerRegistration<?> listener,
+            final Iterable<DOMImmutableDataChangeEvent> notifications) {
         final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> instance = listener.getInstance();
         LOG.debug("Notifying listener {} about {}", instance, notifications);
 
         final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> instance = listener.getInstance();
         LOG.debug("Notifying listener {} about {}", instance, notifications);
 
@@ -57,8 +59,9 @@ final class DefaultShardDataChangeListenerPublisher implements ShardDataChangeLi
     }
 
     @Override
     }
 
     @Override
-    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L>
-            registerDataChangeListener(YangInstanceIdentifier path, L listener, DataChangeScope scope) {
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
+            DataChangeListenerRegistration<L> registerDataChangeListener(YangInstanceIdentifier path, L listener,
+                    DataChangeScope scope) {
         return dataChangeListenerTree.registerDataChangeListener(path, listener, scope);
     }
 
         return dataChangeListenerTree.registerDataChangeListener(path, listener, scope);
     }
 
index 8f18cb74dc79c6cd7cb6c08b03640b9df173dcd8..837242dec468dcfcf2b01af816acdfcbce5c8f5b 100644 (file)
@@ -14,18 +14,18 @@ import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
-abstract class DelayedListenerRegistration<L extends EventListener, R> implements ListenerRegistration<L> {
-    private final R registrationMessage;
+abstract class DelayedListenerRegistration<L extends EventListener, M> implements ListenerRegistration<L> {
+    private final M registrationMessage;
     private volatile ListenerRegistration<L> delegate;
 
     @GuardedBy("this")
     private boolean closed;
 
     private volatile ListenerRegistration<L> delegate;
 
     @GuardedBy("this")
     private boolean closed;
 
-    protected DelayedListenerRegistration(R registrationMessage) {
+    protected DelayedListenerRegistration(M registrationMessage) {
         this.registrationMessage = registrationMessage;
     }
 
         this.registrationMessage = registrationMessage;
     }
 
-    R getRegistrationMessage() {
+    M getRegistrationMessage() {
         return registrationMessage;
     }
 
         return registrationMessage;
     }
 
@@ -33,10 +33,10 @@ abstract class DelayedListenerRegistration<L extends EventListener, R> implement
         return delegate;
     }
 
         return delegate;
     }
 
-    synchronized <LR extends ListenerRegistration<L>> void createDelegate(
-            final LeaderLocalDelegateFactory<R, LR, Optional<DataTreeCandidate>> factory) {
+    synchronized <R extends ListenerRegistration<L>> void createDelegate(
+            final LeaderLocalDelegateFactory<M, R, Optional<DataTreeCandidate>> factory) {
         if (!closed) {
         if (!closed) {
-            final Entry<LR, Optional<DataTreeCandidate>> res = factory.createDelegate(registrationMessage);
+            final Entry<R, Optional<DataTreeCandidate>> res = factory.createDelegate(registrationMessage);
             this.delegate = res.getKey();
         }
     }
             this.delegate = res.getKey();
         }
     }
index 3b9b7adc6b951731e8bc829b44032bebf0de7db7..1542fd683252ea3c726a35054249ea4333c4f588 100644 (file)
@@ -12,9 +12,9 @@ import java.util.Map.Entry;
 /**
  * Base class for factories instantiating delegates.
  *
 /**
  * Base class for factories instantiating delegates.
  *
- * <D> delegate type
- * <M> message type
- * <I> initial state type
+ * @param <M> message type
+ * @param <D> delegate type
+ * @param <I> initial state type
  */
 abstract class DelegateFactory<M, D, I> {
     abstract Entry<D, I> createDelegate(M message);
  */
 abstract class DelegateFactory<M, D, I> {
     abstract Entry<D, I> createDelegate(M message);
index e4d17ac976dff37535f45728272f7eddc055be1f..cb6d44dd9264db8a0c1198cee2b2406adbde5f46 100644 (file)
@@ -51,10 +51,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
 import org.slf4j.LoggerFactory;
 
 /**
- *
+ * Implements a distributed DOMStore.
  */
 public class DistributedDataStore implements DistributedDataStoreInterface, SchemaContextListener,
  */
 public class DistributedDataStore implements DistributedDataStoreInterface, SchemaContextListener,
-        DatastoreContextConfigAdminOverlay.Listener, DOMStoreTreeChangePublisher, DOMDataTreeCommitCohortRegistry, AutoCloseable {
+        DatastoreContextConfigAdminOverlay.Listener, DOMStoreTreeChangePublisher,
+        DOMDataTreeCommitCohortRegistry, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(DistributedDataStore.class);
 
 
     private static final Logger LOG = LoggerFactory.getLogger(DistributedDataStore.class);
 
@@ -76,6 +77,7 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
 
     private final TransactionContextFactory txContextFactory;
 
 
     private final TransactionContextFactory txContextFactory;
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public DistributedDataStore(final ActorSystem actorSystem, final ClusterWrapper cluster,
             final Configuration configuration, final DatastoreContextFactory datastoreContextFactory,
             final DatastoreSnapshot restoreFromSnapshot) {
     public DistributedDataStore(final ActorSystem actorSystem, final ClusterWrapper cluster,
             final Configuration configuration, final DatastoreContextFactory datastoreContextFactory,
             final DatastoreSnapshot restoreFromSnapshot) {
@@ -94,12 +96,15 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
 
         PrimaryShardInfoFutureCache primaryShardInfoCache = new PrimaryShardInfoFutureCache();
 
 
         PrimaryShardInfoFutureCache primaryShardInfoCache = new PrimaryShardInfoFutureCache();
 
-        ShardManagerCreator creator = new ShardManagerCreator().cluster(cluster).configuration(configuration).
-                datastoreContextFactory(datastoreContextFactory).waitTillReadyCountdownLatch(waitTillReadyCountDownLatch).
-                primaryShardInfoCache(primaryShardInfoCache).restoreFromSnapshot(restoreFromSnapshot);
+        ShardManagerCreator creator = new ShardManagerCreator().cluster(cluster).configuration(configuration)
+                .datastoreContextFactory(datastoreContextFactory)
+                .waitTillReadyCountdownLatch(waitTillReadyCountDownLatch)
+                .primaryShardInfoCache(primaryShardInfoCache)
+                .restoreFromSnapshot(restoreFromSnapshot);
 
         actorContext = new ActorContext(actorSystem, createShardManager(actorSystem, creator, shardDispatcher,
 
         actorContext = new ActorContext(actorSystem, createShardManager(actorSystem, creator, shardDispatcher,
-                shardManagerId), cluster, configuration, datastoreContextFactory.getBaseDatastoreContext(), primaryShardInfoCache);
+                shardManagerId), cluster, configuration, datastoreContextFactory.getBaseDatastoreContext(),
+                primaryShardInfoCache);
 
         final Props clientProps = DistributedDataStoreClientActor.props(cluster.getCurrentMemberName(),
             datastoreContextFactory.getBaseDatastoreContext().getDataStoreName(), actorContext);
 
         final Props clientProps = DistributedDataStoreClientActor.props(cluster.getCurrentMemberName(),
             datastoreContextFactory.getBaseDatastoreContext().getDataStoreName(), actorContext);
@@ -115,8 +120,8 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
         identifier = client.getIdentifier();
         LOG.debug("Distributed data store client {} started", identifier);
 
         identifier = client.getIdentifier();
         LOG.debug("Distributed data store client {} started", identifier);
 
-        this.waitTillReadyTimeInMillis =
-                actorContext.getDatastoreContext().getShardLeaderElectionTimeout().duration().toMillis() * READY_WAIT_FACTOR;
+        this.waitTillReadyTimeInMillis = actorContext.getDatastoreContext().getShardLeaderElectionTimeout()
+                .duration().toMillis() * READY_WAIT_FACTOR;
 
         this.txContextFactory = new TransactionContextFactory(actorContext, identifier);
 
 
         this.txContextFactory = new TransactionContextFactory(actorContext, identifier);
 
@@ -125,8 +130,8 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
         datastoreConfigMXBean.setContext(datastoreContextFactory.getBaseDatastoreContext());
         datastoreConfigMXBean.registerMBean();
 
         datastoreConfigMXBean.setContext(datastoreContextFactory.getBaseDatastoreContext());
         datastoreConfigMXBean.registerMBean();
 
-        datastoreInfoMXBean = new DatastoreInfoMXBeanImpl(datastoreContextFactory.getBaseDatastoreContext().
-                getDataStoreMXBeanType(), actorContext);
+        datastoreInfoMXBean = new DatastoreInfoMXBeanImpl(datastoreContextFactory.getBaseDatastoreContext()
+                .getDataStoreMXBeanType(), actorContext);
         datastoreInfoMXBean.registerMBean();
     }
 
         datastoreInfoMXBean.registerMBean();
     }
 
@@ -136,8 +141,8 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
         this.client = null;
         this.identifier = Preconditions.checkNotNull(identifier);
         this.txContextFactory = new TransactionContextFactory(actorContext, identifier);
         this.client = null;
         this.identifier = Preconditions.checkNotNull(identifier);
         this.txContextFactory = new TransactionContextFactory(actorContext, identifier);
-        this.waitTillReadyTimeInMillis =
-                actorContext.getDatastoreContext().getShardLeaderElectionTimeout().duration().toMillis() * READY_WAIT_FACTOR;
+        this.waitTillReadyTimeInMillis = actorContext.getDatastoreContext().getShardLeaderElectionTimeout()
+                .duration().toMillis() * READY_WAIT_FACTOR;
     }
 
     public void setCloseable(final AutoCloseable closeable) {
     }
 
     public void setCloseable(final AutoCloseable closeable) {
@@ -166,7 +171,8 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
     }
 
     @Override
     }
 
     @Override
-    public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(final YangInstanceIdentifier treeId, final L listener) {
+    public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
+            final YangInstanceIdentifier treeId, final L listener) {
         Preconditions.checkNotNull(treeId, "treeId should not be null");
         Preconditions.checkNotNull(listener, "listener should not be null");
 
         Preconditions.checkNotNull(treeId, "treeId should not be null");
         Preconditions.checkNotNull(listener, "listener should not be null");
 
@@ -205,7 +211,7 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
-       return new TransactionProxy(txContextFactory, TransactionType.READ_ONLY);
+        return new TransactionProxy(txContextFactory, TransactionType.READ_ONLY);
     }
 
     @Override
     }
 
     @Override
@@ -234,6 +240,7 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
     }
 
     @Override
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         LOG.info("Closing data store {}", identifier);
 
     public void close() {
         LOG.info("Closing data store {}", identifier);
 
@@ -265,33 +272,35 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
         return actorContext;
     }
 
         return actorContext;
     }
 
-    public void waitTillReady(){
+    public void waitTillReady() {
         LOG.info("Beginning to wait for data store to become ready : {}", identifier);
 
         try {
             if (waitTillReadyCountDownLatch.await(waitTillReadyTimeInMillis, TimeUnit.MILLISECONDS)) {
                 LOG.debug("Data store {} is now ready", identifier);
             } else {
         LOG.info("Beginning to wait for data store to become ready : {}", identifier);
 
         try {
             if (waitTillReadyCountDownLatch.await(waitTillReadyTimeInMillis, TimeUnit.MILLISECONDS)) {
                 LOG.debug("Data store {} is now ready", identifier);
             } else {
-                LOG.error("Shared leaders failed to settle in {} seconds, giving up", TimeUnit.MILLISECONDS.toSeconds(waitTillReadyTimeInMillis));
+                LOG.error("Shard leaders failed to settle in {} seconds, giving up",
+                        TimeUnit.MILLISECONDS.toSeconds(waitTillReadyTimeInMillis));
             }
         } catch (InterruptedException e) {
             LOG.error("Interrupted while waiting for shards to settle", e);
         }
     }
 
             }
         } catch (InterruptedException e) {
             LOG.error("Interrupted while waiting for shards to settle", e);
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static ActorRef createShardManager(final ActorSystem actorSystem, final ShardManagerCreator creator,
             final String shardDispatcher, final String shardManagerId) {
         Exception lastException = null;
 
     private static ActorRef createShardManager(final ActorSystem actorSystem, final ShardManagerCreator creator,
             final String shardDispatcher, final String shardManagerId) {
         Exception lastException = null;
 
-        for(int i=0;i<100;i++) {
+        for (int i = 0; i < 100; i++) {
             try {
                 return actorSystem.actorOf(creator.props().withDispatcher(shardDispatcher).withMailbox(
                         ActorContext.BOUNDED_MAILBOX), shardManagerId);
             try {
                 return actorSystem.actorOf(creator.props().withDispatcher(shardDispatcher).withMailbox(
                         ActorContext.BOUNDED_MAILBOX), shardManagerId);
-            } catch (Exception e){
+            } catch (Exception e) {
                 lastException = e;
                 Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
                 lastException = e;
                 Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
-                LOG.debug("Could not create actor {} because of {} - waiting for sometime before retrying (retry count = {})",
-                    shardManagerId, e.getMessage(), i);
+                LOG.debug("Could not create actor {} because of {} - waiting for sometime before retrying "
+                        + "(retry count = {})", shardManagerId, e.getMessage(), i);
             }
         }
 
             }
         }
 
index 7ca21d4d8a6a3b9e0ba13ae783ef2468b3c2c383..12e4294916219fa824bb692f300ebf50568c2b63 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
+import com.google.common.base.Preconditions;
 import java.util.Collection;
 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import java.util.Collection;
 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
index d8d7bdda217b9dd2c1144b4acfd901b2435acd79..6b901b4fa85988cc14ce4557d865a09d4a28d034 100644 (file)
@@ -15,7 +15,8 @@ import org.opendaylight.controller.cluster.datastore.persisted.FrontendHistoryMe
 import org.opendaylight.yangtools.concepts.Builder;
 import org.opendaylight.yangtools.concepts.Identifiable;
 
 import org.opendaylight.yangtools.concepts.Builder;
 import org.opendaylight.yangtools.concepts.Identifiable;
 
-final class FrontendHistoryMetadataBuilder implements Builder<FrontendHistoryMetadata>, Identifiable<LocalHistoryIdentifier> {
+final class FrontendHistoryMetadataBuilder implements Builder<FrontendHistoryMetadata>,
+        Identifiable<LocalHistoryIdentifier> {
     private final LocalHistoryIdentifier identifier;
 
     private long nextTransaction;
     private final LocalHistoryIdentifier identifier;
 
     private long nextTransaction;
index 8ce28571ee16b22bca1d1a5a8d76e5c88dd51583..8e22d5f9e720553bf85878f7d3e5bde30c566543 100644 (file)
@@ -17,9 +17,9 @@ import com.google.common.base.Preconditions;
  * Base class for factories instantiating delegates which are local to the
  * shard leader.
  *
  * Base class for factories instantiating delegates which are local to the
  * shard leader.
  *
- * <D> delegate type
- * <M> message type
- * <I> initial state type
+ * @param <D> delegate type
+ * @param <M> message type
+ * @param <I> initial state type
  */
 abstract class LeaderLocalDelegateFactory<M, D, I> extends DelegateFactory<M, D, I> {
     private final Shard shard;
  */
 abstract class LeaderLocalDelegateFactory<M, D, I> extends DelegateFactory<M, D, I> {
     private final Shard shard;
index 1419a520355aedf1002a4dba613e1f3707d1acd6..610212fdf3c8fb3dc8f90f41c490474af5fd68e0 100644 (file)
@@ -40,7 +40,8 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort {
     private final Exception operationError;
 
     protected LocalThreePhaseCommitCohort(final ActorContext actorContext, final ActorSelection leader,
     private final Exception operationError;
 
     protected LocalThreePhaseCommitCohort(final ActorContext actorContext, final ActorSelection leader,
-            final SnapshotBackedWriteTransaction<TransactionIdentifier> transaction, final DataTreeModification modification) {
+            final SnapshotBackedWriteTransaction<TransactionIdentifier> transaction,
+            final DataTreeModification modification) {
         this.actorContext = Preconditions.checkNotNull(actorContext);
         this.leader = Preconditions.checkNotNull(leader);
         this.transaction = Preconditions.checkNotNull(transaction);
         this.actorContext = Preconditions.checkNotNull(actorContext);
         this.leader = Preconditions.checkNotNull(leader);
         this.transaction = Preconditions.checkNotNull(transaction);
@@ -58,7 +59,7 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort {
     }
 
     private Future<Object> initiateCommit(final boolean immediate) {
     }
 
     private Future<Object> initiateCommit(final boolean immediate) {
-        if(operationError != null) {
+        if (operationError != null) {
             return Futures.failed(operationError);
         }
 
             return Futures.failed(operationError);
         }
 
@@ -132,9 +133,9 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort {
         throw new UnsupportedOperationException();
     }
 
         throw new UnsupportedOperationException();
     }
 
-    protected void transactionAborted(SnapshotBackedWriteTransaction<TransactionIdentifier> transaction) {
+    protected void transactionAborted(SnapshotBackedWriteTransaction<TransactionIdentifier> aborted) {
     }
 
     }
 
-    protected void transactionCommitted(SnapshotBackedWriteTransaction<TransactionIdentifier> transaction) {
+    protected void transactionCommitted(SnapshotBackedWriteTransaction<TransactionIdentifier> comitted) {
     }
 }
     }
 }
index 2e329dd15e07856cdd39b45202d2871ca1e72d87..df57edeea556665976bc48a4bb14276a3e09ddcd 100644 (file)
@@ -80,11 +80,11 @@ final class LocalTransactionChain extends AbstractSnapshotBackedTransactionChain
         return super.newWriteOnlyTransaction(identifier);
     }
 
         return super.newWriteOnlyTransaction(identifier);
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
     @Override
     public LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
             @Nullable Exception operationError) {
     @Override
     public LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
             @Nullable Exception operationError) {
-        if(operationError != null) {
+        if (operationError != null) {
             return new LocalChainThreePhaseCommitCohort((SnapshotBackedWriteTransaction<TransactionIdentifier>)tx,
                     operationError);
         }
             return new LocalChainThreePhaseCommitCohort((SnapshotBackedWriteTransaction<TransactionIdentifier>)tx,
                     operationError);
         }
index 0dbd2a284def03ae2a722dc9b7fbef62e69dbe23..76bafb75d3003a911f1b1207f55a919b0c08e2f0 100644 (file)
@@ -43,9 +43,10 @@ abstract class LocalTransactionContext extends AbstractTransactionContext {
     protected abstract DOMStoreReadTransaction getReadDelegate();
 
     @Override
     protected abstract DOMStoreReadTransaction getReadDelegate();
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void executeModification(AbstractModification modification) {
         incrementModificationCount();
     public void executeModification(AbstractModification modification) {
         incrementModificationCount();
-        if(operationError == null) {
+        if (operationError == null) {
             try {
                 modification.apply(getWriteDelegate());
             } catch (Exception e) {
             try {
                 modification.apply(getWriteDelegate());
             } catch (Exception e) {
@@ -63,8 +64,8 @@ abstract class LocalTransactionContext extends AbstractTransactionContext {
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(final Throwable t) {
-                proxyFuture.setException(t);
+            public void onFailure(final Throwable failure) {
+                proxyFuture.setException(failure);
             }
         });
     }
             }
         });
     }
index 7c05fef87fc6013aebeae533697fa6309bd9f8a8..935db99cdf08108639ca06ee72c480568702d575 100644 (file)
@@ -66,16 +66,16 @@ final class LocalTransactionFactoryImpl extends TransactionReadyPrototype<Transa
     }
 
     @Override
     }
 
     @Override
-    protected DOMStoreThreePhaseCommitCohort transactionReady(final SnapshotBackedWriteTransaction<TransactionIdentifier> tx,
-            final DataTreeModification tree) {
+    protected DOMStoreThreePhaseCommitCohort transactionReady(
+            final SnapshotBackedWriteTransaction<TransactionIdentifier> tx, final DataTreeModification tree) {
         return new LocalThreePhaseCommitCohort(actorContext, leader, tx, tree);
     }
 
         return new LocalThreePhaseCommitCohort(actorContext, leader, tx, tree);
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
     @Override
     public LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
             @Nullable Exception operationError) {
     @Override
     public LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
             @Nullable Exception operationError) {
-        if(operationError != null) {
+        if (operationError != null) {
             return new LocalThreePhaseCommitCohort(actorContext, leader,
                     (SnapshotBackedWriteTransaction<TransactionIdentifier>)tx, operationError);
         }
             return new LocalThreePhaseCommitCohort(actorContext, leader,
                     (SnapshotBackedWriteTransaction<TransactionIdentifier>)tx, operationError);
         }
index 3f5a1521dc4332801d40302849fe092f377f3fd7..009c9642e95942de7593b008bf7d78890af34e72 100644 (file)
@@ -24,7 +24,7 @@ final class NoOpTransactionContext extends AbstractTransactionContext {
 
     private final Throwable failure;
 
 
     private final Throwable failure;
 
-    public NoOpTransactionContext(Throwable failure, TransactionIdentifier identifier) {
+    NoOpTransactionContext(Throwable failure, TransactionIdentifier identifier) {
         super(identifier);
         this.failure = failure;
     }
         super(identifier);
         this.failure = failure;
     }
@@ -48,8 +48,8 @@ final class NoOpTransactionContext extends AbstractTransactionContext {
 
     @Override
     public void executeModification(AbstractModification modification) {
 
     @Override
     public void executeModification(AbstractModification modification) {
-        LOG.debug("Tx {} executeModification {} called path = {}", getIdentifier(), modification.getClass().getSimpleName(),
-                modification.getPath());
+        LOG.debug("Tx {} executeModification {} called path = {}", getIdentifier(),
+                modification.getClass().getSimpleName(), modification.getPath());
     }
 
     @Override
     }
 
     @Override
index c20b10229a54bcd5c09ad077dca77855058175e8..da0b62b7c398e98aa80d15a008c0a9adfd6c518d 100644 (file)
@@ -36,14 +36,18 @@ interface OperationCallback {
     class Reference extends AtomicReference<OperationCallback> {
         private static final long serialVersionUID = 1L;
 
     class Reference extends AtomicReference<OperationCallback> {
         private static final long serialVersionUID = 1L;
 
-        public Reference(OperationCallback initialValue) {
+        Reference(OperationCallback initialValue) {
             super(initialValue);
         }
     }
 
     void run();
             super(initialValue);
         }
     }
 
     void run();
+
     void pause();
     void pause();
+
     void resume();
     void resume();
+
     void success();
     void success();
+
     void failure();
 }
     void failure();
 }
index ad26d0a50b4d19dccc3afee4086ea6fb16c86726..c035790a94596b77dad9fc0ce83ca338f36c686a 100644 (file)
@@ -71,14 +71,14 @@ public class OperationLimiter extends OnComplete<Object> {
     }
 
     @VisibleForTesting
     }
 
     @VisibleForTesting
-    int availablePermits(){
+    int availablePermits() {
         return semaphore.availablePermits();
     }
 
     /**
         return semaphore.availablePermits();
     }
 
     /**
-     * Release all the permits
+     * Release all the permits.
      */
     public void releaseAll() {
      */
     public void releaseAll() {
-        this.semaphore.release(maxPermits-availablePermits());
+        this.semaphore.release(maxPermits - availablePermits());
     }
 }
     }
 }
index 603fb20a6bd44a22f10ffe407806899ae4565fcb..6334bdcd0731e8e2d833cef4af0a7463c524062b 100644 (file)
@@ -50,7 +50,7 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
         this.actorContext = actorContext;
     }
 
         this.actorContext = actorContext;
     }
 
-    private Future<Object> completeOperation(Future<Object> operationFuture){
+    private Future<Object> completeOperation(Future<Object> operationFuture) {
         operationFuture.onComplete(limiter, actorContext.getClientDispatcher());
         return operationFuture;
     }
         operationFuture.onComplete(limiter, actorContext.getClientDispatcher());
         return operationFuture;
     }
@@ -110,14 +110,14 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
 
     private void batchModification(Modification modification) {
         incrementModificationCount();
 
     private void batchModification(Modification modification) {
         incrementModificationCount();
-        if(batchedModifications == null) {
+        if (batchedModifications == null) {
             batchedModifications = newBatchedModifications();
         }
 
         batchedModifications.addModification(modification);
 
             batchedModifications = newBatchedModifications();
         }
 
         batchedModifications.addModification(modification);
 
-        if(batchedModifications.getModifications().size() >=
-                actorContext.getDatastoreContext().getShardBatchedModificationCount()) {
+        if (batchedModifications.getModifications().size()
+                >= actorContext.getDatastoreContext().getShardBatchedModificationCount()) {
             sendBatchedModifications();
         }
     }
             sendBatchedModifications();
         }
     }
@@ -128,22 +128,20 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
 
     protected Future<Object> sendBatchedModifications(boolean ready, boolean doCommitOnReady) {
         Future<Object> sent = null;
 
     protected Future<Object> sendBatchedModifications(boolean ready, boolean doCommitOnReady) {
         Future<Object> sent = null;
-        if(ready || (batchedModifications != null && !batchedModifications.getModifications().isEmpty())) {
-            if(batchedModifications == null) {
+        if (ready || batchedModifications != null && !batchedModifications.getModifications().isEmpty()) {
+            if (batchedModifications == null) {
                 batchedModifications = newBatchedModifications();
             }
 
                 batchedModifications = newBatchedModifications();
             }
 
-            if(LOG.isDebugEnabled()) {
-                LOG.debug("Tx {} sending {} batched modifications, ready: {}", getIdentifier(),
-                        batchedModifications.getModifications().size(), ready);
-            }
+            LOG.debug("Tx {} sending {} batched modifications, ready: {}", getIdentifier(),
+                    batchedModifications.getModifications().size(), ready);
 
             batchedModifications.setReady(ready);
             batchedModifications.setDoCommitOnReady(doCommitOnReady);
             batchedModifications.setTotalMessagesSent(++totalBatchedModificationsSent);
             sent = executeOperationAsync(batchedModifications, actorContext.getTransactionCommitOperationTimeout());
 
 
             batchedModifications.setReady(ready);
             batchedModifications.setDoCommitOnReady(doCommitOnReady);
             batchedModifications.setTotalMessagesSent(++totalBatchedModificationsSent);
             sent = executeOperationAsync(batchedModifications, actorContext.getTransactionCommitOperationTimeout());
 
-            if(ready) {
+            if (ready) {
                 batchedModifications = null;
             } else {
                 batchedModifications = newBatchedModifications();
                 batchedModifications = null;
             } else {
                 batchedModifications = newBatchedModifications();
@@ -155,10 +153,8 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
 
     @Override
     public void executeModification(AbstractModification modification) {
 
     @Override
     public void executeModification(AbstractModification modification) {
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Tx {} executeModification {} called path = {}", getIdentifier(), modification.getClass()
-                    .getSimpleName(), modification.getPath());
-        }
+        LOG.debug("Tx {} executeModification {} called path = {}", getIdentifier(),
+                modification.getClass().getSimpleName(), modification.getPath());
 
         acquireOperation();
         batchModification(modification);
 
         acquireOperation();
         batchModification(modification);
@@ -166,10 +162,8 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
 
     @Override
     public <T> void executeRead(final AbstractRead<T> readCmd, final SettableFuture<T> returnFuture) {
 
     @Override
     public <T> void executeRead(final AbstractRead<T> readCmd, final SettableFuture<T> returnFuture) {
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Tx {} executeRead {} called path = {}", getIdentifier(), readCmd.getClass().getSimpleName(),
-                    readCmd.getPath());
-        }
+        LOG.debug("Tx {} executeRead {} called path = {}", getIdentifier(), readCmd.getClass().getSimpleName(),
+                readCmd.getPath());
 
         // Send any batched modifications. This is necessary to honor the read uncommitted semantics of the
         // public API contract.
 
         // Send any batched modifications. This is necessary to honor the read uncommitted semantics of the
         // public API contract.
@@ -180,17 +174,14 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
         OnComplete<Object> onComplete = new OnComplete<Object>() {
             @Override
             public void onComplete(Throwable failure, Object response) throws Throwable {
         OnComplete<Object> onComplete = new OnComplete<Object>() {
             @Override
             public void onComplete(Throwable failure, Object response) throws Throwable {
-                if(failure != null) {
-                    if(LOG.isDebugEnabled()) {
-                        LOG.debug("Tx {} {} operation failed: {}", getIdentifier(), readCmd.getClass().getSimpleName(),
-                                failure);
-                    }
-                    returnFuture.setException(new ReadFailedException("Error checking " + readCmd.getClass().getSimpleName()
-                            + " for path " + readCmd.getPath(), failure));
+                if (failure != null) {
+                    LOG.debug("Tx {} {} operation failed: {}", getIdentifier(), readCmd.getClass().getSimpleName(),
+                            failure);
+
+                    returnFuture.setException(new ReadFailedException("Error checking "
+                        + readCmd.getClass().getSimpleName() + " for path " + readCmd.getPath(), failure));
                 } else {
                 } else {
-                    if(LOG.isDebugEnabled()) {
-                        LOG.debug("Tx {} {} operation succeeded", getIdentifier(), readCmd.getClass().getSimpleName());
-                    }
+                    LOG.debug("Tx {} {} operation succeeded", getIdentifier(), readCmd.getClass().getSimpleName());
                     readCmd.processResponse(response, returnFuture);
                 }
             }
                     readCmd.processResponse(response, returnFuture);
                 }
             }
@@ -206,7 +197,7 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
      * Acquire operation from the limiter if the hand-off has completed. If
      * the hand-off is still ongoing, this method does nothing.
      */
      * Acquire operation from the limiter if the hand-off has completed. If
      * the hand-off is still ongoing, this method does nothing.
      */
-    private final void acquireOperation() {
+    private void acquireOperation() {
         if (isOperationHandOffComplete()) {
             limiter.acquire();
         }
         if (isOperationHandOffComplete()) {
             limiter.acquire();
         }
index 2924eaab574f2e3bb95b30877d7bef2328a0d6cf..1e0d1279e3e749b9728a3d8cdfc1d61ec59facbc 100644 (file)
@@ -30,7 +30,7 @@ import scala.concurrent.duration.FiniteDuration;
  * Handles creation of TransactionContext instances for remote transactions. This class creates
  * remote transactions, if necessary, by sending CreateTransaction messages with retries, up to a limit,
  * if the shard doesn't have a leader yet. This is done by scheduling a retry task after a short delay.
  * Handles creation of TransactionContext instances for remote transactions. This class creates
  * remote transactions, if necessary, by sending CreateTransaction messages with retries, up to a limit,
  * if the shard doesn't have a leader yet. This is done by scheduling a retry task after a short delay.
- * <p>
+ * <p/>
  * The end result from a completed CreateTransaction message is a TransactionContext that is
  * used to perform transaction operations. Transaction operations that occur before the
  * CreateTransaction completes are cache via a TransactionContextWrapper and executed once the
  * The end result from a completed CreateTransaction message is a TransactionContext that is
  * used to perform transaction operations. Transaction operations that occur before the
  * CreateTransaction completes are cache via a TransactionContextWrapper and executed once the
@@ -59,8 +59,8 @@ final class RemoteTransactionContextSupport {
 
     private final TransactionContextWrapper transactionContextWrapper;
 
 
     private final TransactionContextWrapper transactionContextWrapper;
 
-    RemoteTransactionContextSupport(final TransactionContextWrapper transactionContextWrapper, final TransactionProxy parent,
-            final String shardName) {
+    RemoteTransactionContextSupport(final TransactionContextWrapper transactionContextWrapper,
+            final TransactionProxy parent, final String shardName) {
         this.parent = Preconditions.checkNotNull(parent);
         this.shardName = shardName;
         this.transactionContextWrapper = transactionContextWrapper;
         this.parent = Preconditions.checkNotNull(parent);
         this.shardName = shardName;
         this.transactionContextWrapper = transactionContextWrapper;
@@ -100,8 +100,8 @@ final class RemoteTransactionContextSupport {
     void setPrimaryShard(PrimaryShardInfo primaryShardInfo) {
         this.primaryShardInfo = primaryShardInfo;
 
     void setPrimaryShard(PrimaryShardInfo primaryShardInfo) {
         this.primaryShardInfo = primaryShardInfo;
 
-        if (getTransactionType() == TransactionType.WRITE_ONLY  &&
-                getActorContext().getDatastoreContext().isWriteOnlyTransactionOptimizationsEnabled()) {
+        if (getTransactionType() == TransactionType.WRITE_ONLY
+                && getActorContext().getDatastoreContext().isWriteOnlyTransactionOptimizationsEnabled()) {
             ActorSelection primaryShard = primaryShardInfo.getPrimaryShardActor();
 
             LOG.debug("Tx {} Primary shard {} found - creating WRITE_ONLY transaction context",
             ActorSelection primaryShard = primaryShardInfo.getPrimaryShardActor();
 
             LOG.debug("Tx {} Primary shard {} found - creating WRITE_ONLY transaction context",
@@ -120,10 +120,8 @@ final class RemoteTransactionContextSupport {
       Performs a CreateTransaction try async.
      */
     private void tryCreateTransaction() {
       Performs a CreateTransaction try async.
      */
     private void tryCreateTransaction() {
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Tx {} Primary shard {} found - trying create transaction", getIdentifier(),
-                    primaryShardInfo.getPrimaryShardActor());
-        }
+        LOG.debug("Tx {} Primary shard {} found - trying create transaction", getIdentifier(),
+                primaryShardInfo.getPrimaryShardActor());
 
         Object serializedCreateMessage = new CreateTransaction(getIdentifier(), getTransactionType().ordinal(),
                     primaryShardInfo.getPrimaryShardVersion()).toSerializable();
 
         Object serializedCreateMessage = new CreateTransaction(getIdentifier(), getTransactionType().ordinal(),
                     primaryShardInfo.getPrimaryShardVersion()).toSerializable();
@@ -146,15 +144,15 @@ final class RemoteTransactionContextSupport {
         Future<PrimaryShardInfo> findPrimaryFuture = getActorContext().findPrimaryShardAsync(shardName);
         findPrimaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
             @Override
         Future<PrimaryShardInfo> findPrimaryFuture = getActorContext().findPrimaryShardAsync(shardName);
         findPrimaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
             @Override
-            public void onComplete(final Throwable failure, final PrimaryShardInfo primaryShardInfo) {
-                onFindPrimaryShardComplete(failure, primaryShardInfo);
+            public void onComplete(final Throwable failure, final PrimaryShardInfo newPrimaryShardInfo) {
+                onFindPrimaryShardComplete(failure, newPrimaryShardInfo);
             }
         }, getActorContext().getClientDispatcher());
     }
 
             }
         }, getActorContext().getClientDispatcher());
     }
 
-    private void onFindPrimaryShardComplete(final Throwable failure, final PrimaryShardInfo primaryShardInfo) {
+    private void onFindPrimaryShardComplete(final Throwable failure, final PrimaryShardInfo newPrimaryShardInfo) {
         if (failure == null) {
         if (failure == null) {
-            this.primaryShardInfo = primaryShardInfo;
+            this.primaryShardInfo = newPrimaryShardInfo;
             tryCreateTransaction();
         } else {
             LOG.debug("Tx {}: Find primary for shard {} failed", getIdentifier(), shardName, failure);
             tryCreateTransaction();
         } else {
             LOG.debug("Tx {}: Find primary for shard {} failed", getIdentifier(), shardName, failure);
@@ -166,15 +164,15 @@ final class RemoteTransactionContextSupport {
     private void onCreateTransactionComplete(Throwable failure, Object response) {
         // An AskTimeoutException will occur if the local shard forwards to an unavailable remote leader or
         // the cached remote leader actor is no longer available.
     private void onCreateTransactionComplete(Throwable failure, Object response) {
         // An AskTimeoutException will occur if the local shard forwards to an unavailable remote leader or
         // the cached remote leader actor is no longer available.
-        boolean retryCreateTransaction = primaryShardInfo != null &&
-                (failure instanceof NoShardLeaderException || failure instanceof AskTimeoutException);
-        if(retryCreateTransaction) {
+        boolean retryCreateTransaction = primaryShardInfo != null
+                && (failure instanceof NoShardLeaderException || failure instanceof AskTimeoutException);
+        if (retryCreateTransaction) {
             // Schedule a retry unless we're out of retries. Note: totalCreateTxTimeout is volatile as it may
             // be written by different threads however not concurrently, therefore decrementing it
             // non-atomically here is ok.
             // Schedule a retry unless we're out of retries. Note: totalCreateTxTimeout is volatile as it may
             // be written by different threads however not concurrently, therefore decrementing it
             // non-atomically here is ok.
-            if(totalCreateTxTimeout > 0) {
+            if (totalCreateTxTimeout > 0) {
                 long scheduleInterval = CREATE_TX_TRY_INTERVAL_IN_MS;
                 long scheduleInterval = CREATE_TX_TRY_INTERVAL_IN_MS;
-                if(failure instanceof AskTimeoutException) {
+                if (failure instanceof AskTimeoutException) {
                     // Since we use the createTxMessageTimeout for the CreateTransaction request and it timed
                     // out, subtract it from the total timeout. Also since the createTxMessageTimeout period
                     // has already elapsed, we can immediately schedule the retry (10 ms is virtually immediate).
                     // Since we use the createTxMessageTimeout for the CreateTransaction request and it timed
                     // out, subtract it from the total timeout. Also since the createTxMessageTimeout period
                     // has already elapsed, we can immediately schedule the retry (10 ms is virtually immediate).
@@ -188,13 +186,8 @@ final class RemoteTransactionContextSupport {
                         getIdentifier(), shardName, failure, scheduleInterval);
 
                 getActorContext().getActorSystem().scheduler().scheduleOnce(
                         getIdentifier(), shardName, failure, scheduleInterval);
 
                 getActorContext().getActorSystem().scheduler().scheduleOnce(
-                        FiniteDuration.create(scheduleInterval, TimeUnit.MILLISECONDS),
-                        new Runnable() {
-                            @Override
-                            public void run() {
-                                tryFindPrimaryShard();
-                            }
-                        }, getActorContext().getClientDispatcher());
+                    FiniteDuration.create(scheduleInterval, TimeUnit.MILLISECONDS),
+                    () -> tryFindPrimaryShard(), getActorContext().getClientDispatcher());
                 return;
             }
         }
                 return;
             }
         }
@@ -212,15 +205,15 @@ final class RemoteTransactionContextSupport {
         // TransactionOperations. So to avoid thus timing, we don't publish the
         // TransactionContext until after we've executed all cached TransactionOperations.
         TransactionContext localTransactionContext;
         // TransactionOperations. So to avoid thus timing, we don't publish the
         // TransactionContext until after we've executed all cached TransactionOperations.
         TransactionContext localTransactionContext;
-        if(failure != null) {
+        if (failure != null) {
             LOG.debug("Tx {} Creating NoOpTransaction because of error", getIdentifier(), failure);
 
             Throwable resultingEx = failure;
             LOG.debug("Tx {} Creating NoOpTransaction because of error", getIdentifier(), failure);
 
             Throwable resultingEx = failure;
-            if(failure instanceof AskTimeoutException) {
+            if (failure instanceof AskTimeoutException) {
                 resultingEx = new ShardLeaderNotRespondingException(String.format(
                         "Could not create a %s transaction on shard %s. The shard leader isn't responding.",
                         parent.getType(), shardName), failure);
                 resultingEx = new ShardLeaderNotRespondingException(String.format(
                         "Could not create a %s transaction on shard %s. The shard leader isn't responding.",
                         parent.getType(), shardName), failure);
-            } else if(!(failure instanceof NoShardLeaderException)) {
+            } else if (!(failure instanceof NoShardLeaderException)) {
                 resultingEx = new Exception(String.format(
                     "Error creating %s transaction on shard %s", parent.getType(), shardName), failure);
             }
                 resultingEx = new Exception(String.format(
                     "Error creating %s transaction on shard %s", parent.getType(), shardName), failure);
             }
@@ -251,7 +244,7 @@ final class RemoteTransactionContextSupport {
         final TransactionContext ret = new RemoteTransactionContext(transactionContextWrapper.getIdentifier(),
                 transactionActor, getActorContext(), remoteTransactionVersion, transactionContextWrapper.getLimiter());
 
         final TransactionContext ret = new RemoteTransactionContext(transactionContextWrapper.getIdentifier(),
                 transactionActor, getActorContext(), remoteTransactionVersion, transactionContextWrapper.getLimiter());
 
-        if(parent.getType() == TransactionType.READ_ONLY) {
+        if (parent.getType() == TransactionType.READ_ONLY) {
             TransactionContextCleanup.track(parent, ret);
         }
 
             TransactionContextCleanup.track(parent, ret);
         }
 
index a1e506f6ecba7dca921a6df5d7f871237ca25850..d52d3a3bf20e576fce0556e866a53cf74d7c6a4d 100644 (file)
@@ -71,10 +71,9 @@ import scala.concurrent.duration.Duration;
 import scala.concurrent.duration.FiniteDuration;
 
 /**
 import scala.concurrent.duration.FiniteDuration;
 
 /**
- * A Shard represents a portion of the logical data tree <br/>
- * <p>
+ * A Shard represents a portion of the logical data tree.
+ * <p/>
  * Our Shard uses InMemoryDataTree as it's internal representation and delegates all requests it
  * Our Shard uses InMemoryDataTree as it's internal representation and delegates all requests it
- * </p>
  */
 public class Shard extends RaftActor {
 
  */
 public class Shard extends RaftActor {
 
@@ -147,7 +146,7 @@ public class Shard extends RaftActor {
                 new ShardDataTreeChangeListenerPublisherActorProxy(getContext(), name + "-DTCL-publisher");
         ShardDataChangeListenerPublisherActorProxy dataChangeListenerPublisher =
                 new ShardDataChangeListenerPublisherActorProxy(getContext(), name + "-DCL-publisher");
                 new ShardDataTreeChangeListenerPublisherActorProxy(getContext(), name + "-DTCL-publisher");
         ShardDataChangeListenerPublisherActorProxy dataChangeListenerPublisher =
                 new ShardDataChangeListenerPublisherActorProxy(getContext(), name + "-DCL-publisher");
-        if(builder.getDataTree() != null) {
+        if (builder.getDataTree() != null) {
             store = new ShardDataTree(this, builder.getSchemaContext(), builder.getDataTree(),
                     treeChangeListenerPublisher, dataChangeListenerPublisher, name);
         } else {
             store = new ShardDataTree(this, builder.getSchemaContext(), builder.getDataTree(),
                     treeChangeListenerPublisher, dataChangeListenerPublisher, name);
         } else {
@@ -262,16 +261,16 @@ public class Shard extends RaftActor {
                 commitCoordinator.checkForExpiredTransactions(transactionCommitTimeout, this);
             } else if (message instanceof DatastoreContext) {
                 onDatastoreContext((DatastoreContext)message);
                 commitCoordinator.checkForExpiredTransactions(transactionCommitTimeout, this);
             } else if (message instanceof DatastoreContext) {
                 onDatastoreContext((DatastoreContext)message);
-            } else if (message instanceof RegisterRoleChangeListener){
+            } else if (message instanceof RegisterRoleChangeListener) {
                 roleChangeNotifier.get().forward(message, context());
             } else if (message instanceof FollowerInitialSyncUpStatus) {
                 shardMBean.setFollowerInitialSyncStatus(((FollowerInitialSyncUpStatus) message).isInitialSyncDone());
                 context().parent().tell(message, self());
                 roleChangeNotifier.get().forward(message, context());
             } else if (message instanceof FollowerInitialSyncUpStatus) {
                 shardMBean.setFollowerInitialSyncStatus(((FollowerInitialSyncUpStatus) message).isInitialSyncDone());
                 context().parent().tell(message, self());
-            } else if (GET_SHARD_MBEAN_MESSAGE.equals(message)){
+            } else if (GET_SHARD_MBEAN_MESSAGE.equals(message)) {
                 sender().tell(getShardMBean(), self());
             } else if (message instanceof GetShardDataTree) {
                 sender().tell(store.getDataTree(), self());
                 sender().tell(getShardMBean(), self());
             } else if (message instanceof GetShardDataTree) {
                 sender().tell(store.getDataTree(), self());
-            } else if (message instanceof ServerRemoved){
+            } else if (message instanceof ServerRemoved) {
                 context().parent().forward(message, context());
             } else if (ShardTransactionMessageRetrySupport.TIMER_MESSAGE_CLASS.isInstance(message)) {
                 messageRetrySupport.onTimerMessage(message);
                 context().parent().forward(message, context());
             } else if (ShardTransactionMessageRetrySupport.TIMER_MESSAGE_CLASS.isInstance(message)) {
                 messageRetrySupport.onTimerMessage(message);
@@ -302,7 +301,8 @@ public class Shard extends RaftActor {
     }
 
     @Override
     }
 
     @Override
-    protected LeaderStateChanged newLeaderStateChanged(final String memberId, final String leaderId, final short leaderPayloadVersion) {
+    protected LeaderStateChanged newLeaderStateChanged(final String memberId, final String leaderId,
+            final short leaderPayloadVersion) {
         return isLeader() ? new ShardLeaderStateChanged(memberId, leaderId, store.getDataTree(), leaderPayloadVersion)
                 : new ShardLeaderStateChanged(memberId, leaderId, leaderPayloadVersion);
     }
         return isLeader() ? new ShardLeaderStateChanged(memberId, leaderId, store.getDataTree(), leaderPayloadVersion)
                 : new ShardLeaderStateChanged(memberId, leaderId, leaderPayloadVersion);
     }
@@ -348,7 +348,7 @@ public class Shard extends RaftActor {
         LOG.debug("{}: Can committing transaction {}", persistenceId(), canCommit.getTransactionID());
 
         if (isLeader()) {
         LOG.debug("{}: Can committing transaction {}", persistenceId(), canCommit.getTransactionID());
 
         if (isLeader()) {
-        commitCoordinator.handleCanCommit(canCommit.getTransactionID(), getSender(), this);
+            commitCoordinator.handleCanCommit(canCommit.getTransactionID(), getSender(), this);
         } else {
             ActorSelection leader = getLeader();
             if (leader == null) {
         } else {
             ActorSelection leader = getLeader();
             if (leader == null) {
@@ -361,6 +361,7 @@ public class Shard extends RaftActor {
         }
     }
 
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     protected void handleBatchedModificationsLocal(final BatchedModifications batched, final ActorRef sender) {
         try {
             commitCoordinator.handleBatchedModifications(batched, sender, this);
     protected void handleBatchedModificationsLocal(final BatchedModifications batched, final ActorRef sender) {
         try {
             commitCoordinator.handleBatchedModifications(batched, sender, this);
@@ -397,8 +398,9 @@ public class Shard extends RaftActor {
                 // we need to reconstruct previous BatchedModifications from the transaction
                 // DataTreeModification, honoring the max batched modification count, and forward all the
                 // previous BatchedModifications to the new leader.
                 // we need to reconstruct previous BatchedModifications from the transaction
                 // DataTreeModification, honoring the max batched modification count, and forward all the
                 // previous BatchedModifications to the new leader.
-                Collection<BatchedModifications> newModifications = commitCoordinator.createForwardedBatchedModifications(
-                        batched, datastoreContext.getShardBatchedModificationCount());
+                Collection<BatchedModifications> newModifications = commitCoordinator
+                        .createForwardedBatchedModifications(batched,
+                                datastoreContext.getShardBatchedModificationCount());
 
                 LOG.debug("{}: Forwarding {} BatchedModifications to leader {}", persistenceId(),
                         newModifications.size(), leader);
 
                 LOG.debug("{}: Forwarding {} BatchedModifications to leader {}", persistenceId(),
                         newModifications.size(), leader);
@@ -413,8 +415,8 @@ public class Shard extends RaftActor {
     private boolean failIfIsolatedLeader(final ActorRef sender) {
         if (isIsolatedLeader()) {
             sender.tell(new akka.actor.Status.Failure(new NoShardLeaderException(String.format(
     private boolean failIfIsolatedLeader(final ActorRef sender) {
         if (isIsolatedLeader()) {
             sender.tell(new akka.actor.Status.Failure(new NoShardLeaderException(String.format(
-                    "Shard %s was the leader but has lost contact with all of its followers. Either all" +
-                    " other follower nodes are down or this node is isolated by a network partition.",
+                    "Shard %s was the leader but has lost contact with all of its followers. Either all"
+                    " other follower nodes are down or this node is isolated by a network partition.",
                     persistenceId()))), getSelf());
             return true;
         }
                     persistenceId()))), getSelf());
             return true;
         }
@@ -426,6 +428,7 @@ public class Shard extends RaftActor {
         return getRaftState() == RaftState.IsolatedLeader;
     }
 
         return getRaftState() == RaftState.IsolatedLeader;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void handleReadyLocalTransaction(final ReadyLocalTransaction message) {
         LOG.debug("{}: handleReadyLocalTransaction for {}", persistenceId(), message.getTransactionID());
 
     private void handleReadyLocalTransaction(final ReadyLocalTransaction message) {
         LOG.debug("{}: handleReadyLocalTransaction for {}", persistenceId(), message.getTransactionID());
 
@@ -496,10 +499,11 @@ public class Shard extends RaftActor {
         store.closeTransactionChain(closeTransactionChain.getIdentifier());
     }
 
         store.closeTransactionChain(closeTransactionChain.getIdentifier());
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void createTransaction(final CreateTransaction createTransaction) {
         try {
     private void createTransaction(final CreateTransaction createTransaction) {
         try {
-            if (TransactionType.fromInt(createTransaction.getTransactionType()) != TransactionType.READ_ONLY &&
-                    failIfIsolatedLeader(getSender())) {
+            if (TransactionType.fromInt(createTransaction.getTransactionType()) != TransactionType.READ_ONLY
+                    && failIfIsolatedLeader(getSender())) {
                 return;
             }
 
                 return;
             }
 
@@ -621,9 +625,8 @@ public class Shard extends RaftActor {
                     }
                 }
             } else {
                     }
                 }
             } else {
-                commitCoordinator.abortPendingTransactions(
-                        "The transacton was aborted due to inflight leadership change and the leader address isn't available.",
-                        this);
+                commitCoordinator.abortPendingTransactions("The transacton was aborted due to inflight leadership "
+                        + "change and the leader address isn't available.", this);
             }
         }
 
             }
         }
 
@@ -638,7 +641,8 @@ public class Shard extends RaftActor {
      * @return the converted messages
      */
     public Collection<?> convertPendingTransactionsToMessages() {
      * @return the converted messages
      */
     public Collection<?> convertPendingTransactionsToMessages() {
-        return commitCoordinator.convertPendingTransactionsToMessages(datastoreContext.getShardBatchedModificationCount());
+        return commitCoordinator.convertPendingTransactionsToMessages(
+                datastoreContext.getShardBatchedModificationCount());
     }
 
     @Override
     }
 
     @Override
@@ -675,7 +679,7 @@ public class Shard extends RaftActor {
         return new Builder();
     }
 
         return new Builder();
     }
 
-    public static abstract class AbstractBuilder<T extends AbstractBuilder<T, S>, S extends Shard> {
+    public abstract static class AbstractBuilder<T extends AbstractBuilder<T, S>, S extends Shard> {
         private final Class<S> shardClass;
         private ShardIdentifier id;
         private Map<String, String> peerAddresses = Collections.emptyMap();
         private final Class<S> shardClass;
         private ShardIdentifier id;
         private Map<String, String> peerAddresses = Collections.emptyMap();
@@ -698,39 +702,39 @@ public class Shard extends RaftActor {
             return (T) this;
         }
 
             return (T) this;
         }
 
-        public T id(final ShardIdentifier id) {
+        public T id(final ShardIdentifier newId) {
             checkSealed();
             checkSealed();
-            this.id = id;
+            this.id = newId;
             return self();
         }
 
             return self();
         }
 
-        public T peerAddresses(final Map<String, String> peerAddresses) {
+        public T peerAddresses(final Map<String, String> newPeerAddresses) {
             checkSealed();
             checkSealed();
-            this.peerAddresses = peerAddresses;
+            this.peerAddresses = newPeerAddresses;
             return self();
         }
 
             return self();
         }
 
-        public T datastoreContext(final DatastoreContext datastoreContext) {
+        public T datastoreContext(final DatastoreContext newDatastoreContext) {
             checkSealed();
             checkSealed();
-            this.datastoreContext = datastoreContext;
+            this.datastoreContext = newDatastoreContext;
             return self();
         }
 
             return self();
         }
 
-        public T schemaContext(final SchemaContext schemaContext) {
+        public T schemaContext(final SchemaContext newSchemaContext) {
             checkSealed();
             checkSealed();
-            this.schemaContext = schemaContext;
+            this.schemaContext = newSchemaContext;
             return self();
         }
 
             return self();
         }
 
-        public T restoreFromSnapshot(final DatastoreSnapshot.ShardSnapshot restoreFromSnapshot) {
+        public T restoreFromSnapshot(final DatastoreSnapshot.ShardSnapshot newRestoreFromSnapshot) {
             checkSealed();
             checkSealed();
-            this.restoreFromSnapshot = restoreFromSnapshot;
+            this.restoreFromSnapshot = newRestoreFromSnapshot;
             return self();
         }
 
             return self();
         }
 
-        public T dataTree(final TipProducingDataTree dataTree) {
+        public T dataTree(final TipProducingDataTree newDataTree) {
             checkSealed();
             checkSealed();
-            this.dataTree = dataTree;
+            this.dataTree = newDataTree;
             return self();
         }
 
             return self();
         }
 
@@ -760,13 +764,14 @@ public class Shard extends RaftActor {
 
         public TreeType getTreeType() {
             switch (datastoreContext.getLogicalStoreType()) {
 
         public TreeType getTreeType() {
             switch (datastoreContext.getLogicalStoreType()) {
-            case CONFIGURATION:
-                return TreeType.CONFIGURATION;
-            case OPERATIONAL:
-                return TreeType.OPERATIONAL;
+                case CONFIGURATION:
+                    return TreeType.CONFIGURATION;
+                case OPERATIONAL:
+                    return TreeType.OPERATIONAL;
+                default:
+                    throw new IllegalStateException("Unhandled logical store type "
+                            + datastoreContext.getLogicalStoreType());
             }
             }
-
-            throw new IllegalStateException("Unhandled logical store type " + datastoreContext.getLogicalStoreType());
         }
 
         protected void verify() {
         }
 
         protected void verify() {
index b3feadcfb90d1dcfe9fdb26b1587e8d5a8c88eac..7e3cd02efbce2ebe6c31e600a494177bcf0a6cbf 100644 (file)
@@ -97,7 +97,6 @@ final class ShardCommitCoordinator {
      * @param ready the ForwardedReadyTransaction message to process
      * @param sender the sender of the message
      * @param shard the transaction's shard actor
      * @param ready the ForwardedReadyTransaction message to process
      * @param sender the sender of the message
      * @param shard the transaction's shard actor
-     * @param schema
      */
     void handleForwardedReadyTransaction(final ForwardedReadyTransaction ready, final ActorRef sender,
             final Shard shard) {
      */
     void handleForwardedReadyTransaction(final ForwardedReadyTransaction ready, final ActorRef sender,
             final Shard shard) {
@@ -217,8 +216,8 @@ final class ShardCommitCoordinator {
         cohortEntry.getTransaction().getSnapshot().applyToCursor(new AbstractBatchedModificationsCursor() {
             @Override
             protected BatchedModifications getModifications() {
         cohortEntry.getTransaction().getSnapshot().applyToCursor(new AbstractBatchedModificationsCursor() {
             @Override
             protected BatchedModifications getModifications() {
-                if (newModifications.isEmpty() ||
-                        newModifications.getLast().getModifications().size() >= maxModificationsPerBatch) {
+                if (newModifications.isEmpty()
+                        || newModifications.getLast().getModifications().size() >= maxModificationsPerBatch) {
                     newModifications.add(new BatchedModifications(from.getTransactionID(), from.getVersion()));
                 }
 
                     newModifications.add(new BatchedModifications(from.getTransactionID(), from.getVersion()));
                 }
 
@@ -249,12 +248,12 @@ final class ShardCommitCoordinator {
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(final Throwable t) {
+            public void onFailure(final Throwable failure) {
                 log.debug("{}: An exception occurred during canCommit for {}: {}", name,
                 log.debug("{}: An exception occurred during canCommit for {}: {}", name,
-                        cohortEntry.getTransactionID(), t);
+                        cohortEntry.getTransactionID(), failure);
 
                 cohortCache.remove(cohortEntry.getTransactionID());
 
                 cohortCache.remove(cohortEntry.getTransactionID());
-                cohortEntry.getReplySender().tell(new Failure(t), cohortEntry.getShard().self());
+                cohortEntry.getReplySender().tell(new Failure(failure), cohortEntry.getShard().self());
             }
         });
     }
             }
         });
     }
@@ -300,12 +299,12 @@ final class ShardCommitCoordinator {
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(final Throwable t) {
+            public void onFailure(final Throwable failure) {
                 log.error("{} An exception occurred while preCommitting transaction {}", name,
                 log.error("{} An exception occurred while preCommitting transaction {}", name,
-                        cohortEntry.getTransactionID(), t);
+                        cohortEntry.getTransactionID(), failure);
 
                 cohortCache.remove(cohortEntry.getTransactionID());
 
                 cohortCache.remove(cohortEntry.getTransactionID());
-                cohortEntry.getReplySender().tell(new Failure(t), cohortEntry.getShard().self());
+                cohortEntry.getReplySender().tell(new Failure(failure), cohortEntry.getShard().self());
             }
         });
     }
             }
         });
     }
@@ -326,12 +325,12 @@ final class ShardCommitCoordinator {
             }
 
             @Override
             }
 
             @Override
-            public void onFailure(final Throwable t) {
+            public void onFailure(final Throwable failure) {
                 log.error("{}, An exception occurred while committing transaction {}", persistenceId(),
                 log.error("{}, An exception occurred while committing transaction {}", persistenceId(),
-                        cohortEntry.getTransactionID(), t);
+                        cohortEntry.getTransactionID(), failure);
 
                 cohortCache.remove(cohortEntry.getTransactionID());
 
                 cohortCache.remove(cohortEntry.getTransactionID());
-                sender.tell(new Failure(t), cohortEntry.getShard().self());
+                sender.tell(new Failure(failure), cohortEntry.getShard().self());
             }
         });
     }
             }
         });
     }
@@ -359,6 +358,7 @@ final class ShardCommitCoordinator {
         doCommit(cohortEntry);
     }
 
         doCommit(cohortEntry);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     void handleAbort(final Identifier transactionID, final ActorRef sender, final Shard shard) {
         CohortEntry cohortEntry = cohortCache.remove(transactionID);
         if (cohortEntry == null) {
     void handleAbort(final Identifier transactionID, final ActorRef sender, final Shard shard) {
         CohortEntry cohortEntry = cohortCache.remove(transactionID);
         if (cohortEntry == null) {
@@ -389,7 +389,7 @@ final class ShardCommitCoordinator {
         Iterator<CohortEntry> iter = cohortCache.values().iterator();
         while (iter.hasNext()) {
             CohortEntry cohortEntry = iter.next();
         Iterator<CohortEntry> iter = cohortCache.values().iterator();
         while (iter.hasNext()) {
             CohortEntry cohortEntry = iter.next();
-            if(cohortEntry.isFailed()) {
+            if (cohortEntry.isFailed()) {
                 iter.remove();
             }
         }
                 iter.remove();
             }
         }
index 0b898ede3c1ed656d014476032156eb1e25cef90..e3c71830a85df1b8d8d3f0e240257f280c577c0f 100644 (file)
@@ -36,8 +36,9 @@ class ShardDataChangeListenerPublisherActorProxy extends AbstractShardDataTreeNo
     }
 
     @Override
     }
 
     @Override
-    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L> registerDataChangeListener(
-            YangInstanceIdentifier path, L listener, DataChangeScope scope) {
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
+            DataChangeListenerRegistration<L> registerDataChangeListener(YangInstanceIdentifier path, L listener,
+                    DataChangeScope scope) {
         return delegatePublisher.registerDataChangeListener(path, listener, scope);
     }
 
         return delegatePublisher.registerDataChangeListener(path, listener, scope);
     }
 
index bf3b200825bc0c07c2283e7ceaf5d0c25363561a..5a7ce80ffd14cf61e4086bd3f3a7e7895f91f60e 100644 (file)
@@ -76,7 +76,7 @@ import scala.concurrent.duration.Duration;
  * Internal shard state, similar to a DOMStore, but optimized for use in the actor system,
  * e.g. it does not expose public interfaces and assumes it is only ever called from a
  * single thread.
  * Internal shard state, similar to a DOMStore, but optimized for use in the actor system,
  * e.g. it does not expose public interfaces and assumes it is only ever called from a
  * single thread.
- *
+ * <p/>
  * This class is not part of the API contract and is subject to change at any time.
  */
 @NotThreadSafe
  * This class is not part of the API contract and is subject to change at any time.
  */
 @NotThreadSafe
@@ -146,9 +146,9 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         return schemaContext;
     }
 
         return schemaContext;
     }
 
-    void updateSchemaContext(final SchemaContext schemaContext) {
-        dataTree.setSchemaContext(schemaContext);
-        this.schemaContext = Preconditions.checkNotNull(schemaContext);
+    void updateSchemaContext(final SchemaContext newSchemaContext) {
+        dataTree.setSchemaContext(newSchemaContext);
+        this.schemaContext = Preconditions.checkNotNull(newSchemaContext);
     }
 
     /**
     }
 
     /**
@@ -171,7 +171,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         return new MetadataShardDataTreeSnapshot(rootNode, metaBuilder.build());
     }
 
         return new MetadataShardDataTreeSnapshot(rootNode, metaBuilder.build());
     }
 
-    private void applySnapshot(final @Nonnull ShardDataTreeSnapshot snapshot,
+    private void applySnapshot(@Nonnull final ShardDataTreeSnapshot snapshot,
             final UnaryOperator<DataTreeModification> wrapper) throws DataValidationFailedException {
         final Stopwatch elapsed = Stopwatch.createStarted();
 
             final UnaryOperator<DataTreeModification> wrapper) throws DataValidationFailedException {
         final Stopwatch elapsed = Stopwatch.createStarted();
 
@@ -215,6 +215,17 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         LOG.debug("{}: state snapshot applied in %s", logContext, elapsed);
     }
 
         LOG.debug("{}: state snapshot applied in %s", logContext, elapsed);
     }
 
+    /**
+     * Apply a snapshot coming from the leader. This method assumes the leader and follower SchemaContexts match and
+     * does not perform any pruning.
+     *
+     * @param snapshot Snapshot that needs to be applied
+     * @throws DataValidationFailedException when the snapshot fails to apply
+     */
+    void applySnapshot(@Nonnull final ShardDataTreeSnapshot snapshot) throws DataValidationFailedException {
+        applySnapshot(snapshot, UnaryOperator.identity());
+    }
+
     private PruningDataTreeModification wrapWithPruning(final DataTreeModification delegate) {
         return new PruningDataTreeModification(delegate, dataTree, schemaContext);
     }
     private PruningDataTreeModification wrapWithPruning(final DataTreeModification delegate) {
         return new PruningDataTreeModification(delegate, dataTree, schemaContext);
     }
@@ -237,18 +248,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         applySnapshot(snapshot, this::wrapWithPruning);
     }
 
         applySnapshot(snapshot, this::wrapWithPruning);
     }
 
-
-    /**
-     * Apply a snapshot coming from the leader. This method assumes the leader and follower SchemaContexts match and
-     * does not perform any pruning.
-     *
-     * @param snapshot Snapshot that needs to be applied
-     * @throws DataValidationFailedException when the snapshot fails to apply
-     */
-    void applySnapshot(final @Nonnull ShardDataTreeSnapshot snapshot) throws DataValidationFailedException {
-        applySnapshot(snapshot, UnaryOperator.identity());
-    }
-
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void applyRecoveryCandidate(final DataTreeCandidate candidate) throws DataValidationFailedException {
         final PruningDataTreeModification mod = wrapWithPruning(dataTree.takeSnapshot().newModification());
         DataTreeCandidates.applyToModification(mod, candidate);
     private void applyRecoveryCandidate(final DataTreeCandidate candidate) throws DataValidationFailedException {
         final PruningDataTreeModification mod = wrapWithPruning(dataTree.takeSnapshot().newModification());
         DataTreeCandidates.applyToModification(mod, candidate);
@@ -280,7 +280,8 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
      */
     void applyRecoveryPayload(final @Nonnull Payload payload) throws IOException, DataValidationFailedException {
         if (payload instanceof CommitTransactionPayload) {
      */
     void applyRecoveryPayload(final @Nonnull Payload payload) throws IOException, DataValidationFailedException {
         if (payload instanceof CommitTransactionPayload) {
-            final Entry<TransactionIdentifier, DataTreeCandidate> e = ((CommitTransactionPayload) payload).getCandidate();
+            final Entry<TransactionIdentifier, DataTreeCandidate> e =
+                    ((CommitTransactionPayload) payload).getCandidate();
             applyRecoveryCandidate(e.getValue());
             allMetadataCommittedTransaction(e.getKey());
         } else if (payload instanceof DataTreeCandidatePayload) {
             applyRecoveryCandidate(e.getValue());
             allMetadataCommittedTransaction(e.getKey());
         } else if (payload instanceof DataTreeCandidatePayload) {
@@ -330,7 +331,8 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
          */
         if (payload instanceof CommitTransactionPayload) {
             if (identifier == null) {
          */
         if (payload instanceof CommitTransactionPayload) {
             if (identifier == null) {
-                final Entry<TransactionIdentifier, DataTreeCandidate> e = ((CommitTransactionPayload) payload).getCandidate();
+                final Entry<TransactionIdentifier, DataTreeCandidate> e =
+                        ((CommitTransactionPayload) payload).getCandidate();
                 applyReplicatedCandidate(e.getKey(), e.getValue());
                 allMetadataCommittedTransaction(e.getKey());
             } else {
                 applyReplicatedCandidate(e.getKey(), e.getValue());
                 allMetadataCommittedTransaction(e.getKey());
             } else {
@@ -437,22 +439,23 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
             Optional<DataTreeCandidate>> registerChangeListener(final YangInstanceIdentifier path,
                     final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener,
                     final DataChangeScope scope) {
             Optional<DataTreeCandidate>> registerChangeListener(final YangInstanceIdentifier path,
                     final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener,
                     final DataChangeScope scope) {
-        final DataChangeListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> reg =
+        DataChangeListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> reg =
                 dataChangeListenerPublisher.registerDataChangeListener(path, listener, scope);
 
         return new SimpleEntry<>(reg, readCurrentData());
     }
 
     private Optional<DataTreeCandidate> readCurrentData() {
                 dataChangeListenerPublisher.registerDataChangeListener(path, listener, scope);
 
         return new SimpleEntry<>(reg, readCurrentData());
     }
 
     private Optional<DataTreeCandidate> readCurrentData() {
-        final Optional<NormalizedNode<?, ?>> currentState = dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY);
+        final Optional<NormalizedNode<?, ?>> currentState =
+                dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY);
         return currentState.isPresent() ? Optional.of(DataTreeCandidates.fromNormalizedNode(
             YangInstanceIdentifier.EMPTY, currentState.get())) : Optional.<DataTreeCandidate>absent();
     }
 
         return currentState.isPresent() ? Optional.of(DataTreeCandidates.fromNormalizedNode(
             YangInstanceIdentifier.EMPTY, currentState.get())) : Optional.<DataTreeCandidate>absent();
     }
 
-    public Entry<ListenerRegistration<DOMDataTreeChangeListener>, Optional<DataTreeCandidate>> registerTreeChangeListener(
-            final YangInstanceIdentifier path, final DOMDataTreeChangeListener listener) {
-        final ListenerRegistration<DOMDataTreeChangeListener> reg = treeChangeListenerPublisher.registerTreeChangeListener(
-                path, listener);
+    public Entry<ListenerRegistration<DOMDataTreeChangeListener>, Optional<DataTreeCandidate>>
+            registerTreeChangeListener(final YangInstanceIdentifier path, final DOMDataTreeChangeListener listener) {
+        final ListenerRegistration<DOMDataTreeChangeListener> reg =
+                treeChangeListenerPublisher.registerTreeChangeListener(path, listener);
 
         return new SimpleEntry<>(reg, readCurrentData());
     }
 
         return new SimpleEntry<>(reg, readCurrentData());
     }
@@ -488,6 +491,8 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     /**
     }
 
     /**
+     * Commits a modification.
+     *
      * @deprecated This method violates DataTree containment and will be removed.
      */
     @VisibleForTesting
      * @deprecated This method violates DataTree containment and will be removed.
      */
     @VisibleForTesting
@@ -502,7 +507,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
 
     public Collection<ShardDataTreeCohort> getAndClearPendingTransactions() {
         Collection<ShardDataTreeCohort> ret = new ArrayList<>(pendingTransactions.size());
 
     public Collection<ShardDataTreeCohort> getAndClearPendingTransactions() {
         Collection<ShardDataTreeCohort> ret = new ArrayList<>(pendingTransactions.size());
-        for(CommitEntry entry: pendingTransactions) {
+        for (CommitEntry entry: pendingTransactions) {
             ret.add(entry.cohort);
         }
 
             ret.add(entry.cohort);
         }
 
@@ -510,13 +515,14 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         return ret;
     }
 
         return ret;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void processNextTransaction() {
         while (!pendingTransactions.isEmpty()) {
             final CommitEntry entry = pendingTransactions.peek();
             final SimpleShardDataTreeCohort cohort = entry.cohort;
             final DataTreeModification modification = cohort.getDataTreeModification();
 
     private void processNextTransaction() {
         while (!pendingTransactions.isEmpty()) {
             final CommitEntry entry = pendingTransactions.peek();
             final SimpleShardDataTreeCohort cohort = entry.cohort;
             final DataTreeModification modification = cohort.getDataTreeModification();
 
-            if(cohort.getState() != State.CAN_COMMIT_PENDING) {
+            if (cohort.getState() != State.CAN_COMMIT_PENDING) {
                 break;
             }
 
                 break;
             }
 
@@ -538,7 +544,8 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
 
                 // For debugging purposes, allow dumping of the modification. Coupled with the above
                 // precondition log, it should allow us to understand what went on.
 
                 // For debugging purposes, allow dumping of the modification. Coupled with the above
                 // precondition log, it should allow us to understand what went on.
-                LOG.debug("{}: Store Tx {}: modifications: {} tree: {}", cohort.getIdentifier(), modification, dataTree);
+                LOG.debug("{}: Store Tx {}: modifications: {} tree: {}", cohort.getIdentifier(), modification,
+                        dataTree);
                 cause = new TransactionCommitFailedException("Data did not pass validation.", e);
             } catch (Exception e) {
                 LOG.warn("{}: Unexpected failure in validation phase", logContext, e);
                 cause = new TransactionCommitFailedException("Data did not pass validation.", e);
             } catch (Exception e) {
                 LOG.warn("{}: Unexpected failure in validation phase", logContext, e);
@@ -568,6 +575,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         processNextTransaction();
     }
 
         processNextTransaction();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     void startPreCommit(final SimpleShardDataTreeCohort cohort) {
         final CommitEntry entry = pendingTransactions.peek();
         Preconditions.checkState(entry != null, "Attempted to pre-commit of %s when no transactions pending", cohort);
     void startPreCommit(final SimpleShardDataTreeCohort cohort) {
         final CommitEntry entry = pendingTransactions.peek();
         Preconditions.checkState(entry != null, "Attempted to pre-commit of %s when no transactions pending", cohort);
@@ -599,6 +607,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         processNextTransaction();
     }
 
         processNextTransaction();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void finishCommit(final SimpleShardDataTreeCohort cohort) {
         final TransactionIdentifier txId = cohort.getIdentifier();
         final DataTreeCandidate candidate = cohort.getCandidate();
     private void finishCommit(final SimpleShardDataTreeCohort cohort) {
         final TransactionIdentifier txId = cohort.getIdentifier();
         final DataTreeCandidate candidate = cohort.getCandidate();
@@ -764,12 +773,12 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     private void maybeRunOperationOnPendingTransactionsComplete() {
     }
 
     private void maybeRunOperationOnPendingTransactionsComplete() {
-      if (runOnPendingTransactionsComplete != null && pendingTransactions.isEmpty()) {
-          LOG.debug("{}: Pending transactions complete - running operation {}", logContext,
-                  runOnPendingTransactionsComplete);
-
-          runOnPendingTransactionsComplete.run();
-          runOnPendingTransactionsComplete = null;
-      }
-  }
+        if (runOnPendingTransactionsComplete != null && pendingTransactions.isEmpty()) {
+            LOG.debug("{}: Pending transactions complete - running operation {}", logContext,
+                    runOnPendingTransactionsComplete);
+
+            runOnPendingTransactionsComplete.run();
+            runOnPendingTransactionsComplete = null;
+        }
+    }
 }
 }
index 2ac3ee8843d61cdc13d3da13ef2cacae764c7805..7196f839e4ca876e7ae67ec519f54b6751d603db 100644 (file)
@@ -23,7 +23,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 class ShardDataTreeChangeListenerPublisherActorProxy extends AbstractShardDataTreeNotificationPublisherActorProxy
         implements ShardDataTreeChangeListenerPublisher {
 
 class ShardDataTreeChangeListenerPublisherActorProxy extends AbstractShardDataTreeNotificationPublisherActorProxy
         implements ShardDataTreeChangeListenerPublisher {
 
-    private final ShardDataTreeChangeListenerPublisher delegatePublisher = new DefaultShardDataTreeChangeListenerPublisher();
+    private final ShardDataTreeChangeListenerPublisher delegatePublisher =
+            new DefaultShardDataTreeChangeListenerPublisher();
 
     ShardDataTreeChangeListenerPublisherActorProxy(ActorContext actorContext, String actorName) {
         super(actorContext, actorName);
 
     ShardDataTreeChangeListenerPublisherActorProxy(ActorContext actorContext, String actorName) {
         super(actorContext, actorName);
index d10a44d7ab34a8ef375d553ff05f0b6a41d2b678..c0c3d6cbb0a584b1523473d2baeb01a12f96e499 100644 (file)
@@ -31,6 +31,8 @@ abstract class ShardDataTreeMetadata<T extends ShardDataTreeSnapshotMetadata<T>>
 
     // Lifecycle events
     abstract void onTransactionCommitted(TransactionIdentifier txId);
 
     // Lifecycle events
     abstract void onTransactionCommitted(TransactionIdentifier txId);
+
     abstract void onHistoryClosed(LocalHistoryIdentifier historyId);
     abstract void onHistoryClosed(LocalHistoryIdentifier historyId);
+
     abstract void onHistoryPurged(LocalHistoryIdentifier historyId);
 }
     abstract void onHistoryPurged(LocalHistoryIdentifier historyId);
 }
index 81023562801926fb0aa05c394afb9014c4be5240..76c52c9bb55e4342d0056b81dd2e0748cd64aa6f 100644 (file)
@@ -29,7 +29,7 @@ public class ShardDataTreeNotificationPublisherActor extends AbstractUntypedActo
 
     @Override
     protected void handleReceive(Object message) {
 
     @Override
     protected void handleReceive(Object message) {
-        if(message instanceof PublishNotifications) {
+        if (message instanceof PublishNotifications) {
             PublishNotifications publisher = (PublishNotifications)message;
             timer.start();
 
             PublishNotifications publisher = (PublishNotifications)message;
             timer.start();
 
@@ -38,7 +38,7 @@ public class ShardDataTreeNotificationPublisherActor extends AbstractUntypedActo
             } finally {
                 long elapsedTime = timer.elapsed(TimeUnit.MILLISECONDS);
 
             } finally {
                 long elapsedTime = timer.elapsed(TimeUnit.MILLISECONDS);
 
-                if(elapsedTime >= ShardDataTreeNotificationPublisher.PUBLISH_DELAY_THRESHOLD_IN_MS) {
+                if (elapsedTime >= ShardDataTreeNotificationPublisher.PUBLISH_DELAY_THRESHOLD_IN_MS) {
                     LOG.warn("{}: Generation of change events for {} took longer than expected. Elapsed time: {}",
                             publisher.logContext, name, timer);
                 } else {
                     LOG.warn("{}: Generation of change events for {} took longer than expected. Elapsed time: {}",
                             publisher.logContext, name, timer);
                 } else {
index eefebb6af8f6c65638cee9d6e19d965e9a58e0d4..004e305f70ccf49d09a55694a3382a32b4fa54d9 100644 (file)
@@ -67,7 +67,8 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
     @Override
     protected void abortTransaction(final AbstractShardDataTreeTransaction<?> transaction) {
         if (transaction instanceof ReadWriteShardDataTreeTransaction) {
     @Override
     protected void abortTransaction(final AbstractShardDataTreeTransaction<?> transaction) {
         if (transaction instanceof ReadWriteShardDataTreeTransaction) {
-            Preconditions.checkState(openTransaction != null, "Attempted to abort transaction %s while none is outstanding", transaction);
+            Preconditions.checkState(openTransaction != null,
+                    "Attempted to abort transaction %s while none is outstanding", transaction);
             LOG.debug("Aborted transaction {}", transaction);
             openTransaction = null;
         }
             LOG.debug("Aborted transaction {}", transaction);
             openTransaction = null;
         }
@@ -75,7 +76,8 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
 
     @Override
     protected ShardDataTreeCohort finishTransaction(final ReadWriteShardDataTreeTransaction transaction) {
 
     @Override
     protected ShardDataTreeCohort finishTransaction(final ReadWriteShardDataTreeTransaction transaction) {
-        Preconditions.checkState(openTransaction != null, "Attempted to finish transaction %s while none is outstanding", transaction);
+        Preconditions.checkState(openTransaction != null,
+                "Attempted to finish transaction %s while none is outstanding", transaction);
 
         // dataTree is finalizing ready the transaction, we just record it for the next
         // transaction in chain
 
         // dataTree is finalizing ready the transaction, we just record it for the next
         // transaction in chain
index ee04aff515df8c4288e12e459137f26d4f6ab472..26e17057a741d0cdc4beed33daa777a452181516 100644 (file)
@@ -9,5 +9,6 @@ package org.opendaylight.controller.cluster.datastore;
 
 abstract class ShardDataTreeTransactionParent {
     abstract void abortTransaction(AbstractShardDataTreeTransaction<?> transaction);
 
 abstract class ShardDataTreeTransactionParent {
     abstract void abortTransaction(AbstractShardDataTreeTransaction<?> transaction);
+
     abstract ShardDataTreeCohort finishTransaction(ReadWriteShardDataTreeTransaction transaction);
 }
     abstract ShardDataTreeCohort finishTransaction(ReadWriteShardDataTreeTransaction transaction);
 }
index 3eba622c84c459bdb9abd8fbd484da5b4876a902..3021080758b80b5c1c3e4ba2eef9d7f7621863fd 100644 (file)
@@ -11,6 +11,8 @@ import java.io.Serializable;
 import java.util.Set;
 
 /**
 import java.util.Set;
 
 /**
+ * Manages shards.
+ *
  * @deprecated This is a deprecated placeholder to keep its inner class present. It serves no other purpose.
  */
 @Deprecated
  * @deprecated This is a deprecated placeholder to keep its inner class present. It serves no other purpose.
  */
 @Deprecated
@@ -25,7 +27,7 @@ public final class ShardManager {
 
         private final Set<String> modules;
 
 
         private final Set<String> modules;
 
-        public SchemaContextModules(Set<String> modules){
+        public SchemaContextModules(Set<String> modules) {
             this.modules = modules;
         }
 
             this.modules = modules;
         }
 
index 3e7274ce678cf4cd6c6f6f6d4a42d5ad18c630cb..eb8c139903a3a21ec0c273d3ac39b779f887a9e7 100644 (file)
@@ -16,7 +16,7 @@ import java.util.List;
 import javax.annotation.Nonnull;
 
 /**
 import javax.annotation.Nonnull;
 
 /**
- * Persisted data of the ShardManager
+ * Persisted data of the ShardManager.
  *
  * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.shardmanager.ShardManagerSnapshot} instead.
  *             This class is scheduled for removal once persistence migration from Beryllium is no longer needed.
  *
  * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.shardmanager.ShardManagerSnapshot} instead.
  *             This class is scheduled for removal once persistence migration from Beryllium is no longer needed.
index 7986886086130d5779aa07bef72161a31d9cb0f2..dfb0897b4850235d11d401b97d6759406a04f6ba 100644 (file)
@@ -15,8 +15,9 @@ import org.opendaylight.controller.cluster.datastore.messages.DataExists;
 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 
 /**
 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 
 /**
+ * Actor for a shard read transaction.
+ *
  * @author: syedbahm
  * @author: syedbahm
- * Date: 8/6/14
  */
 public class ShardReadTransaction extends ShardTransaction {
     private final AbstractShardDataTreeTransaction<?> transaction;
  */
 public class ShardReadTransaction extends ShardTransaction {
     private final AbstractShardDataTreeTransaction<?> transaction;
index 46a50390122057f3fce1cfe49c7c13343ff6f456..2978fc8d07e9e00304cff648e9d321dda068815e 100644 (file)
@@ -14,8 +14,9 @@ import org.opendaylight.controller.cluster.datastore.messages.DataExists;
 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 
 /**
 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 
 /**
+ * Actor for a shard read/write transaction.
+ *
  * @author: syedbahm
  * @author: syedbahm
- * Date: 8/6/14
  */
 public class ShardReadWriteTransaction extends ShardWriteTransaction {
     public ShardReadWriteTransaction(ReadWriteShardDataTreeTransaction transaction, ActorRef shardActor,
  */
 public class ShardReadWriteTransaction extends ShardWriteTransaction {
     public ShardReadWriteTransaction(ReadWriteShardDataTreeTransaction transaction, ActorRef shardActor,
@@ -25,9 +26,9 @@ public class ShardReadWriteTransaction extends ShardWriteTransaction {
 
     @Override
     public void handleReceive(Object message) {
 
     @Override
     public void handleReceive(Object message) {
-        if(ReadData.isSerializedType(message)) {
+        if (ReadData.isSerializedType(message)) {
             readData(ReadData.fromSerializable(message));
             readData(ReadData.fromSerializable(message));
-        } else if(DataExists.isSerializedType(message)) {
+        } else if (DataExists.isSerializedType(message)) {
             dataExists((DataExists) message);
         } else {
             super.handleReceive(message);
             dataExists((DataExists) message);
         } else {
             super.handleReceive(message);
index 5b7f289eed4ea2fa37296a07b5e47e54af2201ac..5e0d3407fb99baa3d6ff39a598f0de2ecc70b975 100644 (file)
@@ -34,7 +34,8 @@ class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
 
     private boolean open;
 
 
     private boolean open;
 
-    ShardRecoveryCoordinator(final ShardDataTree store,  final byte[] restoreFromSnapshot, final String shardName, final Logger log) {
+    ShardRecoveryCoordinator(final ShardDataTree store,  final byte[] restoreFromSnapshot, final String shardName,
+            final Logger log) {
         this.store = Preconditions.checkNotNull(store);
         this.shardName = Preconditions.checkNotNull(shardName);
         this.log = Preconditions.checkNotNull(log);
         this.store = Preconditions.checkNotNull(store);
         this.shardName = Preconditions.checkNotNull(shardName);
         this.log = Preconditions.checkNotNull(log);
@@ -49,6 +50,7 @@ class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
     }
 
     @Override
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void appendRecoveredLogEntry(final Payload payload) {
         Preconditions.checkState(open, "call startLogRecovery before calling appendRecoveredLogEntry");
 
     public void appendRecoveredLogEntry(final Payload payload) {
         Preconditions.checkState(open, "call startLogRecovery before calling appendRecoveredLogEntry");
 
@@ -83,6 +85,7 @@ class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
      * @param snapshotBytes the serialized snapshot
      */
     @Override
      * @param snapshotBytes the serialized snapshot
      */
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void applyRecoverySnapshot(final byte[] snapshotBytes) {
         log.debug("{}: Applying recovered snapshot", shardName);
 
     public void applyRecoverySnapshot(final byte[] snapshotBytes) {
         log.debug("{}: Applying recovered snapshot", shardName);
 
index adf60a0c21441a2bd0e0fde37c2416d1d28c81b0..6dc3f03081b71fe18c94e10dfb28d39c7d13d985 100644 (file)
@@ -62,6 +62,7 @@ class ShardSnapshotCohort implements RaftActorSnapshotCohort {
     }
 
     @Override
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void applySnapshot(final byte[] snapshotBytes) {
         // Since this will be done only on Recovery or when this actor is a Follower
         // we can safely commit everything in here. We not need to worry about event notifications
     public void applySnapshot(final byte[] snapshotBytes) {
         // Since this will be done only on Recovery or when this actor is a Follower
         // we can safely commit everything in here. We not need to worry about event notifications
index 2421cce26c0afa6f7a7c7cc3cf6b5da5830f6fd0..2b109b056c55c5d70f9f43a1f8ff01a1184b6c47 100644 (file)
@@ -29,16 +29,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
- * The ShardTransaction Actor represents a remote transaction
- * <p>
- * The ShardTransaction Actor delegates all actions to DOMDataReadWriteTransaction
- * </p>
- * <p>
- * Handles Messages <br/>
- * ---------------- <br/>
- * <li> {@link org.opendaylight.controller.cluster.datastore.messages.ReadData}
- * <li> {@link org.opendaylight.controller.cluster.datastore.messages.CloseTransaction}
- * </p>
+ * The ShardTransaction Actor represents a remote transaction that delegates all actions to DOMDataReadWriteTransaction.
  */
 public abstract class ShardTransaction extends AbstractUntypedActorWithMetering {
     private final ActorRef shardActor;
  */
 public abstract class ShardTransaction extends AbstractUntypedActorWithMetering {
     private final ActorRef shardActor;
@@ -52,8 +43,8 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         this.transactionID = Preconditions.checkNotNull(transactionID);
     }
 
         this.transactionID = Preconditions.checkNotNull(transactionID);
     }
 
-    public static Props props(TransactionType type, AbstractShardDataTreeTransaction<?> transaction, ActorRef shardActor,
-            DatastoreContext datastoreContext, ShardStats shardStats) {
+    public static Props props(TransactionType type, AbstractShardDataTreeTransaction<?> transaction,
+            ActorRef shardActor, DatastoreContext datastoreContext, ShardStats shardStats) {
         return Props.create(new ShardTransactionCreator(type, transaction, shardActor, datastoreContext, shardStats));
     }
 
         return Props.create(new ShardTransactionCreator(type, transaction, shardActor, datastoreContext, shardStats));
     }
 
@@ -86,7 +77,7 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
     private void closeTransaction(boolean sendReply) {
         getDOMStoreTransaction().abort();
 
     private void closeTransaction(boolean sendReply) {
         getDOMStoreTransaction().abort();
 
-        if(sendReply && returnCloseTransactionReply()) {
+        if (sendReply && returnCloseTransactionReply()) {
             getSender().tell(new CloseTransactionReply(), getSelf());
         }
 
             getSender().tell(new CloseTransactionReply(), getSelf());
         }
 
@@ -97,7 +88,8 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         final boolean ret = transaction.isClosed();
         if (ret) {
             shardStats.incrementFailedReadTransactionsCount();
         final boolean ret = transaction.isClosed();
         if (ret) {
             shardStats.incrementFailedReadTransactionsCount();
-            getSender().tell(new akka.actor.Status.Failure(new ReadFailedException("Transaction is closed")), getSelf());
+            getSender().tell(new akka.actor.Status.Failure(new ReadFailedException("Transaction is closed")),
+                    getSelf());
         }
         return ret;
     }
         }
         return ret;
     }
@@ -133,8 +125,8 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         final ShardStats shardStats;
         final TransactionType type;
 
         final ShardStats shardStats;
         final TransactionType type;
 
-        ShardTransactionCreator(TransactionType type, AbstractShardDataTreeTransaction<?> transaction, ActorRef shardActor,
-                DatastoreContext datastoreContext, ShardStats shardStats) {
+        ShardTransactionCreator(TransactionType type, AbstractShardDataTreeTransaction<?> transaction,
+                ActorRef shardActor, DatastoreContext datastoreContext, ShardStats shardStats) {
             this.transaction = Preconditions.checkNotNull(transaction);
             this.shardActor = shardActor;
             this.shardStats = shardStats;
             this.transaction = Preconditions.checkNotNull(transaction);
             this.shardActor = shardActor;
             this.shardStats = shardStats;
@@ -146,17 +138,19 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         public ShardTransaction create() throws Exception {
             final ShardTransaction tx;
             switch (type) {
         public ShardTransaction create() throws Exception {
             final ShardTransaction tx;
             switch (type) {
-            case READ_ONLY:
-                tx = new ShardReadTransaction(transaction, shardActor, shardStats);
-                break;
-            case READ_WRITE:
-                tx = new ShardReadWriteTransaction((ReadWriteShardDataTreeTransaction)transaction, shardActor, shardStats);
-                break;
-            case WRITE_ONLY:
-                tx = new ShardWriteTransaction((ReadWriteShardDataTreeTransaction)transaction, shardActor, shardStats);
-                break;
-            default:
-                throw new IllegalArgumentException("Unhandled transaction type " + type);
+                case READ_ONLY:
+                    tx = new ShardReadTransaction(transaction, shardActor, shardStats);
+                    break;
+                case READ_WRITE:
+                    tx = new ShardReadWriteTransaction((ReadWriteShardDataTreeTransaction)transaction, shardActor,
+                            shardStats);
+                    break;
+                case WRITE_ONLY:
+                    tx = new ShardWriteTransaction((ReadWriteShardDataTreeTransaction)transaction, shardActor,
+                            shardStats);
+                    break;
+                default:
+                    throw new IllegalArgumentException("Unhandled transaction type " + type);
             }
 
             tx.getContext().setReceiveTimeout(datastoreContext.getShardTransactionIdleTimeout());
             }
 
             tx.getContext().setReceiveTimeout(datastoreContext.getShardTransactionIdleTimeout());
@@ -59,20 +59,20 @@ class ShardTransactionActorFactory {
     ActorRef newShardTransaction(TransactionType type, TransactionIdentifier transactionID) {
         final AbstractShardDataTreeTransaction<?> transaction;
         switch (type) {
     ActorRef newShardTransaction(TransactionType type, TransactionIdentifier transactionID) {
         final AbstractShardDataTreeTransaction<?> transaction;
         switch (type) {
-        case READ_ONLY:
-            transaction = dataTree.newReadOnlyTransaction(transactionID);
-            shardMBean.incrementReadOnlyTransactionCount();
-            break;
-        case READ_WRITE:
-            transaction = dataTree.newReadWriteTransaction(transactionID);
-            shardMBean.incrementReadWriteTransactionCount();
-            break;
-        case WRITE_ONLY:
-            transaction = dataTree.newReadWriteTransaction(transactionID);
-            shardMBean.incrementWriteOnlyTransactionCount();
-            break;
-        default:
-            throw new IllegalArgumentException("Unsupported transaction type " + type);
+            case READ_ONLY:
+                transaction = dataTree.newReadOnlyTransaction(transactionID);
+                shardMBean.incrementReadOnlyTransactionCount();
+                break;
+            case READ_WRITE:
+                transaction = dataTree.newReadWriteTransaction(transactionID);
+                shardMBean.incrementReadWriteTransactionCount();
+                break;
+            case WRITE_ONLY:
+                transaction = dataTree.newReadWriteTransaction(transactionID);
+                shardMBean.incrementWriteOnlyTransactionCount();
+                break;
+            default:
+                throw new IllegalArgumentException("Unsupported transaction type " + type);
         }
 
         return actorContext.actorOf(ShardTransaction.props(type, transaction, shardActor, datastoreContext, shardMBean)
         }
 
         return actorContext.actorOf(ShardTransaction.props(type, transaction, shardActor, datastoreContext, shardMBean)
index 291867cf8fe6e696c693a8f4c10b882650fb8917..eea201e56d55b1ecdab037d221beb1389c0c5311 100644 (file)
@@ -48,14 +48,14 @@ class ShardTransactionMessageRetrySupport implements Closeable {
     }
 
     void retryMessages() {
     }
 
     void retryMessages() {
-        if(messagesToRetry.isEmpty()) {
+        if (messagesToRetry.isEmpty()) {
             return;
         }
 
         MessageInfo[] copy = messagesToRetry.toArray(new MessageInfo[messagesToRetry.size()]);
         messagesToRetry.clear();
 
             return;
         }
 
         MessageInfo[] copy = messagesToRetry.toArray(new MessageInfo[messagesToRetry.size()]);
         messagesToRetry.clear();
 
-        for(MessageInfo info: copy) {
+        for (MessageInfo info: copy) {
             LOG.debug("{}: Retrying message {}", shard.persistenceId(), info.message);
             info.retry(shard);
         }
             LOG.debug("{}: Retrying message {}", shard.persistenceId(), info.message);
             info.retry(shard);
         }
@@ -72,7 +72,7 @@ class ShardTransactionMessageRetrySupport implements Closeable {
 
     @Override
     public void close() {
 
     @Override
     public void close() {
-        for(MessageInfo info: messagesToRetry) {
+        for (MessageInfo info: messagesToRetry) {
             info.timedOut(shard);
         }
 
             info.timedOut(shard);
         }
 
@@ -97,7 +97,8 @@ class ShardTransactionMessageRetrySupport implements Closeable {
         }
 
         void timedOut(Shard shard) {
         }
 
         void timedOut(Shard shard) {
-            replyTo.tell(new Failure(new NoShardLeaderException(failureMessage, shard.persistenceId())), shard.getSelf());
+            replyTo.tell(new Failure(new NoShardLeaderException(failureMessage, shard.persistenceId())),
+                    shard.getSelf());
         }
     }
 }
         }
     }
 }
index 3b175a9c05956174896711412474abac649e0141..ee61090eeabf433218a2726fdeb6bf7557fce430 100644 (file)
@@ -21,8 +21,9 @@ import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 import org.opendaylight.controller.cluster.datastore.modification.Modification;
 
 /**
 import org.opendaylight.controller.cluster.datastore.modification.Modification;
 
 /**
+ * Actor for a shard write-only transaction.
+ *
  * @author: syedbahm
  * @author: syedbahm
- * Date: 8/6/14
  */
 public class ShardWriteTransaction extends ShardTransaction {
 
  */
 public class ShardWriteTransaction extends ShardTransaction {
 
@@ -50,6 +51,7 @@ public class ShardWriteTransaction extends ShardTransaction {
         }
     }
 
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void batchedModifications(BatchedModifications batched) {
         if (checkClosed()) {
             if (batched.isReady()) {
     private void batchedModifications(BatchedModifications batched) {
         if (checkClosed()) {
             if (batched.isReady()) {
@@ -59,17 +61,17 @@ public class ShardWriteTransaction extends ShardTransaction {
         }
 
         try {
         }
 
         try {
-            for(Modification modification: batched.getModifications()) {
+            for (Modification modification: batched.getModifications()) {
                 modification.apply(transaction.getSnapshot());
             }
 
             totalBatchedModificationsReceived++;
                 modification.apply(transaction.getSnapshot());
             }
 
             totalBatchedModificationsReceived++;
-            if(batched.isReady()) {
-                if(lastBatchedModificationsException != null) {
+            if (batched.isReady()) {
+                if (lastBatchedModificationsException != null) {
                     throw lastBatchedModificationsException;
                 }
 
                     throw lastBatchedModificationsException;
                 }
 
-                if(totalBatchedModificationsReceived != batched.getTotalMessagesSent()) {
+                if (totalBatchedModificationsReceived != batched.getTotalMessagesSent()) {
                     throw new IllegalStateException(String.format(
                             "The total number of batched messages received %d does not match the number sent %d",
                             totalBatchedModificationsReceived, batched.getTotalMessagesSent()));
                     throw new IllegalStateException(String.format(
                             "The total number of batched messages received %d does not match the number sent %d",
                             totalBatchedModificationsReceived, batched.getTotalMessagesSent()));
@@ -83,7 +85,7 @@ public class ShardWriteTransaction extends ShardTransaction {
             lastBatchedModificationsException = e;
             getSender().tell(new akka.actor.Status.Failure(e), getSelf());
 
             lastBatchedModificationsException = e;
             getSender().tell(new akka.actor.Status.Failure(e), getSelf());
 
-            if(batched.isReady()) {
+            if (batched.isReady()) {
                 getSelf().tell(PoisonPill.getInstance(), getSelf());
             }
         }
                 getSelf().tell(PoisonPill.getInstance(), getSelf());
             }
         }
@@ -99,7 +101,8 @@ public class ShardWriteTransaction extends ShardTransaction {
 
     private boolean checkClosed() {
         if (transaction.isClosed()) {
 
     private boolean checkClosed() {
         if (transaction.isClosed()) {
-            getSender().tell(new akka.actor.Status.Failure(new IllegalStateException("Transaction is closed, no modifications allowed")), getSelf());
+            getSender().tell(new akka.actor.Status.Failure(new IllegalStateException(
+                    "Transaction is closed, no modifications allowed")), getSelf());
             return true;
         } else {
             return false;
             return true;
         } else {
             return false;
index 5fac0abe6b0a221fafcf676a9764dfa66955e0be..71eaf7dbc8613837a69020a108e00f3d1781553e 100644 (file)
@@ -70,21 +70,21 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort implements Ide
     }
 
     @Override
     }
 
     @Override
-    public void canCommit(final FutureCallback<Void> callback) {
-        if(state == State.CAN_COMMIT_PENDING) {
+    public void canCommit(final FutureCallback<Void> newCallback) {
+        if (state == State.CAN_COMMIT_PENDING) {
             return;
         }
 
         checkState(State.READY);
             return;
         }
 
         checkState(State.READY);
-        this.callback = Preconditions.checkNotNull(callback);
+        this.callback = Preconditions.checkNotNull(newCallback);
         state = State.CAN_COMMIT_PENDING;
         dataTree.startCanCommit(this);
     }
 
     @Override
         state = State.CAN_COMMIT_PENDING;
         dataTree.startCanCommit(this);
     }
 
     @Override
-    public void preCommit(final FutureCallback<DataTreeCandidate> callback) {
+    public void preCommit(final FutureCallback<DataTreeCandidate> newCallback) {
         checkState(State.CAN_COMMIT_COMPLETE);
         checkState(State.CAN_COMMIT_COMPLETE);
-        this.callback = Preconditions.checkNotNull(callback);
+        this.callback = Preconditions.checkNotNull(newCallback);
         state = State.PRE_COMMIT_PENDING;
 
         if (nextFailure == null) {
         state = State.PRE_COMMIT_PENDING;
 
         if (nextFailure == null) {
@@ -125,9 +125,9 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort implements Ide
     }
 
     @Override
     }
 
     @Override
-    public void commit(final FutureCallback<UnsignedLong> callback) {
+    public void commit(final FutureCallback<UnsignedLong> newCallback) {
         checkState(State.PRE_COMMIT_COMPLETE);
         checkState(State.PRE_COMMIT_COMPLETE);
-        this.callback = Preconditions.checkNotNull(callback);
+        this.callback = Preconditions.checkNotNull(newCallback);
         state = State.COMMIT_PENDING;
         dataTree.startCommit(this, candidate);
     }
         state = State.COMMIT_PENDING;
         dataTree.startCommit(this, candidate);
     }
@@ -153,20 +153,20 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort implements Ide
      * Run user-defined canCommit and preCommit hooks. We want to run these before we initiate persistence so that
      * any failure to validate is propagated before we record the transaction.
      *
      * Run user-defined canCommit and preCommit hooks. We want to run these before we initiate persistence so that
      * any failure to validate is propagated before we record the transaction.
      *
-     * @param candidate {@link DataTreeCandidate} under consideration
-     * @throws ExecutionException
-     * @throws TimeoutException
+     * @param dataTreeCandidate {@link DataTreeCandidate} under consideration
+     * @throws ExecutionException if the operation fails
+     * @throws TimeoutException if the operation times out
      */
     // FIXME: this should be asynchronous
      */
     // FIXME: this should be asynchronous
-    void userPreCommit(final DataTreeCandidate candidate) throws ExecutionException, TimeoutException {
-        userCohorts.canCommit(candidate);
+    void userPreCommit(final DataTreeCandidate dataTreeCandidate) throws ExecutionException, TimeoutException {
+        userCohorts.canCommit(dataTreeCandidate);
         userCohorts.preCommit();
     }
 
         userCohorts.preCommit();
     }
 
-    void successfulPreCommit(final DataTreeCandidateTip candidate) {
-        LOG.trace("Transaction {} prepared candidate {}", transaction, candidate);
-        this.candidate = Verify.verifyNotNull(candidate);
-        switchState(State.PRE_COMMIT_COMPLETE).onSuccess(candidate);
+    void successfulPreCommit(final DataTreeCandidateTip dataTreeCandidate) {
+        LOG.trace("Transaction {} prepared candidate {}", transaction, dataTreeCandidate);
+        this.candidate = Verify.verifyNotNull(dataTreeCandidate);
+        switchState(State.PRE_COMMIT_COMPLETE).onSuccess(dataTreeCandidate);
     }
 
     void failedPreCommit(final Exception cause) {
     }
 
     void failedPreCommit(final Exception cause) {
index 505c959337840dfc9d75de1178d3d08c27af02a2..033cbeaae7b43437cfd4b540207a4700d53fd266 100644 (file)
@@ -53,7 +53,7 @@ class SingleCommitCohortProxy extends AbstractThreePhaseCommitCohort<Object> {
         cohortFuture.onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(Throwable failure, Object cohortResponse) {
         cohortFuture.onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(Throwable failure, Object cohortResponse) {
-                if(failure != null) {
+                if (failure != null) {
                     operationCallbackRef.get().failure();
                     returnFuture.setException(failure);
                     return;
                     operationCallbackRef.get().failure();
                     returnFuture.setException(failure);
                     return;
index 3820cc4eb8ccd64ac62003fafd7fae9038af503d..5ab85f1db261cae9e77c54954e84f98ade4ddae6 100644 (file)
@@ -14,20 +14,20 @@ import org.opendaylight.controller.cluster.common.actor.Monitor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class TerminationMonitor extends UntypedActor{
+public class TerminationMonitor extends UntypedActor {
     private static final Logger LOG = LoggerFactory.getLogger(TerminationMonitor.class);
     public static final String ADDRESS = "termination-monitor";
 
     private static final Logger LOG = LoggerFactory.getLogger(TerminationMonitor.class);
     public static final String ADDRESS = "termination-monitor";
 
-    public TerminationMonitor(){
+    public TerminationMonitor() {
         LOG.debug("Created TerminationMonitor");
     }
 
     @Override
     public void onReceive(Object message) throws Exception {
         LOG.debug("Created TerminationMonitor");
     }
 
     @Override
     public void onReceive(Object message) throws Exception {
-        if(message instanceof Terminated){
+        if (message instanceof Terminated) {
             Terminated terminated = (Terminated) message;
             LOG.debug("Actor terminated : {}", terminated.actor());
             Terminated terminated = (Terminated) message;
             LOG.debug("Actor terminated : {}", terminated.actor());
-        } else if(message instanceof Monitor){
+        } else if (message instanceof Monitor) {
             Monitor monitor = (Monitor) message;
             getContext().watch(monitor.getActorRef());
         }
             Monitor monitor = (Monitor) message;
             getContext().watch(monitor.getActorRef());
         }
index 357ab92c819946ccc9e008db0a6b9fd1ad5bcf2f..17017b9b668ea699d1dab0ecfa7deac2448c84b4 100644 (file)
@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
 import scala.concurrent.Future;
 
 /**
 import scala.concurrent.Future;
 
 /**
- * ThreePhaseCommitCohortProxy represents a set of remote cohort proxies
+ * ThreePhaseCommitCohortProxy represents a set of remote cohort proxies.
  */
 public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<ActorSelection> {
 
  */
 public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<ActorSelection> {
 
@@ -76,31 +76,31 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
         this.cohorts = cohorts;
         this.transactionId = Preconditions.checkNotNull(transactionId);
 
         this.cohorts = cohorts;
         this.transactionId = Preconditions.checkNotNull(transactionId);
 
-        if(cohorts.isEmpty()) {
+        if (cohorts.isEmpty()) {
             cohortsResolvedFuture.set(null);
         }
     }
 
     private ListenableFuture<Void> resolveCohorts() {
             cohortsResolvedFuture.set(null);
         }
     }
 
     private ListenableFuture<Void> resolveCohorts() {
-        if(cohortsResolvedFuture.isDone()) {
+        if (cohortsResolvedFuture.isDone()) {
             return cohortsResolvedFuture;
         }
 
         final AtomicInteger completed = new AtomicInteger(cohorts.size());
             return cohortsResolvedFuture;
         }
 
         final AtomicInteger completed = new AtomicInteger(cohorts.size());
-        for(final CohortInfo info: cohorts) {
+        for (final CohortInfo info: cohorts) {
             info.getActorFuture().onComplete(new OnComplete<ActorSelection>() {
                 @Override
                 public void onComplete(Throwable failure, ActorSelection actor)  {
             info.getActorFuture().onComplete(new OnComplete<ActorSelection>() {
                 @Override
                 public void onComplete(Throwable failure, ActorSelection actor)  {
-                    synchronized(completed) {
+                    synchronized (completed) {
                         boolean done = completed.decrementAndGet() == 0;
                         boolean done = completed.decrementAndGet() == 0;
-                        if(failure != null) {
+                        if (failure != null) {
                             LOG.debug("Tx {}: a cohort Future failed", transactionId, failure);
                             cohortsResolvedFuture.setException(failure);
                             LOG.debug("Tx {}: a cohort Future failed", transactionId, failure);
                             cohortsResolvedFuture.setException(failure);
-                        } else if(!cohortsResolvedFuture.isDone()) {
+                        } else if (!cohortsResolvedFuture.isDone()) {
                             LOG.debug("Tx {}: cohort actor {} resolved", transactionId, actor);
 
                             info.setResolvedActor(actor);
                             LOG.debug("Tx {}: cohort actor {} resolved", transactionId, actor);
 
                             info.setResolvedActor(actor);
-                            if(done) {
+                            if (done) {
                                 LOG.debug("Tx {}: successfully resolved all cohort actors", transactionId);
                                 cohortsResolvedFuture.set(null);
                             }
                                 LOG.debug("Tx {}: successfully resolved all cohort actors", transactionId);
                                 cohortsResolvedFuture.set(null);
                             }
@@ -144,7 +144,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
         LOG.debug("Tx {} finishCanCommit", transactionId);
 
         // For empty transactions return immediately
         LOG.debug("Tx {} finishCanCommit", transactionId);
 
         // For empty transactions return immediately
-        if(cohorts.size() == 0){
+        if (cohorts.size() == 0) {
             LOG.debug("Tx {}: canCommit returning result true", transactionId);
             returnFuture.set(Boolean.TRUE);
             return;
             LOG.debug("Tx {}: canCommit returning result true", transactionId);
             returnFuture.set(Boolean.TRUE);
             return;
@@ -186,7 +186,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
                     return;
                 }
 
                     return;
                 }
 
-                if(iterator.hasNext() && result) {
+                if (iterator.hasNext() && result) {
                     sendCanCommitTransaction(iterator.next(), this);
                 } else {
                     LOG.debug("Tx {}: canCommit returning result: {}", transactionId, result);
                     sendCanCommitTransaction(iterator.next(), this);
                 } else {
                     LOG.debug("Tx {}: canCommit returning result: {}", transactionId, result);
@@ -202,9 +202,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
     private void sendCanCommitTransaction(CohortInfo toCohortInfo, OnComplete<Object> onComplete) {
         CanCommitTransaction message = new CanCommitTransaction(transactionId, toCohortInfo.getActorVersion());
 
     private void sendCanCommitTransaction(CohortInfo toCohortInfo, OnComplete<Object> onComplete) {
         CanCommitTransaction message = new CanCommitTransaction(transactionId, toCohortInfo.getActorVersion());
 
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Tx {}: sending {} to {}", transactionId, message, toCohortInfo.getResolvedActor());
-        }
+        LOG.debug("Tx {}: sending {} to {}", transactionId, message, toCohortInfo.getResolvedActor());
 
         Future<Object> future = actorContext.executeOperationAsync(toCohortInfo.getResolvedActor(),
                 message.toSerializable(), actorContext.getTransactionCommitOperationTimeout());
 
         Future<Object> future = actorContext.executeOperationAsync(toCohortInfo.getResolvedActor(),
                 message.toSerializable(), actorContext.getTransactionCommitOperationTimeout());
@@ -213,12 +211,10 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
 
     private Future<Iterable<Object>> invokeCohorts(MessageSupplier messageSupplier) {
         List<Future<Object>> futureList = Lists.newArrayListWithCapacity(cohorts.size());
 
     private Future<Iterable<Object>> invokeCohorts(MessageSupplier messageSupplier) {
         List<Future<Object>> futureList = Lists.newArrayListWithCapacity(cohorts.size());
-        for(CohortInfo cohort : cohorts) {
+        for (CohortInfo cohort : cohorts) {
             Object message = messageSupplier.newMessage(transactionId, cohort.getActorVersion());
 
             Object message = messageSupplier.newMessage(transactionId, cohort.getActorVersion());
 
-            if(LOG.isDebugEnabled()) {
-                LOG.debug("Tx {}: Sending {} to cohort {}", transactionId, message , cohort);
-            }
+            LOG.debug("Tx {}: Sending {} to cohort {}", transactionId, message , cohort);
 
             futureList.add(actorContext.executeOperationAsync(cohort.getResolvedActor(), message,
                     actorContext.getTransactionCommitOperationTimeout()));
 
             futureList.add(actorContext.executeOperationAsync(cohort.getResolvedActor(), message,
                     actorContext.getTransactionCommitOperationTimeout()));
@@ -255,15 +251,16 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
                 CommitTransactionReply.class, true, operationCallback);
     }
 
                 CommitTransactionReply.class, true, operationCallback);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static boolean successfulFuture(ListenableFuture<Void> future) {
     private static boolean successfulFuture(ListenableFuture<Void> future) {
-        if(!future.isDone()) {
+        if (!future.isDone()) {
             return false;
         }
 
         try {
             future.get();
             return true;
             return false;
         }
 
         try {
             future.get();
             return true;
-        } catch(Exception e) {
+        } catch (Exception e) {
             return false;
         }
     }
             return false;
         }
     }
@@ -279,7 +276,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
         // if not for some reason, we'll try to build it here.
 
         ListenableFuture<Void> future = resolveCohorts();
         // if not for some reason, we'll try to build it here.
 
         ListenableFuture<Void> future = resolveCohorts();
-        if(successfulFuture(future)) {
+        if (successfulFuture(future)) {
             finishVoidOperation(operationName, messageSupplier, expectedResponseClass, propagateException,
                     returnFuture, callback);
         } else {
             finishVoidOperation(operationName, messageSupplier, expectedResponseClass, propagateException,
                     returnFuture, callback);
         } else {
@@ -294,7 +291,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
                 public void onFailure(Throwable failure) {
                     LOG.debug("Tx {}: a {} cohort path Future failed: {}", transactionId, operationName, failure);
 
                 public void onFailure(Throwable failure) {
                     LOG.debug("Tx {}: a {} cohort path Future failed: {}", transactionId, operationName, failure);
 
-                    if(propagateException) {
+                    if (propagateException) {
                         returnFuture.setException(failure);
                     } else {
                         returnFuture.set(null);
                         returnFuture.setException(failure);
                     } else {
                         returnFuture.set(null);
@@ -319,9 +316,9 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
             @Override
             public void onComplete(Throwable failure, Iterable<Object> responses) throws Throwable {
                 Throwable exceptionToPropagate = failure;
             @Override
             public void onComplete(Throwable failure, Iterable<Object> responses) throws Throwable {
                 Throwable exceptionToPropagate = failure;
-                if(exceptionToPropagate == null) {
-                    for(Object response: responses) {
-                        if(!response.getClass().equals(expectedResponseClass)) {
+                if (exceptionToPropagate == null) {
+                    for (Object response: responses) {
+                        if (!response.getClass().equals(expectedResponseClass)) {
                             exceptionToPropagate = new IllegalArgumentException(
                                     String.format("Unexpected response type %s", response.getClass()));
                             break;
                             exceptionToPropagate = new IllegalArgumentException(
                                     String.format("Unexpected response type %s", response.getClass()));
                             break;
@@ -329,9 +326,9 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
                     }
                 }
 
                     }
                 }
 
-                if(exceptionToPropagate != null) {
+                if (exceptionToPropagate != null) {
                     LOG.debug("Tx {}: a {} cohort Future failed", transactionId, operationName, exceptionToPropagate);
                     LOG.debug("Tx {}: a {} cohort Future failed", transactionId, operationName, exceptionToPropagate);
-                    if(propagateException) {
+                    if (propagateException) {
                         // We don't log the exception here to avoid redundant logging since we're
                         // propagating to the caller in MD-SAL core who will log it.
                         returnFuture.setException(exceptionToPropagate);
                         // We don't log the exception here to avoid redundant logging since we're
                         // propagating to the caller in MD-SAL core who will log it.
                         returnFuture.setException(exceptionToPropagate);
@@ -357,7 +354,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
     @Override
     List<Future<ActorSelection>> getCohortFutures() {
         List<Future<ActorSelection>> cohortFutures = new ArrayList<>(cohorts.size());
     @Override
     List<Future<ActorSelection>> getCohortFutures() {
         List<Future<ActorSelection>> cohortFutures = new ArrayList<>(cohorts.size());
-        for(CohortInfo info: cohorts) {
+        for (CohortInfo info: cohorts) {
             cohortFutures.add(info.getActorFuture());
         }
 
             cohortFutures.add(info.getActorFuture());
         }
 
@@ -395,6 +392,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
 
     private interface MessageSupplier {
         Object newMessage(TransactionIdentifier transactionId, short version);
 
     private interface MessageSupplier {
         Object newMessage(TransactionIdentifier transactionId, short version);
+
         boolean isSerializedReplyType(Object reply);
     }
 }
         boolean isSerializedReplyType(Object reply);
     }
 }
index 6cfc7e1f05ff78208de740994c7b370487d2d752..91658a23b70bc48c361d99a974cba0ccd1b22a2b 100644 (file)
@@ -18,7 +18,6 @@ import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import java.util.function.Function;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
@@ -40,8 +39,9 @@ import scala.concurrent.Promise;
  * at a time. For remote transactions, it also tracks the outstanding readiness requests
  * towards the shard and unblocks operations only after all have completed.
  */
  * at a time. For remote transactions, it also tracks the outstanding readiness requests
  * towards the shard and unblocks operations only after all have completed.
  */
-final class TransactionChainProxy extends AbstractTransactionContextFactory<LocalTransactionChain> implements DOMStoreTransactionChain {
-    private static abstract class State {
+final class TransactionChainProxy extends AbstractTransactionContextFactory<LocalTransactionChain>
+        implements DOMStoreTransactionChain {
+    private abstract static class State {
         /**
          * Check if it is okay to allocate a new transaction.
          * @throws IllegalStateException if a transaction may not be allocated.
         /**
          * Check if it is okay to allocate a new transaction.
          * @throws IllegalStateException if a transaction may not be allocated.
@@ -56,7 +56,7 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
         abstract Future<?> previousFuture();
     }
 
         abstract Future<?> previousFuture();
     }
 
-    private static abstract class Pending extends State {
+    private abstract static class Pending extends State {
         private final TransactionIdentifier transaction;
         private final Future<?> previousFuture;
 
         private final TransactionIdentifier transaction;
         private final Future<?> previousFuture;
 
@@ -97,7 +97,7 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
         }
     }
 
         }
     }
 
-    private static abstract class DefaultState extends State {
+    private abstract static class DefaultState extends State {
         @Override
         final Future<?> previousFuture() {
             return null;
         @Override
         final Future<?> previousFuture() {
             return null;
@@ -129,22 +129,23 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
      * This map holds Promise instances for each read-only tx. It is used to maintain ordering of tx creates
      * wrt to read-only tx's between this class and a LocalTransactionChain since they're bridged by
      * asynchronous futures. Otherwise, in the following scenario, eg:
      * This map holds Promise instances for each read-only tx. It is used to maintain ordering of tx creates
      * wrt to read-only tx's between this class and a LocalTransactionChain since they're bridged by
      * asynchronous futures. Otherwise, in the following scenario, eg:
-     *
+     * <p/>
      *   1) Create write tx1 on chain
      *   2) do write and submit
      *   3) Create read-only tx2 on chain and issue read
      *   4) Create write tx3 on chain, do write but do not submit
      *   1) Create write tx1 on chain
      *   2) do write and submit
      *   3) Create read-only tx2 on chain and issue read
      *   4) Create write tx3 on chain, do write but do not submit
-     *
+     * <p/>
      * if the sequence/timing is right, tx3 may create its local tx on the LocalTransactionChain before tx2,
      * which results in tx2 failing b/c tx3 isn't ready yet. So maintaining ordering prevents this issue
      * (see Bug 4774).
      * if the sequence/timing is right, tx3 may create its local tx on the LocalTransactionChain before tx2,
      * which results in tx2 failing b/c tx3 isn't ready yet. So maintaining ordering prevents this issue
      * (see Bug 4774).
-     * <p>
+     * <p/>
      * A Promise is added via newReadOnlyTransaction. When the parent class completes the primary shard
      * lookup and creates the TransactionContext (either success or failure), onTransactionContextCreated is
      * called which completes the Promise. A write tx that is created prior to completion will wait on the
      * Promise's Future via findPrimaryShard.
      */
      * A Promise is added via newReadOnlyTransaction. When the parent class completes the primary shard
      * lookup and creates the TransactionContext (either success or failure), onTransactionContextCreated is
      * called which completes the Promise. A write tx that is created prior to completion will wait on the
      * Promise's Future via findPrimaryShard.
      */
-    private final ConcurrentMap<TransactionIdentifier, Promise<Object>> priorReadOnlyTxPromises = new ConcurrentHashMap<>();
+    private final ConcurrentMap<TransactionIdentifier, Promise<Object>> priorReadOnlyTxPromises =
+            new ConcurrentHashMap<>();
 
     TransactionChainProxy(final TransactionContextFactory parent, final LocalHistoryIdentifier historyId) {
         super(parent.getActorContext(), historyId);
 
     TransactionChainProxy(final TransactionContextFactory parent, final LocalHistoryIdentifier historyId) {
         super(parent.getActorContext(), historyId);
@@ -177,12 +178,8 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
 
         // Send a close transaction chain request to each and every shard
 
 
         // Send a close transaction chain request to each and every shard
 
-        getActorContext().broadcast(new Function<Short, Object>() {
-            @Override
-            public Object apply(Short version) {
-                return new CloseTransactionChain(getHistoryId(), version).toSerializable();
-            }
-        }, CloseTransactionChain.class);
+        getActorContext().broadcast(version -> new CloseTransactionChain(getHistoryId(), version).toSerializable(),
+                CloseTransactionChain.class);
     }
 
     private TransactionProxy allocateWriteTransaction(final TransactionType type) {
     }
 
     private TransactionProxy allocateWriteTransaction(final TransactionType type) {
@@ -195,7 +192,8 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
     }
 
     @Override
     }
 
     @Override
-    protected LocalTransactionChain factoryForShard(final String shardName, final ActorSelection shardLeader, final DataTree dataTree) {
+    protected LocalTransactionChain factoryForShard(final String shardName, final ActorSelection shardLeader,
+            final DataTree dataTree) {
         final LocalTransactionChain ret = new LocalTransactionChain(this, shardLeader, dataTree);
         LOG.debug("Allocated transaction chain {} for shard {} leader {}", ret, shardName, shardLeader);
         return ret;
         final LocalTransactionChain ret = new LocalTransactionChain(this, shardLeader, dataTree);
         LOG.debug("Allocated transaction chain {} for shard {} leader {}", ret, shardName, shardLeader);
         return ret;
@@ -220,7 +218,7 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
 
         final String previousTransactionId;
 
 
         final String previousTransactionId;
 
-        if(localState instanceof Pending){
+        if (localState instanceof Pending) {
             previousTransactionId = ((Pending) localState).getIdentifier().toString();
             LOG.debug("Tx: {} - waiting for ready futures with pending Tx {}", txId, previousTransactionId);
         } else {
             previousTransactionId = ((Pending) localState).getIdentifier().toString();
             LOG.debug("Tx: {} - waiting for ready futures with pending Tx {}", txId, previousTransactionId);
         } else {
@@ -257,15 +255,15 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
 
     private <T> Future<T> combineFutureWithPossiblePriorReadOnlyTxFutures(final Future<T> future,
             final TransactionIdentifier txId) {
 
     private <T> Future<T> combineFutureWithPossiblePriorReadOnlyTxFutures(final Future<T> future,
             final TransactionIdentifier txId) {
-        if(!priorReadOnlyTxPromises.containsKey(txId) && !priorReadOnlyTxPromises.isEmpty()) {
+        if (!priorReadOnlyTxPromises.containsKey(txId) && !priorReadOnlyTxPromises.isEmpty()) {
             Collection<Entry<TransactionIdentifier, Promise<Object>>> priorReadOnlyTxPromiseEntries =
                     new ArrayList<>(priorReadOnlyTxPromises.entrySet());
             Collection<Entry<TransactionIdentifier, Promise<Object>>> priorReadOnlyTxPromiseEntries =
                     new ArrayList<>(priorReadOnlyTxPromises.entrySet());
-            if(priorReadOnlyTxPromiseEntries.isEmpty()) {
+            if (priorReadOnlyTxPromiseEntries.isEmpty()) {
                 return future;
             }
 
             List<Future<Object>> priorReadOnlyTxFutures = new ArrayList<>(priorReadOnlyTxPromiseEntries.size());
                 return future;
             }
 
             List<Future<Object>> priorReadOnlyTxFutures = new ArrayList<>(priorReadOnlyTxPromiseEntries.size());
-            for(Entry<TransactionIdentifier, Promise<Object>> entry: priorReadOnlyTxPromiseEntries) {
+            for (Entry<TransactionIdentifier, Promise<Object>> entry: priorReadOnlyTxPromiseEntries) {
                 LOG.debug("Tx: {} - waiting on future for prior read-only Tx {}", txId, entry.getKey());
                 priorReadOnlyTxFutures.add(entry.getValue().future());
             }
                 LOG.debug("Tx: {} - waiting on future for prior read-only Tx {}", txId, entry.getKey());
                 priorReadOnlyTxFutures.add(entry.getValue().future());
             }
@@ -292,11 +290,14 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
     }
 
     @Override
     }
 
     @Override
-    protected <T> void onTransactionReady(final TransactionIdentifier transaction, final Collection<Future<T>> cohortFutures) {
+    protected <T> void onTransactionReady(final TransactionIdentifier transaction,
+            final Collection<Future<T>> cohortFutures) {
         final State localState = currentState;
         final State localState = currentState;
-        Preconditions.checkState(localState instanceof Allocated, "Readying transaction %s while state is %s", transaction, localState);
+        Preconditions.checkState(localState instanceof Allocated, "Readying transaction %s while state is %s",
+                transaction, localState);
         final TransactionIdentifier currentTx = ((Allocated)localState).getIdentifier();
         final TransactionIdentifier currentTx = ((Allocated)localState).getIdentifier();
-        Preconditions.checkState(transaction.equals(currentTx), "Readying transaction %s while %s is allocated", transaction, currentTx);
+        Preconditions.checkState(transaction.equals(currentTx), "Readying transaction %s while %s is allocated",
+                transaction, currentTx);
 
         // Transaction ready and we are not waiting for futures -- go to idle
         if (cohortFutures.isEmpty()) {
 
         // Transaction ready and we are not waiting for futures -- go to idle
         if (cohortFutures.isEmpty()) {
@@ -324,7 +325,7 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
     @Override
     protected void onTransactionContextCreated(@Nonnull TransactionIdentifier transactionId) {
         Promise<Object> promise = priorReadOnlyTxPromises.remove(transactionId);
     @Override
     protected void onTransactionContextCreated(@Nonnull TransactionIdentifier transactionId) {
         Promise<Object> promise = priorReadOnlyTxPromises.remove(transactionId);
-        if(promise != null) {
+        if (promise != null) {
             promise.success(null);
         }
     }
             promise.success(null);
         }
     }
index 765d5bb7eccb1e01ad320fa9b37a48673d9c1e24..1e23120f0bf6b833ff395b2a5863c6795ff65da7 100644 (file)
@@ -32,15 +32,16 @@ interface TransactionContext {
      * Invoked by {@link TransactionContextWrapper} when it has finished handing
      * off operations to this context. From this point on, the context is responsible
      * for throttling operations.
      * Invoked by {@link TransactionContextWrapper} when it has finished handing
      * off operations to this context. From this point on, the context is responsible
      * for throttling operations.
-     *
+     * <p/>
      * Implementations can rely on the wrapper calling this operation in a synchronized
      * block, so they do not need to ensure visibility of this state transition themselves.
      */
     void operationHandOffComplete();
 
     /**
      * Implementations can rely on the wrapper calling this operation in a synchronized
      * block, so they do not need to ensure visibility of this state transition themselves.
      */
     void operationHandOffComplete();
 
     /**
-     * A TransactionContext that uses Operation limiting should return true else false
-     * @return
+     * A TransactionContext that uses operation limiting should return true else false.
+     *
+     * @return true if operation limiting is used, false otherwise
      */
     boolean usesOperationLimiting();
 
      */
     boolean usesOperationLimiting();
 
index 8c4f6b3456c63a8db9697cf1c9a277dbae9eb01b..d7f493565b7fd8eaa923ca614ed02c47ab142fd7 100644 (file)
@@ -35,7 +35,8 @@ final class TransactionContextFactory extends AbstractTransactionContextFactory<
     }
 
     @Override
     }
 
     @Override
-    protected LocalTransactionFactoryImpl factoryForShard(final String shardName, final ActorSelection shardLeader, final DataTree dataTree) {
+    protected LocalTransactionFactoryImpl factoryForShard(final String shardName, final ActorSelection shardLeader,
+            final DataTree dataTree) {
         return new LocalTransactionFactoryImpl(getActorContext(), shardLeader, dataTree);
     }
 
         return new LocalTransactionFactoryImpl(getActorContext(), shardLeader, dataTree);
     }
 
@@ -45,7 +46,8 @@ final class TransactionContextFactory extends AbstractTransactionContextFactory<
     }
 
     @Override
     }
 
     @Override
-    protected <T> void onTransactionReady(final TransactionIdentifier transaction, final Collection<Future<T>> cohortFutures) {
+    protected <T> void onTransactionReady(final TransactionIdentifier transaction,
+            final Collection<Future<T>> cohortFutures) {
         // Transactions are disconnected, this is a no-op
     }
 
         // Transactions are disconnected, this is a no-op
     }
 
index ef9ee68bf016df46e5dfcd1711d42adcc20f4664..6dae7cec31b9b533d95500b528c52ae0da8a71c5 100644 (file)
@@ -51,7 +51,8 @@ class TransactionContextWrapper {
     TransactionContextWrapper(final TransactionIdentifier identifier, final ActorContext actorContext) {
         this.identifier = Preconditions.checkNotNull(identifier);
         this.limiter = new OperationLimiter(identifier,
     TransactionContextWrapper(final TransactionIdentifier identifier, final ActorContext actorContext) {
         this.identifier = Preconditions.checkNotNull(identifier);
         this.limiter = new OperationLimiter(identifier,
-                actorContext.getDatastoreContext().getShardBatchedModificationCount() + 1, // 1 extra permit for the ready operation
+                // 1 extra permit for the ready operation
+                actorContext.getDatastoreContext().getShardBatchedModificationCount() + 1,
                 TimeUnit.MILLISECONDS.toSeconds(actorContext.getDatastoreContext().getOperationTimeoutInMillis()));
     }
 
                 TimeUnit.MILLISECONDS.toSeconds(actorContext.getDatastoreContext().getOperationTimeoutInMillis()));
     }
 
@@ -98,7 +99,7 @@ class TransactionContextWrapper {
     }
 
     void executePriorTransactionOperations(final TransactionContext localTransactionContext) {
     }
 
     void executePriorTransactionOperations(final TransactionContext localTransactionContext) {
-        while(true) {
+        while (true) {
             // Access to queuedTxOperations and transactionContext must be protected and atomic
             // (ie synchronized) with respect to #addTxOperationOnComplete to handle timing
             // issues and ensure no TransactionOperation is missed and that they are processed
             // Access to queuedTxOperations and transactionContext must be protected and atomic
             // (ie synchronized) with respect to #addTxOperationOnComplete to handle timing
             // issues and ensure no TransactionOperation is missed and that they are processed
@@ -114,7 +115,7 @@ class TransactionContextWrapper {
                     // We're done invoking the TransactionOperations so we can now publish the
                     // TransactionContext.
                     localTransactionContext.operationHandOffComplete();
                     // We're done invoking the TransactionOperations so we can now publish the
                     // TransactionContext.
                     localTransactionContext.operationHandOffComplete();
-                    if(!localTransactionContext.usesOperationLimiting()){
+                    if (!localTransactionContext.usesOperationLimiting()){
                         limiter.releaseAll();
                     }
                     transactionContext = localTransactionContext;
                         limiter.releaseAll();
                     }
                     transactionContext = localTransactionContext;
@@ -143,8 +144,8 @@ class TransactionContextWrapper {
         final Promise<ActorSelection> promise = Futures.promise();
         enqueueTransactionOperation(new TransactionOperation() {
             @Override
         final Promise<ActorSelection> promise = Futures.promise();
         enqueueTransactionOperation(new TransactionOperation() {
             @Override
-            public void invoke(TransactionContext transactionContext) {
-                promise.completeWith(transactionContext.readyTransaction());
+            public void invoke(TransactionContext newTransactionContext) {
+                promise.completeWith(newTransactionContext.readyTransaction());
             }
         });
 
             }
         });
 
index dc965edec76ecf7127d95088c73c7fc695fb6747..3defd2cc50a98a1299ed79de1d2af9f8a7ccb5c7 100644 (file)
@@ -15,7 +15,7 @@ abstract class TransactionOperation {
     /**
      * Execute the delayed operation.
      *
     /**
      * Execute the delayed operation.
      *
-     * @param transactionContext
+     * @param transactionContext the TransactionContext
      */
     protected abstract void invoke(TransactionContext transactionContext);
 }
      */
     protected abstract void invoke(TransactionContext transactionContext);
 }
index 164dc5ef73370f4811db4b2b590cb3774df2af07..405eb0f95bad82b2064240f524269260f93d5a8a 100644 (file)
@@ -50,12 +50,14 @@ import scala.concurrent.Promise;
 /**
  * A transaction potentially spanning multiple backend shards.
  */
 /**
  * A transaction potentially spanning multiple backend shards.
  */
-public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIdentifier> implements DOMStoreReadWriteTransaction {
+public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIdentifier>
+        implements DOMStoreReadWriteTransaction {
     private enum TransactionState {
         OPEN,
         READY,
         CLOSED,
     }
     private enum TransactionState {
         OPEN,
         READY,
         CLOSED,
     }
+
     private static final Logger LOG = LoggerFactory.getLogger(TransactionProxy.class);
 
     private final Map<String, TransactionContextWrapper> txContextWrappers = new HashMap<>();
     private static final Logger LOG = LoggerFactory.getLogger(TransactionProxy.class);
 
     private final Map<String, TransactionContextWrapper> txContextWrappers = new HashMap<>();
@@ -79,11 +81,10 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     }
 
     private <T> CheckedFuture<T, ReadFailedException> executeRead(String shardName, final AbstractRead<T> readCmd) {
     }
 
     private <T> CheckedFuture<T, ReadFailedException> executeRead(String shardName, final AbstractRead<T> readCmd) {
-        Preconditions.checkState(type != TransactionType.WRITE_ONLY, "Reads from write-only transactions are not allowed");
+        Preconditions.checkState(type != TransactionType.WRITE_ONLY,
+                "Reads from write-only transactions are not allowed");
 
 
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Tx {} {} {}", getIdentifier(), readCmd.getClass().getSimpleName(), readCmd.getPath());
-        }
+        LOG.debug("Tx {} {} {}", getIdentifier(), readCmd.getClass().getSimpleName(), readCmd.getPath());
 
         final SettableFuture<T> proxyFuture = SettableFuture.create();
         TransactionContextWrapper contextWrapper = getContextWrapper(shardName);
 
         final SettableFuture<T> proxyFuture = SettableFuture.create();
         TransactionContextWrapper contextWrapper = getContextWrapper(shardName);
@@ -99,7 +100,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
     @Override
     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final YangInstanceIdentifier path) {
 
     @Override
     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final YangInstanceIdentifier path) {
-        Preconditions.checkState(type != TransactionType.WRITE_ONLY, "Reads from write-only transactions are not allowed");
+        Preconditions.checkState(type != TransactionType.WRITE_ONLY,
+                "Reads from write-only transactions are not allowed");
 
         LOG.debug("Tx {} read {}", getIdentifier(), path);
 
 
         LOG.debug("Tx {} read {}", getIdentifier(), path);
 
@@ -117,7 +119,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
     private CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> readAllData() {
         final Set<String> allShardNames = txContextFactory.getActorContext().getConfiguration().getAllShardNames();
 
     private CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> readAllData() {
         final Set<String> allShardNames = txContextFactory.getActorContext().getConfiguration().getAllShardNames();
-        final Collection<CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException>> futures = new ArrayList<>(allShardNames.size());
+        final Collection<CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException>> futures =
+                new ArrayList<>(allShardNames.size());
 
         for (String shardName : allShardNames) {
             futures.add(singleShardRead(shardName, YangInstanceIdentifier.EMPTY));
 
         for (String shardName : allShardNames) {
             futures.add(singleShardRead(shardName, YangInstanceIdentifier.EMPTY));
@@ -126,9 +129,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         final ListenableFuture<List<Optional<NormalizedNode<?, ?>>>> listFuture = Futures.allAsList(futures);
         final ListenableFuture<Optional<NormalizedNode<?, ?>>> aggregateFuture;
 
         final ListenableFuture<List<Optional<NormalizedNode<?, ?>>>> listFuture = Futures.allAsList(futures);
         final ListenableFuture<Optional<NormalizedNode<?, ?>>> aggregateFuture;
 
-        aggregateFuture = Futures.transform(listFuture, new Function<List<Optional<NormalizedNode<?, ?>>>, Optional<NormalizedNode<?, ?>>>() {
-            @Override
-            public Optional<NormalizedNode<?, ?>> apply(final List<Optional<NormalizedNode<?, ?>>> input) {
+        aggregateFuture = Futures.transform(listFuture,
+            (Function<List<Optional<NormalizedNode<?, ?>>>, Optional<NormalizedNode<?, ?>>>) input -> {
                 try {
                     return NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.EMPTY, input,
                             txContextFactory.getActorContext().getSchemaContext(),
                 try {
                     return NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.EMPTY, input,
                             txContextFactory.getActorContext().getSchemaContext(),
@@ -136,8 +138,7 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
                 } catch (DataValidationFailedException e) {
                     throw new IllegalArgumentException("Failed to aggregate", e);
                 }
                 } catch (DataValidationFailedException e) {
                     throw new IllegalArgumentException("Failed to aggregate", e);
                 }
-            }
-        });
+            });
 
         return MappingCheckedFuture.create(aggregateFuture, ReadFailedException.MAPPER);
     }
 
         return MappingCheckedFuture.create(aggregateFuture, ReadFailedException.MAPPER);
     }
@@ -160,10 +161,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     private void executeModification(final AbstractModification modification) {
         checkModificationState();
 
     private void executeModification(final AbstractModification modification) {
         checkModificationState();
 
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Tx {} executeModification {} {}", getIdentifier(), modification.getClass().getSimpleName(),
-                    modification.getPath());
-        }
+        LOG.debug("Tx {} executeModification {} {}", getIdentifier(), modification.getClass().getSimpleName(),
+                modification.getPath());
 
         TransactionContextWrapper contextWrapper = getContextWrapper(modification.getPath());
         contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
 
         TransactionContextWrapper contextWrapper = getContextWrapper(modification.getPath());
         contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
@@ -223,15 +222,16 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
         final AbstractThreePhaseCommitCohort<?> ret;
         switch (txContextWrappers.size()) {
 
         final AbstractThreePhaseCommitCohort<?> ret;
         switch (txContextWrappers.size()) {
-        case 0:
-            ret = NoOpDOMStoreThreePhaseCommitCohort.INSTANCE;
-            break;
-        case 1:
-            final Entry<String, TransactionContextWrapper> e = Iterables.getOnlyElement(txContextWrappers.entrySet());
-            ret = createSingleCommitCohort(e.getKey(), e.getValue());
-            break;
-        default:
-            ret = createMultiCommitCohort(txContextWrappers.entrySet());
+            case 0:
+                ret = NoOpDOMStoreThreePhaseCommitCohort.INSTANCE;
+                break;
+            case 1:
+                final Entry<String, TransactionContextWrapper> e = Iterables.getOnlyElement(
+                        txContextWrappers.entrySet());
+                ret = createSingleCommitCohort(e.getKey(), e.getValue());
+                break;
+            default:
+                ret = createMultiCommitCohort(txContextWrappers.entrySet());
         }
 
         txContextFactory.onTransactionReady(getIdentifier(), ret.getCohortFutures());
         }
 
         txContextFactory.onTransactionReady(getIdentifier(), ret.getCohortFutures());
@@ -255,8 +255,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
             final Promise promise = akka.dispatch.Futures.promise();
             contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
                 @Override
             final Promise promise = akka.dispatch.Futures.promise();
             contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
                 @Override
-                public void invoke(TransactionContext transactionContext) {
-                    promise.completeWith(getDirectCommitFuture(transactionContext, operationCallbackRef));
+                public void invoke(TransactionContext newTransactionContext) {
+                    promise.completeWith(getDirectCommitFuture(newTransactionContext, operationCallbackRef));
                 }
             });
             future = promise.future();
                 }
             });
             future = promise.future();
@@ -290,12 +290,7 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
             // The remote tx version is obtained the via TransactionContext which may not be available yet so
             // we pass a Supplier to dynamically obtain it. Once the ready Future is resolved the
             // TransactionContext is available.
             // The remote tx version is obtained the via TransactionContext which may not be available yet so
             // we pass a Supplier to dynamically obtain it. Once the ready Future is resolved the
             // TransactionContext is available.
-            Supplier<Short> txVersionSupplier = new Supplier<Short>() {
-                @Override
-                public Short get() {
-                    return wrapper.getTransactionContext().getTransactionVersion();
-                }
-            };
+            Supplier<Short> txVersionSupplier = () -> wrapper.getTransactionContext().getTransactionVersion();
 
             cohorts.add(new ThreePhaseCommitCohortProxy.CohortInfo(wrapper.readyTransaction(), txVersionSupplier));
         }
 
             cohorts.add(new ThreePhaseCommitCohortProxy.CohortInfo(wrapper.readyTransaction(), txVersionSupplier));
         }
index 3da5bed5a706f57bc7f185dcf36ffd3339072599..f35e30a06ccb1c8a95b4ff843ac22abedc21d168 100644 (file)
@@ -17,9 +17,9 @@ import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 
 /**
  * TransactionRateLimitingCallback computes the new transaction rate limit on the successful completion of a
 
 /**
  * TransactionRateLimitingCallback computes the new transaction rate limit on the successful completion of a
- * transaction
+ * transaction.
  */
  */
-public class TransactionRateLimitingCallback implements OperationCallback{
+public class TransactionRateLimitingCallback implements OperationCallback {
     private static Ticker TICKER = Ticker.systemTicker();
 
     private enum State {
     private static Ticker TICKER = Ticker.systemTicker();
 
     private enum State {
@@ -33,7 +33,7 @@ public class TransactionRateLimitingCallback implements OperationCallback{
     private long elapsedTime;
     private volatile State state = State.STOPPED;
 
     private long elapsedTime;
     private volatile State state = State.STOPPED;
 
-    TransactionRateLimitingCallback(ActorContext actorContext){
+    TransactionRateLimitingCallback(ActorContext actorContext) {
         commitTimer = actorContext.getOperationTimer(ActorContext.COMMIT);
     }
 
         commitTimer = actorContext.getOperationTimer(ActorContext.COMMIT);
     }
 
@@ -45,7 +45,7 @@ public class TransactionRateLimitingCallback implements OperationCallback{
 
     @Override
     public void pause() {
 
     @Override
     public void pause() {
-        if(state == State.RUNNING) {
+        if (state == State.RUNNING) {
             elapsedTime += TICKER.read() - startTime;
             state = State.PAUSED;
         }
             elapsedTime += TICKER.read() - startTime;
             state = State.PAUSED;
         }
@@ -53,7 +53,7 @@ public class TransactionRateLimitingCallback implements OperationCallback{
 
     @Override
     public void resume() {
 
     @Override
     public void resume() {
-        if(state != State.RUNNING) {
+        if (state != State.RUNNING) {
             startTime = TICKER.read();
             state = State.RUNNING;
         }
             startTime = TICKER.read();
             state = State.RUNNING;
         }
@@ -78,4 +78,4 @@ public class TransactionRateLimitingCallback implements OperationCallback{
     static void setTicker(Ticker ticker) {
         TICKER = ticker;
     }
     static void setTicker(Ticker ticker) {
         TICKER = ticker;
     }
-}
\ No newline at end of file
+}
index 43c3be11c278de94cddfdccb66bcc26414bf1f5f..986cca5f3d400dfeb4ce40c81355242b161cced5 100644 (file)
@@ -20,10 +20,9 @@ import scala.concurrent.Future;
 /**
  * A {@link Mapper} extracting the {@link ActorSelection} pointing to the actor which
  * is backing a particular transaction.
 /**
  * A {@link Mapper} extracting the {@link ActorSelection} pointing to the actor which
  * is backing a particular transaction.
- *
+ * <p/>
  * This class is not for general consumption. It is public only to support the pre-lithium compatibility
  * package.
  * This class is not for general consumption. It is public only to support the pre-lithium compatibility
  * package.
- *
  * TODO: once we remove compatibility, make this class package-private and final.
  */
 public class TransactionReadyReplyMapper extends Mapper<Object, ActorSelection> {
  * TODO: once we remove compatibility, make this class package-private and final.
  */
 public class TransactionReadyReplyMapper extends Mapper<Object, ActorSelection> {
index fa823a7285cab11db22b9f8685d30ccd2fbd91f4..970f9f6ac62a55d3d5154332c889c1ccf0967f4f 100644 (file)
@@ -63,12 +63,12 @@ public interface Configuration {
     boolean isShardConfigured(String shardName);
 
     /**
     boolean isShardConfigured(String shardName);
 
     /**
-     * Adds the given member as the new replica for the given shardName
+     * Adds the given member as the new replica for the given shardName.
      */
      */
-    void addMemberReplicaForShard (String shardName, MemberName memberName);
+    void addMemberReplicaForShard(String shardName, MemberName memberName);
 
     /**
 
     /**
-     * Removes the given member as a replica for the given shardName
+     * Removes the given member as a replica for the given shardName.
      */
      */
-    void removeMemberReplicaForShard (String shardName, MemberName memberName);
+    void removeMemberReplicaForShard(String shardName, MemberName memberName);
 }
 }
index 1af8ed63e03936c7b4962c4b190cb432e633379a..06ae6ec767a3fb977317ebc3ba054eb37c9c0a51 100644 (file)
@@ -37,7 +37,7 @@ public class ConfigurationImpl implements Configuration {
 
     public ConfigurationImpl(final ModuleShardConfigProvider provider) {
         ImmutableMap.Builder<String, ModuleConfig> mapBuilder = ImmutableMap.builder();
 
     public ConfigurationImpl(final ModuleShardConfigProvider provider) {
         ImmutableMap.Builder<String, ModuleConfig> mapBuilder = ImmutableMap.builder();
-        for(Map.Entry<String, ModuleConfig.Builder> e: provider.retrieveModuleConfigs(this).entrySet()) {
+        for (Map.Entry<String, ModuleConfig.Builder> e: provider.retrieveModuleConfigs(this).entrySet()) {
             mapBuilder.put(e.getKey(), e.getValue().build());
         }
 
             mapBuilder.put(e.getKey(), e.getValue().build());
         }
 
@@ -49,7 +49,7 @@ public class ConfigurationImpl implements Configuration {
 
     private static Set<String> createAllShardNames(Iterable<ModuleConfig> moduleConfigs) {
         final ImmutableSet.Builder<String> builder = ImmutableSet.builder();
 
     private static Set<String> createAllShardNames(Iterable<ModuleConfig> moduleConfigs) {
         final ImmutableSet.Builder<String> builder = ImmutableSet.builder();
-        for(ModuleConfig moduleConfig : moduleConfigs) {
+        for (ModuleConfig moduleConfig : moduleConfigs) {
             builder.addAll(moduleConfig.getShardNames());
         }
 
             builder.addAll(moduleConfig.getShardNames());
         }
 
@@ -58,8 +58,8 @@ public class ConfigurationImpl implements Configuration {
 
     private static Map<String, String> createNamespaceToModuleName(Iterable<ModuleConfig> moduleConfigs) {
         final ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
 
     private static Map<String, String> createNamespaceToModuleName(Iterable<ModuleConfig> moduleConfigs) {
         final ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
-        for(ModuleConfig moduleConfig : moduleConfigs) {
-            if(moduleConfig.getNameSpace() != null) {
+        for (ModuleConfig moduleConfig : moduleConfigs) {
+            if (moduleConfig.getNameSpace() != null) {
                 builder.put(moduleConfig.getNameSpace(), moduleConfig.getName());
             }
         }
                 builder.put(moduleConfig.getNameSpace(), moduleConfig.getName());
             }
         }
@@ -68,13 +68,13 @@ public class ConfigurationImpl implements Configuration {
     }
 
     @Override
     }
 
     @Override
-    public Collection<String> getMemberShardNames(final MemberName memberName){
+    public Collection<String> getMemberShardNames(final MemberName memberName) {
         Preconditions.checkNotNull(memberName, "memberName should not be null");
 
         List<String> shards = new ArrayList<>();
         for (ModuleConfig moduleConfig: moduleConfigMap.values()) {
             for (ShardConfig shardConfig: moduleConfig.getShardConfigs()) {
         Preconditions.checkNotNull(memberName, "memberName should not be null");
 
         List<String> shards = new ArrayList<>();
         for (ModuleConfig moduleConfig: moduleConfigMap.values()) {
             for (ShardConfig shardConfig: moduleConfig.getShardConfigs()) {
-                if(shardConfig.getReplicas().contains(memberName)) {
+                if (shardConfig.getReplicas().contains(memberName)) {
                     shards.add(shardConfig.getName());
                 }
             }
                     shards.add(shardConfig.getName());
                 }
             }
@@ -95,7 +95,7 @@ public class ConfigurationImpl implements Configuration {
         Preconditions.checkNotNull(moduleName, "moduleName should not be null");
 
         ModuleConfig moduleConfig = moduleConfigMap.get(moduleName);
         Preconditions.checkNotNull(moduleName, "moduleName should not be null");
 
         ModuleConfig moduleConfig = moduleConfigMap.get(moduleName);
-        return moduleConfig != null ? moduleConfig.getShardStrategy(): null;
+        return moduleConfig != null ? moduleConfig.getShardStrategy() : null;
     }
 
     @Override
     }
 
     @Override
@@ -105,16 +105,16 @@ public class ConfigurationImpl implements Configuration {
         ModuleConfig moduleConfig = moduleConfigMap.get(moduleName);
         Collection<ShardConfig> shardConfigs = moduleConfig != null ? moduleConfig.getShardConfigs() :
             Collections.<ShardConfig>emptySet();
         ModuleConfig moduleConfig = moduleConfigMap.get(moduleName);
         Collection<ShardConfig> shardConfigs = moduleConfig != null ? moduleConfig.getShardConfigs() :
             Collections.<ShardConfig>emptySet();
-        return !shardConfigs.isEmpty() ? shardConfigs.iterator().next().getName(): null;
+        return !shardConfigs.isEmpty() ? shardConfigs.iterator().next().getName() : null;
     }
 
     @Override
     public Collection<MemberName> getMembersFromShardName(final String shardName) {
         Preconditions.checkNotNull(shardName, "shardName should not be null");
 
     }
 
     @Override
     public Collection<MemberName> getMembersFromShardName(final String shardName) {
         Preconditions.checkNotNull(shardName, "shardName should not be null");
 
-        for(ModuleConfig moduleConfig: moduleConfigMap.values()) {
+        for (ModuleConfig moduleConfig: moduleConfigMap.values()) {
             ShardConfig shardConfig = moduleConfig.getShardConfig(shardName);
             ShardConfig shardConfig = moduleConfig.getShardConfig(shardName);
-            if(shardConfig != null) {
+            if (shardConfig != null) {
                 return shardConfig.getReplicas();
             }
         }
                 return shardConfig.getReplicas();
             }
         }
@@ -130,7 +130,7 @@ public class ConfigurationImpl implements Configuration {
     @Override
     public Collection<MemberName> getUniqueMemberNamesForAllShards() {
         Set<MemberName> allNames = new HashSet<>();
     @Override
     public Collection<MemberName> getUniqueMemberNamesForAllShards() {
         Set<MemberName> allNames = new HashSet<>();
-        for(String shardName: getAllShardNames()) {
+        for (String shardName: getAllShardNames()) {
             allNames.addAll(getMembersFromShardName(shardName));
         }
 
             allNames.addAll(getMembersFromShardName(shardName));
         }
 
@@ -141,15 +141,15 @@ public class ConfigurationImpl implements Configuration {
     public synchronized void addModuleShardConfiguration(ModuleShardConfiguration config) {
         Preconditions.checkNotNull(config, "ModuleShardConfiguration should not be null");
 
     public synchronized void addModuleShardConfiguration(ModuleShardConfiguration config) {
         Preconditions.checkNotNull(config, "ModuleShardConfiguration should not be null");
 
-        ModuleConfig moduleConfig = ModuleConfig.builder(config.getModuleName()).
-                nameSpace(config.getNamespace().toASCIIString()).
-                shardStrategy(createShardStrategy(config.getModuleName(), config.getShardStrategyName())).
-                shardConfig(config.getShardName(), config.getShardMemberNames()).build();
+        ModuleConfig moduleConfig = ModuleConfig.builder(config.getModuleName())
+                .nameSpace(config.getNamespace().toASCIIString())
+                .shardStrategy(createShardStrategy(config.getModuleName(), config.getShardStrategyName()))
+                .shardConfig(config.getShardName(), config.getShardMemberNames()).build();
 
         updateModuleConfigMap(moduleConfig);
 
 
         updateModuleConfigMap(moduleConfig);
 
-        namespaceToModuleName = ImmutableMap.<String, String>builder().putAll(namespaceToModuleName).
-                put(moduleConfig.getNameSpace(), moduleConfig.getName()).build();
+        namespaceToModuleName = ImmutableMap.<String, String>builder().putAll(namespaceToModuleName)
+                .put(moduleConfig.getNameSpace(), moduleConfig.getName()).build();
         allShardNames = ImmutableSet.<String>builder().addAll(allShardNames).add(config.getShardName()).build();
     }
 
         allShardNames = ImmutableSet.<String>builder().addAll(allShardNames).add(config.getShardName()).build();
     }
 
@@ -164,13 +164,13 @@ public class ConfigurationImpl implements Configuration {
     }
 
     @Override
     }
 
     @Override
-    public void addMemberReplicaForShard (String shardName, MemberName newMemberName) {
+    public void addMemberReplicaForShard(String shardName, MemberName newMemberName) {
         Preconditions.checkNotNull(shardName, "shardName should not be null");
         Preconditions.checkNotNull(newMemberName, "MemberName should not be null");
 
         Preconditions.checkNotNull(shardName, "shardName should not be null");
         Preconditions.checkNotNull(newMemberName, "MemberName should not be null");
 
-        for(ModuleConfig moduleConfig: moduleConfigMap.values()) {
+        for (ModuleConfig moduleConfig: moduleConfigMap.values()) {
             ShardConfig shardConfig = moduleConfig.getShardConfig(shardName);
             ShardConfig shardConfig = moduleConfig.getShardConfig(shardName);
-            if(shardConfig != null) {
+            if (shardConfig != null) {
                 Set<MemberName> replicas = new HashSet<>(shardConfig.getReplicas());
                 replicas.add(newMemberName);
                 updateModuleConfigMap(ModuleConfig.builder(moduleConfig).shardConfig(shardName, replicas).build());
                 Set<MemberName> replicas = new HashSet<>(shardConfig.getReplicas());
                 replicas.add(newMemberName);
                 updateModuleConfigMap(ModuleConfig.builder(moduleConfig).shardConfig(shardName, replicas).build());
@@ -180,13 +180,13 @@ public class ConfigurationImpl implements Configuration {
     }
 
     @Override
     }
 
     @Override
-    public void removeMemberReplicaForShard (String shardName, MemberName newMemberName) {
+    public void removeMemberReplicaForShard(String shardName, MemberName newMemberName) {
         Preconditions.checkNotNull(shardName, "shardName should not be null");
         Preconditions.checkNotNull(newMemberName, "MemberName should not be null");
 
         Preconditions.checkNotNull(shardName, "shardName should not be null");
         Preconditions.checkNotNull(newMemberName, "MemberName should not be null");
 
-        for(ModuleConfig moduleConfig: moduleConfigMap.values()) {
+        for (ModuleConfig moduleConfig: moduleConfigMap.values()) {
             ShardConfig shardConfig = moduleConfig.getShardConfig(shardName);
             ShardConfig shardConfig = moduleConfig.getShardConfig(shardName);
-            if(shardConfig != null) {
+            if (shardConfig != null) {
                 Set<MemberName> replicas = new HashSet<>(shardConfig.getReplicas());
                 replicas.remove(newMemberName);
                 updateModuleConfigMap(ModuleConfig.builder(moduleConfig).shardConfig(shardName, replicas).build());
                 Set<MemberName> replicas = new HashSet<>(shardConfig.getReplicas());
                 replicas.remove(newMemberName);
                 updateModuleConfigMap(ModuleConfig.builder(moduleConfig).shardConfig(shardName, replicas).build());
index c51e1931317874a3ec2a120876db0faff9b3d8e2..2920f45fe93d198b935fd50690a97ffb0cfd342c 100644 (file)
@@ -42,7 +42,7 @@ public class FileModuleShardConfigProvider implements ModuleShardConfigProvider
         File modulesFile = new File("./configuration/initial/" + modulesConfigPath);
 
         Config moduleShardsConfig = null;
         File modulesFile = new File("./configuration/initial/" + modulesConfigPath);
 
         Config moduleShardsConfig = null;
-        if(moduleShardsFile.exists()) {
+        if (moduleShardsFile.exists()) {
             LOG.info("module shards config file exists - reading config from it");
             moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile);
         } else {
             LOG.info("module shards config file exists - reading config from it");
             moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile);
         } else {
@@ -51,7 +51,7 @@ public class FileModuleShardConfigProvider implements ModuleShardConfigProvider
         }
 
         Config modulesConfig = null;
         }
 
         Config modulesConfig = null;
-        if(modulesFile.exists()) {
+        if (modulesFile.exists()) {
             LOG.info("modules config file exists - reading config from it");
             modulesConfig = ConfigFactory.parseFile(modulesFile);
         } else {
             LOG.info("modules config file exists - reading config from it");
             modulesConfig = ConfigFactory.parseFile(modulesFile);
         } else {
@@ -69,19 +69,19 @@ public class FileModuleShardConfigProvider implements ModuleShardConfigProvider
             Configuration configuration) {
         List<? extends ConfigObject> modulesConfigObjectList = modulesConfig.getObjectList("modules");
 
             Configuration configuration) {
         List<? extends ConfigObject> modulesConfigObjectList = modulesConfig.getObjectList("modules");
 
-        for(ConfigObject o : modulesConfigObjectList){
-            ConfigObjectWrapper w = new ConfigObjectWrapper(o);
+        for (ConfigObject o : modulesConfigObjectList) {
+            ConfigObjectWrapper wrapper = new ConfigObjectWrapper(o);
 
 
-            String moduleName = w.stringValue("name");
+            String moduleName = wrapper.stringValue("name");
             ModuleConfig.Builder builder = moduleConfigMap.get(moduleName);
             ModuleConfig.Builder builder = moduleConfigMap.get(moduleName);
-            if(builder == null) {
+            if (builder == null) {
                 builder = ModuleConfig.builder(moduleName);
                 moduleConfigMap.put(moduleName, builder);
             }
 
                 builder = ModuleConfig.builder(moduleName);
                 moduleConfigMap.put(moduleName, builder);
             }
 
-            builder.nameSpace(w.stringValue("namespace"));
+            builder.nameSpace(wrapper.stringValue("namespace"));
             builder.shardStrategy(ShardStrategyFactory.newShardStrategyInstance(moduleName,
             builder.shardStrategy(ShardStrategyFactory.newShardStrategyInstance(moduleName,
-                    w.stringValue("shard-strategy"), configuration));
+                    wrapper.stringValue("shard-strategy"), configuration));
         }
     }
 
         }
     }
 
@@ -90,14 +90,14 @@ public class FileModuleShardConfigProvider implements ModuleShardConfigProvider
             moduleShardsConfig.getObjectList("module-shards");
 
         Map<String, ModuleConfig.Builder> moduleConfigMap = new HashMap<>();
             moduleShardsConfig.getObjectList("module-shards");
 
         Map<String, ModuleConfig.Builder> moduleConfigMap = new HashMap<>();
-        for(ConfigObject moduleShardConfigObject : moduleShardsConfigObjectList){
+        for (ConfigObject moduleShardConfigObject : moduleShardsConfigObjectList) {
             String moduleName = moduleShardConfigObject.get("name").unwrapped().toString();
             ModuleConfig.Builder builder = ModuleConfig.builder(moduleName);
 
             List<? extends ConfigObject> shardsConfigObjectList =
                 moduleShardConfigObject.toConfig().getObjectList("shards");
 
             String moduleName = moduleShardConfigObject.get("name").unwrapped().toString();
             ModuleConfig.Builder builder = ModuleConfig.builder(moduleName);
 
             List<? extends ConfigObject> shardsConfigObjectList =
                 moduleShardConfigObject.toConfig().getObjectList("shards");
 
-            for(ConfigObject shard : shardsConfigObjectList){
+            for (ConfigObject shard : shardsConfigObjectList) {
                 String shardName = shard.get("name").unwrapped().toString();
                 List<MemberName> replicas = shard.toConfig().getStringList("replicas").stream()
                         .map(MemberName::forName).collect(Collectors.toList());
                 String shardName = shard.get("name").unwrapped().toString();
                 List<MemberName> replicas = shard.toConfig().getStringList("replicas").stream()
                         .map(MemberName::forName).collect(Collectors.toList());
@@ -110,15 +110,15 @@ public class FileModuleShardConfigProvider implements ModuleShardConfigProvider
         return moduleConfigMap;
     }
 
         return moduleConfigMap;
     }
 
-    private static class ConfigObjectWrapper{
+    private static class ConfigObjectWrapper {
 
         private final ConfigObject configObject;
 
 
         private final ConfigObject configObject;
 
-        ConfigObjectWrapper(final ConfigObject configObject){
+        ConfigObjectWrapper(final ConfigObject configObject) {
             this.configObject = configObject;
         }
 
             this.configObject = configObject;
         }
 
-        public String stringValue(final String name){
+        public String stringValue(final String name) {
             return configObject.get(name).unwrapped().toString();
         }
     }
             return configObject.get(name).unwrapped().toString();
         }
     }
index 5b1421b5443413c60869f9503b367e2d51dfd447..d5094a56910a473aab52f4ef72a77147df7e64cf 100644 (file)
@@ -52,8 +52,8 @@ public class ModuleConfig {
     }
 
     @Nullable
     }
 
     @Nullable
-    public ShardConfig getShardConfig(String name) {
-        return shardConfigs.get(name);
+    public ShardConfig getShardConfig(String forName) {
+        return shardConfigs.get(forName);
     }
 
     @Nonnull
     }
 
     @Nonnull
@@ -93,23 +93,23 @@ public class ModuleConfig {
             }
         }
 
             }
         }
 
-        public Builder name(String name) {
-            this.name = name;
+        public Builder name(String newName) {
+            this.name = newName;
             return this;
         }
 
             return this;
         }
 
-        public Builder nameSpace(String nameSpace) {
-            this.nameSpace = nameSpace;
+        public Builder nameSpace(String newNameSpace) {
+            this.nameSpace = newNameSpace;
             return this;
         }
 
             return this;
         }
 
-        public Builder shardStrategy(ShardStrategy shardStrategy) {
-            this.shardStrategy = shardStrategy;
+        public Builder shardStrategy(ShardStrategy newShardStrategy) {
+            this.shardStrategy = newShardStrategy;
             return this;
         }
 
             return this;
         }
 
-        public Builder shardConfig(String name, Collection<MemberName> replicas) {
-            shardConfigs.put(name, new ShardConfig(name, replicas));
+        public Builder shardConfig(String shardName, Collection<MemberName> replicas) {
+            shardConfigs.put(shardName, new ShardConfig(shardName, replicas));
             return this;
         }
 
             return this;
         }
 
index 7a976b86edc562fc3be105b49c8f6fb73070e9d2..fae05d98f3ef1f6b5ad8ffcbda9f49120178c7aa 100644 (file)
@@ -15,7 +15,7 @@ package org.opendaylight.controller.cluster.datastore.exceptions;
 public class LocalShardNotFoundException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
 public class LocalShardNotFoundException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
-    public LocalShardNotFoundException(String message){
+    public LocalShardNotFoundException(String message) {
         super(message);
     }
 }
         super(message);
     }
 }
index 839cce63e5e347e9dd98adec626f5b51b193d105..ba40c8cd601f841493b0cc42e59313d28035a993 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.cluster.datastore.exceptions;
 
 public class NotInitializedException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
 public class NotInitializedException extends RuntimeException {
     private static final long serialVersionUID = 1L;
+
     public NotInitializedException(String message) {
         super(message);
     }
     public NotInitializedException(String message) {
         super(message);
     }
index c98e2bd384c4b976e041e24f99d57cd6e623a55d..2f82ccf10280531520ff66c445c86ae3cf241918 100644 (file)
@@ -10,7 +10,8 @@ package org.opendaylight.controller.cluster.datastore.exceptions;
 
 public class PrimaryNotFoundException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
 public class PrimaryNotFoundException extends RuntimeException {
     private static final long serialVersionUID = 1L;
-    public PrimaryNotFoundException(String message){
+
+    public PrimaryNotFoundException(String message) {
         super(message);
     }
 }
         super(message);
     }
 }
index 5590877aa7907cd81fe96a193449a99505eb038e..a3bb4b30b4bca268eba5f36c85e732b0df828c63 100644 (file)
@@ -10,7 +10,8 @@ package org.opendaylight.controller.cluster.datastore.exceptions;
 
 public class TimeoutException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
 public class TimeoutException extends RuntimeException {
     private static final long serialVersionUID = 1L;
-    public TimeoutException(String message, Exception e){
-        super(message, e);
+
+    public TimeoutException(String message, Exception cause) {
+        super(message, cause);
     }
 }
     }
 }
index fc3aa592f97ce44063149d449e320073d330c8ed..e8824fbe11b1378774b644310d3878414b17d5a5 100644 (file)
@@ -43,15 +43,15 @@ public class ShardIdentifier {
     }
 
     @Override
     }
 
     @Override
-    public boolean equals(Object o) {
-        if (this == o) {
+    public boolean equals(Object obj) {
+        if (this == obj) {
             return true;
         }
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (obj == null || getClass() != obj.getClass()) {
             return false;
         }
 
             return false;
         }
 
-        ShardIdentifier that = (ShardIdentifier) o;
+        ShardIdentifier that = (ShardIdentifier) obj;
 
         if (!memberName.equals(that.memberName)) {
             return false;
 
         if (!memberName.equals(that.memberName)) {
             return false;
@@ -97,26 +97,26 @@ public class ShardIdentifier {
         private MemberName memberName;
         private String type;
 
         private MemberName memberName;
         private String type;
 
-        public ShardIdentifier build(){
+        public ShardIdentifier build() {
             return new ShardIdentifier(shardName, memberName, type);
         }
 
             return new ShardIdentifier(shardName, memberName, type);
         }
 
-        public Builder shardName(String shardName){
-            this.shardName = shardName;
+        public Builder shardName(String newShardName) {
+            this.shardName = newShardName;
             return this;
         }
 
             return this;
         }
 
-        public Builder memberName(MemberName memberName){
-            this.memberName = memberName;
+        public Builder memberName(MemberName newMemberName) {
+            this.memberName = newMemberName;
             return this;
         }
 
             return this;
         }
 
-        public Builder type(String type){
-            this.type = type;
+        public Builder type(String newType) {
+            this.type = newType;
             return this;
         }
 
             return this;
         }
 
-        public Builder fromShardIdString(String shardId){
+        public Builder fromShardIdString(String shardId) {
             Matcher matcher = PATTERN.matcher(shardId);
 
             if (matcher.matches()) {
             Matcher matcher = PATTERN.matcher(shardId);
 
             if (matcher.matches()) {
index 65bf010b0adcb7e637110691584c0e263064f668..98dbba3ca4873a828608c52da52da68ee6ede568 100644 (file)
@@ -16,15 +16,15 @@ public class ShardManagerIdentifier {
     }
 
     @Override
     }
 
     @Override
-    public boolean equals(Object o) {
-        if (this == o) {
+    public boolean equals(Object obj) {
+        if (this == obj) {
             return true;
         }
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (obj == null || getClass() != obj.getClass()) {
             return false;
         }
 
             return false;
         }
 
-        ShardManagerIdentifier that = (ShardManagerIdentifier) o;
+        ShardManagerIdentifier that = (ShardManagerIdentifier) obj;
 
         if (!type.equals(that.type)) {
             return false;
 
         if (!type.equals(that.type)) {
             return false;
@@ -44,19 +44,19 @@ public class ShardManagerIdentifier {
         return builder.toString();
     }
 
         return builder.toString();
     }
 
-    public static Builder builder(){
+    public static Builder builder() {
         return new Builder();
     }
 
     public static class Builder {
         private String type;
 
         return new Builder();
     }
 
     public static class Builder {
         private String type;
 
-        public Builder type(String type){
-            this.type = type;
+        public Builder type(String newType) {
+            this.type = newType;
             return this;
         }
 
             return this;
         }
 
-        public ShardManagerIdentifier build(){
+        public ShardManagerIdentifier build() {
             return new ShardManagerIdentifier(this.type);
         }
 
             return new ShardManagerIdentifier(this.type);
         }
 
index 5d3fe8b2d0c2cb54a73c6761a28cb483b9be10e0..b42926d2f2ee9246423dfc4ba86a669de1d46b49 100644 (file)
@@ -9,8 +9,9 @@ package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
 
 
 /**
 
 
 /**
- * @author Basheeruddin syedbahm@cisco.com
+ * Factory for creating ShardStats mbeans.
  *
  *
+ * @author Basheeruddin syedbahm@cisco.com
  */
 public class ShardMBeanFactory {
 
  */
 public class ShardMBeanFactory {
 
index b01eb099a5707975515c00d7c661725ff8f16400..6e8ff146d4790f376fba19c33a8e0a474a4f3e86 100644 (file)
@@ -39,7 +39,7 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
 
     private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
 
 
     private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
 
-    private static final Cache<String, OnDemandRaftState> onDemandRaftStateCache =
+    private static final Cache<String, OnDemandRaftState> ONDEMAND_RAFT_STATE_CACHE =
             CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.SECONDS).build();
 
     private long committedTransactionsCount;
             CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.SECONDS).build();
 
     private long committedTransactionsCount;
@@ -78,14 +78,15 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
         this.shard = shard;
     }
 
         this.shard = shard;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private OnDemandRaftState getOnDemandRaftState() {
         String name = getShardName();
     private OnDemandRaftState getOnDemandRaftState() {
         String name = getShardName();
-        OnDemandRaftState state = onDemandRaftStateCache.getIfPresent(name);
-        if(state == null) {
+        OnDemandRaftState state = ONDEMAND_RAFT_STATE_CACHE.getIfPresent(name);
+        if (state == null) {
             statRetrievalError = null;
             statRetrievalTime = null;
 
             statRetrievalError = null;
             statRetrievalTime = null;
 
-            if(shard != null) {
+            if (shard != null) {
                 Timeout timeout = new Timeout(10, TimeUnit.SECONDS);
                 try {
                     Stopwatch timer = Stopwatch.createStarted();
                 Timeout timeout = new Timeout(10, TimeUnit.SECONDS);
                 try {
                     Stopwatch timer = Stopwatch.createStarted();
@@ -94,7 +95,7 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
                             GetOnDemandRaftState.INSTANCE, timeout), timeout.duration());
 
                     statRetrievalTime = timer.stop().toString();
                             GetOnDemandRaftState.INSTANCE, timeout), timeout.duration());
 
                     statRetrievalTime = timer.stop().toString();
-                    onDemandRaftStateCache.put(name, state);
+                    ONDEMAND_RAFT_STATE_CACHE.put(name, state);
                 } catch (Exception e) {
                     statRetrievalError = e.toString();
                 }
                 } catch (Exception e) {
                     statRetrievalError = e.toString();
                 }
@@ -195,6 +196,7 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
     public String getVotedFor() {
         return getOnDemandRaftState().getVotedFor();
     }
     public String getVotedFor() {
         return getOnDemandRaftState().getVotedFor();
     }
+
     @Override
     public boolean isVoting() {
         return getOnDemandRaftState().isVoting();
     @Override
     public boolean isVoting() {
         return getOnDemandRaftState().isVoting();
@@ -254,8 +256,7 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
         return failedReadTransactionsCount.incrementAndGet();
     }
 
         return failedReadTransactionsCount.incrementAndGet();
     }
 
-    public long incrementAbortTransactionsCount ()
-    {
+    public long incrementAbortTransactionsCount() {
         return ++abortTransactionsCount;
     }
 
         return ++abortTransactionsCount;
     }
 
@@ -264,7 +265,7 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
     }
 
     @Override
     }
 
     @Override
-    public long getInMemoryJournalDataSize(){
+    public long getInMemoryJournalDataSize() {
         return getOnDemandRaftState().getInMemoryJournalDataSize();
     }
 
         return getOnDemandRaftState().getInMemoryJournalDataSize();
     }
 
@@ -274,10 +275,10 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
     }
 
     /**
     }
 
     /**
-     * resets the counters related to transactions
+     * Resets the counters related to transactions.
      */
     @Override
      */
     @Override
-    public void resetTransactionCounters(){
+    public void resetTransactionCounters() {
         committedTransactionsCount = 0;
 
         readOnlyTransactionCount = 0;
         committedTransactionsCount = 0;
 
         readOnlyTransactionCount = 0;
@@ -358,7 +359,7 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
 
     @Override
     public void captureSnapshot() {
 
     @Override
     public void captureSnapshot() {
-        if(shard != null) {
+        if (shard != null) {
             shard.getSelf().tell(new InitiateCaptureSnapshot(), ActorRef.noSender());
         }
     }
             shard.getSelf().tell(new InitiateCaptureSnapshot(), ActorRef.noSender());
         }
     }
index 1ae58e2fe854142915e4ae678a6d714454229565..f32b13e69b0799a67f0f17e1a5e0dffbfa04452f 100644 (file)
@@ -12,83 +12,85 @@ import java.util.List;
 import org.opendaylight.controller.cluster.raft.client.messages.FollowerInfo;
 
 /**
 import org.opendaylight.controller.cluster.raft.client.messages.FollowerInfo;
 
 /**
+ * MXBean interface for shard stats.
+ *
  * @author: syedbahm
  */
 public interface ShardStatsMXBean {
 
  * @author: syedbahm
  */
 public interface ShardStatsMXBean {
 
-   String getShardName();
+    String getShardName();
 
 
-   String getStatRetrievalTime();
+    String getStatRetrievalTime();
 
 
-   String getStatRetrievalError();
+    String getStatRetrievalError();
 
 
-   long getCommittedTransactionsCount();
+    long getCommittedTransactionsCount();
 
 
-   long getReadOnlyTransactionCount();
+    long getReadOnlyTransactionCount();
 
 
-   long getWriteOnlyTransactionCount();
+    long getWriteOnlyTransactionCount();
 
 
-   long getReadWriteTransactionCount();
+    long getReadWriteTransactionCount();
 
 
-   long getLastLogIndex();
+    long getLastLogIndex();
 
 
-   long getLastLogTerm();
+    long getLastLogTerm();
 
 
-   long getCurrentTerm();
+    long getCurrentTerm();
 
 
-   long getCommitIndex();
+    long getCommitIndex();
 
 
-   long getLastApplied();
+    long getLastApplied();
 
 
-   long getLastIndex();
+    long getLastIndex();
 
 
-   long getLastTerm();
+    long getLastTerm();
 
 
-   long getSnapshotIndex();
+    long getSnapshotIndex();
 
 
-   long getSnapshotTerm();
+    long getSnapshotTerm();
 
 
-   long getReplicatedToAllIndex();
+    long getReplicatedToAllIndex();
 
 
-   String getLastCommittedTransactionTime();
+    String getLastCommittedTransactionTime();
 
 
-   long getFailedTransactionsCount();
+    long getFailedTransactionsCount();
 
 
-   long getAbortTransactionsCount();
+    long getAbortTransactionsCount();
 
 
-   long getFailedReadTransactionsCount();
+    long getFailedReadTransactionsCount();
 
 
-   String getLeader();
+    String getLeader();
 
 
-   String getRaftState();
+    String getRaftState();
 
 
-   String getVotedFor();
+    String getVotedFor();
 
 
-   boolean isSnapshotCaptureInitiated();
+    boolean isSnapshotCaptureInitiated();
 
 
-   boolean isVoting();
+    boolean isVoting();
 
 
-   void resetTransactionCounters();
+    void resetTransactionCounters();
 
 
-   long getInMemoryJournalDataSize();
+    long getInMemoryJournalDataSize();
 
 
-   long getInMemoryJournalLogSize();
+    long getInMemoryJournalLogSize();
 
 
-   boolean getFollowerInitialSyncStatus();
+    boolean getFollowerInitialSyncStatus();
 
 
-   List<FollowerInfo> getFollowerInfo();
+    List<FollowerInfo> getFollowerInfo();
 
 
-   String getPeerAddresses();
+    String getPeerAddresses();
 
 
-   String getPeerVotingStates();
+    String getPeerVotingStates();
 
 
-   long getLeadershipChangeCount();
+    long getLeadershipChangeCount();
 
 
-   String getLastLeadershipChangeTime();
+    String getLastLeadershipChangeTime();
 
 
-   int getPendingTxCommitQueueSize();
+    int getPendingTxCommitQueueSize();
 
 
-   int getTxCohortCacheSize();
+    int getTxCohortCacheSize();
 
 
-   void captureSnapshot();
+    void captureSnapshot();
 }
 }
index 57a4e395fa9e5b489befa1a619c433412cdcfbaf..25c13989d599a153a3680d78336f4662984a894f 100644 (file)
@@ -23,7 +23,7 @@ public class AbortTransaction extends AbstractThreePhaseCommitMessage {
 
     public static AbortTransaction fromSerializable(Object serializable) {
         Preconditions.checkArgument(serializable instanceof AbortTransaction);
 
     public static AbortTransaction fromSerializable(Object serializable) {
         Preconditions.checkArgument(serializable instanceof AbortTransaction);
-            return (AbortTransaction)serializable;
+        return (AbortTransaction)serializable;
     }
 
     public static boolean isSerializedType(Object message) {
     }
 
     public static boolean isSerializedType(Object message) {
index fd20d20c0bdccaa8730bd643d32c756c78758e8b..c9028466d46632de7945a7d7368b885ab8ae8bfe 100644 (file)
@@ -8,8 +8,8 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import javax.annotation.Nonnull;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Preconditions;
+import javax.annotation.Nonnull;
 
 /**
  * A message sent to the ShardManager to dynamically add a new local shard
 
 /**
  * A message sent to the ShardManager to dynamically add a new local shard
@@ -27,16 +27,16 @@ public class AddShardReplica {
      * @param shardName name of the shard that is to be locally replicated.
      */
 
      * @param shardName name of the shard that is to be locally replicated.
      */
 
-    public AddShardReplica (@Nonnull String shardName){
+    public AddShardReplica(@Nonnull String shardName) {
         this.shardName = Preconditions.checkNotNull(shardName, "ShardName should not be null");
     }
 
         this.shardName = Preconditions.checkNotNull(shardName, "ShardName should not be null");
     }
 
-    public String getShardName(){
+    public String getShardName() {
         return this.shardName;
     }
 
     @Override
         return this.shardName;
     }
 
     @Override
-    public String toString(){
+    public String toString() {
         return "AddShardReplica[ShardName=" + shardName + "]";
     }
 }
         return "AddShardReplica[ShardName=" + shardName + "]";
     }
 }
index 563b330b989267b88d8f078e5ff0def4761e1143..430202af42e39d17d86b5a812a9cfcc726ea9900 100644 (file)
@@ -10,7 +10,8 @@ package org.opendaylight.controller.cluster.datastore.messages;
 
 
 public class CloseDataChangeListenerRegistrationReply {
 
 
 public class CloseDataChangeListenerRegistrationReply {
-    public static final CloseDataChangeListenerRegistrationReply INSTANCE = new CloseDataChangeListenerRegistrationReply();
+    public static final CloseDataChangeListenerRegistrationReply INSTANCE =
+            new CloseDataChangeListenerRegistrationReply();
 
     private CloseDataChangeListenerRegistrationReply() {
     }
 
     private CloseDataChangeListenerRegistrationReply() {
     }
index 032f4c10b0c2dad918ae523bc759b5f6a78ac710..dfcc894ffe6f9ce20fc729d21d044546f9b96cb4 100644 (file)
@@ -12,7 +12,8 @@ import java.io.Serializable;
 
 public final class CloseDataTreeChangeListenerRegistration implements Serializable {
     private static final long serialVersionUID = 1L;
 
 public final class CloseDataTreeChangeListenerRegistration implements Serializable {
     private static final long serialVersionUID = 1L;
-    private static final CloseDataTreeChangeListenerRegistration INSTANCE = new CloseDataTreeChangeListenerRegistration();
+    private static final CloseDataTreeChangeListenerRegistration INSTANCE =
+            new CloseDataTreeChangeListenerRegistration();
 
     private CloseDataTreeChangeListenerRegistration() {
     }
 
     private CloseDataTreeChangeListenerRegistration() {
     }
index 9d83fac27c2a4491333f3e9bd6b8555ffd8db3e3..a7717b69e0b664312b0d7bc675cd8a81fee41e45 100644 (file)
@@ -12,7 +12,8 @@ import java.io.Serializable;
 
 public final class CloseDataTreeChangeListenerRegistrationReply implements Serializable {
     private static final long serialVersionUID = 1L;
 
 public final class CloseDataTreeChangeListenerRegistrationReply implements Serializable {
     private static final long serialVersionUID = 1L;
-    private static final CloseDataTreeChangeListenerRegistrationReply INSTANCE = new CloseDataTreeChangeListenerRegistrationReply();
+    private static final CloseDataTreeChangeListenerRegistrationReply INSTANCE =
+            new CloseDataTreeChangeListenerRegistrationReply();
 
     private CloseDataTreeChangeListenerRegistrationReply() {
         // Use getInstance() instead
 
     private CloseDataTreeChangeListenerRegistrationReply() {
         // Use getInstance() instead
index 24c0c5cab100ebb04851bc3be14aac547cf51894..2fe96cbe67eddf945dbb41e5bca1eae6aad554b1 100644 (file)
@@ -15,7 +15,8 @@ import java.io.ObjectOutput;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.yangtools.concepts.Identifiable;
 
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.yangtools.concepts.Identifiable;
 
-public class CloseTransactionChain extends VersionedExternalizableMessage implements Identifiable<LocalHistoryIdentifier> {
+public class CloseTransactionChain extends VersionedExternalizableMessage
+        implements Identifiable<LocalHistoryIdentifier> {
     private static final long serialVersionUID = 1L;
 
     private LocalHistoryIdentifier transactionChainId;
     private static final long serialVersionUID = 1L;
 
     private LocalHistoryIdentifier transactionChainId;
@@ -45,7 +46,7 @@ public class CloseTransactionChain extends VersionedExternalizableMessage implem
         transactionChainId.writeTo(out);
     }
 
         transactionChainId.writeTo(out);
     }
 
-    public static CloseTransactionChain fromSerializable(final Object serializable){
+    public static CloseTransactionChain fromSerializable(final Object serializable) {
         Preconditions.checkArgument(serializable instanceof CloseTransactionChain);
         return (CloseTransactionChain)serializable;
     }
         Preconditions.checkArgument(serializable instanceof CloseTransactionChain);
         return (CloseTransactionChain)serializable;
     }
index 97231dc366f38b24efe7b7424f8cec1da3f9e312..c48adf2d80befc8ca62e25acb2fb6b4ad19ae04c 100644 (file)
@@ -54,7 +54,7 @@ public class DataChanged implements Externalizable {
         // Read created data
 
         int size = in.readInt();
         // Read created data
 
         int size = in.readInt();
-        for(int i = 0; i < size; i++) {
+        for (int i = 0; i < size; i++) {
             YangInstanceIdentifier path = streamReader.readYangInstanceIdentifier();
             NormalizedNode<?, ?> node = streamReader.readNormalizedNode();
             builder.addCreated(path, node);
             YangInstanceIdentifier path = streamReader.readYangInstanceIdentifier();
             NormalizedNode<?, ?> node = streamReader.readNormalizedNode();
             builder.addCreated(path, node);
@@ -63,7 +63,7 @@ public class DataChanged implements Externalizable {
         // Read updated data
 
         size = in.readInt();
         // Read updated data
 
         size = in.readInt();
-        for(int i = 0; i < size; i++) {
+        for (int i = 0; i < size; i++) {
             YangInstanceIdentifier path = streamReader.readYangInstanceIdentifier();
             NormalizedNode<?, ?> before = streamReader.readNormalizedNode();
             NormalizedNode<?, ?> after = streamReader.readNormalizedNode();
             YangInstanceIdentifier path = streamReader.readYangInstanceIdentifier();
             NormalizedNode<?, ?> before = streamReader.readNormalizedNode();
             NormalizedNode<?, ?> after = streamReader.readNormalizedNode();
@@ -73,7 +73,7 @@ public class DataChanged implements Externalizable {
         // Read removed data
 
         size = in.readInt();
         // Read removed data
 
         size = in.readInt();
-        for(int i = 0; i < size; i++) {
+        for (int i = 0; i < size; i++) {
             YangInstanceIdentifier path = streamReader.readYangInstanceIdentifier();
             NormalizedNode<?, ?> node = streamReader.readNormalizedNode();
             builder.addRemoved(path, node);
             YangInstanceIdentifier path = streamReader.readYangInstanceIdentifier();
             NormalizedNode<?, ?> node = streamReader.readNormalizedNode();
             builder.addRemoved(path, node);
@@ -82,14 +82,14 @@ public class DataChanged implements Externalizable {
         // Read original subtree
 
         boolean present = in.readBoolean();
         // Read original subtree
 
         boolean present = in.readBoolean();
-        if(present) {
+        if (present) {
             builder.setBefore(streamReader.readNormalizedNode());
         }
 
         // Read updated subtree
 
         present = in.readBoolean();
             builder.setBefore(streamReader.readNormalizedNode());
         }
 
         // Read updated subtree
 
         present = in.readBoolean();
-        if(present) {
+        if (present) {
             builder.setAfter(streamReader.readNormalizedNode());
         }
 
             builder.setAfter(streamReader.readNormalizedNode());
         }
 
@@ -106,7 +106,7 @@ public class DataChanged implements Externalizable {
 
         Map<YangInstanceIdentifier, NormalizedNode<?, ?>> createdData = change.getCreatedData();
         out.writeInt(createdData.size());
 
         Map<YangInstanceIdentifier, NormalizedNode<?, ?>> createdData = change.getCreatedData();
         out.writeInt(createdData.size());
-        for(Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> e: createdData.entrySet()) {
+        for (Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> e: createdData.entrySet()) {
             streamWriter.writeYangInstanceIdentifier(e.getKey());
             streamWriter.writeNormalizedNode(e.getValue());
         }
             streamWriter.writeYangInstanceIdentifier(e.getKey());
             streamWriter.writeNormalizedNode(e.getValue());
         }
@@ -116,7 +116,7 @@ public class DataChanged implements Externalizable {
         Map<YangInstanceIdentifier, NormalizedNode<?, ?>> originalData = change.getOriginalData();
         Map<YangInstanceIdentifier, NormalizedNode<?, ?>> updatedData = change.getUpdatedData();
         out.writeInt(updatedData.size());
         Map<YangInstanceIdentifier, NormalizedNode<?, ?>> originalData = change.getOriginalData();
         Map<YangInstanceIdentifier, NormalizedNode<?, ?>> updatedData = change.getUpdatedData();
         out.writeInt(updatedData.size());
-        for(Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> e: updatedData.entrySet()) {
+        for (Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> e: updatedData.entrySet()) {
             streamWriter.writeYangInstanceIdentifier(e.getKey());
             streamWriter.writeNormalizedNode(originalData.get(e.getKey()));
             streamWriter.writeNormalizedNode(e.getValue());
             streamWriter.writeYangInstanceIdentifier(e.getKey());
             streamWriter.writeNormalizedNode(originalData.get(e.getKey()));
             streamWriter.writeNormalizedNode(e.getValue());
@@ -126,7 +126,7 @@ public class DataChanged implements Externalizable {
 
         Set<YangInstanceIdentifier> removed = change.getRemovedPaths();
         out.writeInt(removed.size());
 
         Set<YangInstanceIdentifier> removed = change.getRemovedPaths();
         out.writeInt(removed.size());
-        for(YangInstanceIdentifier path: removed) {
+        for (YangInstanceIdentifier path: removed) {
             streamWriter.writeYangInstanceIdentifier(path);
             streamWriter.writeNormalizedNode(originalData.get(path));
         }
             streamWriter.writeYangInstanceIdentifier(path);
             streamWriter.writeNormalizedNode(originalData.get(path));
         }
@@ -135,7 +135,7 @@ public class DataChanged implements Externalizable {
 
         NormalizedNode<?, ?> originalSubtree = change.getOriginalSubtree();
         out.writeBoolean(originalSubtree != null);
 
         NormalizedNode<?, ?> originalSubtree = change.getOriginalSubtree();
         out.writeBoolean(originalSubtree != null);
-        if(originalSubtree != null) {
+        if (originalSubtree != null) {
             streamWriter.writeNormalizedNode(originalSubtree);
         }
 
             streamWriter.writeNormalizedNode(originalSubtree);
         }
 
@@ -143,7 +143,7 @@ public class DataChanged implements Externalizable {
 
         NormalizedNode<?, ?> updatedSubtree = change.getUpdatedSubtree();
         out.writeBoolean(updatedSubtree != null);
 
         NormalizedNode<?, ?> updatedSubtree = change.getUpdatedSubtree();
         out.writeBoolean(updatedSubtree != null);
-        if(updatedSubtree != null) {
+        if (updatedSubtree != null) {
             streamWriter.writeNormalizedNode(updatedSubtree);
         }
     }
             streamWriter.writeNormalizedNode(updatedSubtree);
         }
     }
index db62547d424506efb26236610e9d1567e032e6fd..1bd687cbb7576c65513cafd8e4823c502914bcb5 100644 (file)
@@ -32,10 +32,11 @@ public class DataExists extends AbstractRead<Boolean> {
 
     @Override
     public void processResponse(Object response, SettableFuture<Boolean> returnFuture) {
 
     @Override
     public void processResponse(Object response, SettableFuture<Boolean> returnFuture) {
-        if(DataExistsReply.isSerializedType(response)) {
+        if (DataExistsReply.isSerializedType(response)) {
             returnFuture.set(Boolean.valueOf(DataExistsReply.fromSerializable(response).exists()));
         } else {
             returnFuture.set(Boolean.valueOf(DataExistsReply.fromSerializable(response).exists()));
         } else {
-            returnFuture.setException(new ReadFailedException("Invalid response checking exists for path " + getPath()));
+            returnFuture.setException(new ReadFailedException("Invalid response checking exists for path "
+                    + getPath()));
         }
     }
 
         }
     }
 
@@ -44,7 +45,7 @@ public class DataExists extends AbstractRead<Boolean> {
         return new DataExists(getPath(), withVersion);
     }
 
         return new DataExists(getPath(), withVersion);
     }
 
-    public static DataExists fromSerializable(final Object serializable){
+    public static DataExists fromSerializable(final Object serializable) {
         Preconditions.checkArgument(serializable instanceof DataExists);
         return (DataExists)serializable;
     }
         Preconditions.checkArgument(serializable instanceof DataExists);
         return (DataExists)serializable;
     }
index 2449a2b3daadd44458b4822ad907fe39f4f83847..380e71e78adc04ba01e0df89e0bdd6ab16742ce8 100644 (file)
@@ -9,8 +9,9 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 /**
 package org.opendaylight.controller.cluster.datastore.messages;
 
 /**
- * FindLocalShard is a message that should be sent to the {@link org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager}
- * when we need to find a reference to a LocalShard
+ * FindLocalShard is a message that should be sent to the
+ * {@link org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager} when we need to find a reference
+ * to a LocalShard.
  */
 public class FindLocalShard {
     private final String shardName;
  */
 public class FindLocalShard {
     private final String shardName;
index 0b7fcf0ed507160866b2e220f5e21b93d43bf3fb..507f61520a401102fb95ba3c4a778619db268722 100644 (file)
@@ -12,8 +12,7 @@ import com.google.common.base.Preconditions;
 import java.io.Serializable;
 
 /**
 import java.io.Serializable;
 
 /**
- * The FindPrimary message is used to locate the primary of any given shard
- *
+ * The FindPrimary message is used to locate the primary of any given shard.
  */
 public class FindPrimary implements Serializable {
     private static final long serialVersionUID = 1L;
  */
 public class FindPrimary implements Serializable {
     private static final long serialVersionUID = 1L;
index b0b66ae3720da6db0997dfa2c5755742eed57dd0..5c58a894db92102dbd9f3a4abf70b7f9681056cd 100644 (file)
@@ -11,8 +11,9 @@ package org.opendaylight.controller.cluster.datastore.messages;
 import akka.actor.ActorRef;
 
 /**
 import akka.actor.ActorRef;
 
 /**
- * LocalShardFound is a message that is sent by the {@link org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager}
- * when it finds a shard with the specified name in it's local shard registry
+ * LocalShardFound is a message that is sent by the
+ * {@link org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager}
+ * when it finds a shard with the specified name in it's local shard registry.
  */
 public class LocalShardFound {
     private final ActorRef path;
  */
 public class LocalShardFound {
     private final ActorRef path;
index 6d08be4847ac6c8ce47d82d3fe40f7d71c114fdd..381eb562319ab3fdc494a2bc61677a8cf7daf3bf 100644 (file)
@@ -9,13 +9,15 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 /**
 package org.opendaylight.controller.cluster.datastore.messages;
 
 /**
- * LocalShardNotFound is a message that is sent by the {@link org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager}
- * when it cannot locate a shard in it's local registry with the shardName specified
+ * LocalShardNotFound is a message that is sent by the
+ * {@link org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager}
+ * when it cannot locate a shard in it's local registry with the shardName specified.
  */
 public class LocalShardNotFound {
     private final String shardName;
 
     /**
  */
 public class LocalShardNotFound {
     private final String shardName;
 
     /**
+     * Constructs an instance.
      *
      * @param shardName the name of the shard that could not be found
      */
      *
      * @param shardName the name of the shard that could not be found
      */
index a9d1311d61a2df968d5b45350b3d0a203fcbd1da..e79513e06a0a13e293bfb8b47b46c08cb317d278 100644 (file)
@@ -28,15 +28,16 @@ public class ReadData extends AbstractRead<Optional<NormalizedNode<?, ?>>> {
     }
 
     @Override
     }
 
     @Override
-    public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> apply(DOMStoreReadTransaction readDelegate) {
+    public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> apply(
+            DOMStoreReadTransaction readDelegate) {
         return readDelegate.read(getPath());
     }
 
     @Override
     public void processResponse(Object readResponse, SettableFuture<Optional<NormalizedNode<?, ?>>> returnFuture) {
         return readDelegate.read(getPath());
     }
 
     @Override
     public void processResponse(Object readResponse, SettableFuture<Optional<NormalizedNode<?, ?>>> returnFuture) {
-        if(ReadDataReply.isSerializedType(readResponse)) {
+        if (ReadDataReply.isSerializedType(readResponse)) {
             ReadDataReply reply = ReadDataReply.fromSerializable(readResponse);
             ReadDataReply reply = ReadDataReply.fromSerializable(readResponse);
-            returnFuture.set(Optional.<NormalizedNode<?, ?>> fromNullable(reply.getNormalizedNode()));
+            returnFuture.set(Optional.<NormalizedNode<?, ?>>fromNullable(reply.getNormalizedNode()));
         } else {
             returnFuture.setException(new ReadFailedException("Invalid response reading data for path " + getPath()));
         }
         } else {
             returnFuture.setException(new ReadFailedException("Invalid response reading data for path " + getPath()));
         }
index f48811203cb308227aa397f4cc8cb90666d04a55..1f457780e5fa16266ea75247892630d8208299fd 100644 (file)
@@ -17,8 +17,8 @@ import org.opendaylight.controller.cluster.datastore.utils.SerializationUtils;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
- * Request a {@link org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener} registration be made on the shard
- * leader.
+ * Request a {@link org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener} registration be made on the
+ * shard leader.
  */
 public final class RegisterDataTreeChangeListener implements Externalizable, ListenerRegistrationMessage {
     private static final long serialVersionUID = 1L;
  */
 public final class RegisterDataTreeChangeListener implements Externalizable, ListenerRegistrationMessage {
     private static final long serialVersionUID = 1L;
index 51f9d59f85c3199a6803788a9e9a96f245799c41..0325ee9f2baa38af39d658efcca9c6a29b7d6e22 100644 (file)
@@ -26,12 +26,12 @@ public class RemoveShardReplica {
      *
      * @param shardName name of the local shard that is to be dynamically removed.
      */
      *
      * @param shardName name of the local shard that is to be dynamically removed.
      */
-    public RemoveShardReplica (@Nonnull String shardName, @Nonnull MemberName memberName) {
+    public RemoveShardReplica(@Nonnull String shardName, @Nonnull MemberName memberName) {
         this.shardName = Preconditions.checkNotNull(shardName, "shardName should not be null");
         this.memberName = Preconditions.checkNotNull(memberName, "memberName should not be null");
     }
 
         this.shardName = Preconditions.checkNotNull(shardName, "shardName should not be null");
         this.memberName = Preconditions.checkNotNull(memberName, "memberName should not be null");
     }
 
-    public String getShardName(){
+    public String getShardName() {
         return shardName;
     }
 
         return shardName;
     }
 
index 47f9ea8c4fadcae48d6d2ffeb5527e2b2da51ffd..16f49e278a90ef65671874e4d34defd896d96357 100644 (file)
@@ -11,13 +11,13 @@ package org.opendaylight.controller.cluster.datastore.messages;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public class UpdateSchemaContext {
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public class UpdateSchemaContext {
-  private final SchemaContext schemaContext;
+    private final SchemaContext schemaContext;
 
 
-  public UpdateSchemaContext(SchemaContext schemaContext) {
-    this.schemaContext = schemaContext;
-  }
+    public UpdateSchemaContext(SchemaContext schemaContext) {
+        this.schemaContext = schemaContext;
+    }
 
 
-  public SchemaContext getSchemaContext() {
-    return schemaContext;
-  }
+    public SchemaContext getSchemaContext() {
+        return schemaContext;
+    }
 }
 }
index 51a9079d20cbc11c12295d02a6487d80b0d2c154..781580a643ec3e03a98e26327fb2a5374b41d319 100644 (file)
@@ -27,7 +27,7 @@ public abstract class VersionedExternalizableMessage implements Externalizable,
     }
 
     public VersionedExternalizableMessage(short version) {
     }
 
     public VersionedExternalizableMessage(short version) {
-        this.version = version <= DataStoreVersions.CURRENT_VERSION ? version: DataStoreVersions.CURRENT_VERSION;
+        this.version = version <= DataStoreVersions.CURRENT_VERSION ? version : DataStoreVersions.CURRENT_VERSION;
     }
 
     public short getVersion() {
     }
 
     public short getVersion() {
@@ -47,7 +47,8 @@ public abstract class VersionedExternalizableMessage implements Externalizable,
     @Override
     public final Object toSerializable() {
         if (getVersion() < DataStoreVersions.BORON_VERSION) {
     @Override
     public final Object toSerializable() {
         if (getVersion() < DataStoreVersions.BORON_VERSION) {
-            throw new UnsupportedOperationException("Versions prior to " + DataStoreVersions.BORON_VERSION + " are not supported");
+            throw new UnsupportedOperationException("Versions prior to " + DataStoreVersions.BORON_VERSION
+                    + " are not supported");
         }
 
         return this;
         }
 
         return this;
index 77f0858d7b1ef9119fb5b2bff9039de0d30e4536..02b8047b44bfae5ca1094acc5b26ddfd07890a1b 100644 (file)
@@ -12,7 +12,7 @@ package org.opendaylight.controller.cluster.datastore.modification;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
- * Base class to be used for all simple modifications that can be applied to a DOMStoreTransaction
+ * Base class to be used for all simple modifications that can be applied to a DOMStoreTransaction.
  */
 public abstract class AbstractModification implements Modification {
 
  */
 public abstract class AbstractModification implements Modification {
 
index 4c856d31eb35803d045dc87a204de5adcbce1dde..2bc6d1d84c9bd49a43d261bb4576eec31ebcf663 100644 (file)
@@ -19,8 +19,9 @@ import java.util.List;
  */
 public interface CompositeModification extends Modification {
     /**
  */
 public interface CompositeModification extends Modification {
     /**
-     * Get a list of Modifications contained by this Composite
-     * @return
+     * Get a list of modifications contained by this composite.
+     *
+     * @return list of modifications
      */
     List<Modification> getModifications();
 }
      */
     List<Modification> getModifications();
 }
index 08274ef7051d714aa736d505c965d97ae10f3a44..a069d6c5c498ccb36aa0e69ed162106b27899cfc 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
 /**
- * DeleteModification store all the parameters required to delete a path from the data tree
+ * DeleteModification store all the parameters required to delete a path from the data tree.
  */
 public class DeleteModification extends AbstractModification {
     private static final long serialVersionUID = 1L;
  */
 public class DeleteModification extends AbstractModification {
     private static final long serialVersionUID = 1L;
index 10b9b94242a07d11e767c902a28957055ee932a5..47c6f5d4f5e59cbc07c07f7cb5b7b6b2b5900b2d 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
 /**
- * MergeModification stores all the parameters required to merge data into the specified path
+ * MergeModification stores all the parameters required to merge data into the specified path.
  */
 public class MergeModification extends WriteModification {
     private static final long serialVersionUID = 1L;
  */
 public class MergeModification extends WriteModification {
     private static final long serialVersionUID = 1L;
index e9d2fdf2915065e43159d68c05f3d8f65f9bace1..97b5e745df25840a3e47adb1aefbc4baf3c3c4ff 100644 (file)
@@ -22,8 +22,9 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification
  * </p>
  *
  * <p>
  * </p>
  *
  * <p>
- * Modifications can in turn be lumped into a single {@link org.opendaylight.controller.cluster.datastore.modification.CompositeModification}
- * which can then be applied to a write transaction
+ * Modifications can in turn be lumped into a single
+ * {@link org.opendaylight.controller.cluster.datastore.modification.CompositeModification}
+ * which can then be applied to a write transaction.
  * </p>
  */
 public interface Modification extends Externalizable {
  * </p>
  */
 public interface Modification extends Externalizable {
@@ -34,16 +35,16 @@ public interface Modification extends Externalizable {
     byte DELETE = 4;
 
     /**
     byte DELETE = 4;
 
     /**
-     * Apply the modification to the specified transaction
+     * Apply the modification to the specified transaction.
      *
      *
-     * @param transaction
+     * @param transaction the transaction
      */
     void apply(DOMStoreWriteTransaction transaction);
 
     /**
      */
     void apply(DOMStoreWriteTransaction transaction);
 
     /**
-     * Apply the modification to the specified transaction
+     * Apply the modification to the specified transaction.
      *
      *
-     * @param transaction
+     * @param transaction the transaction
      */
     void apply(DataTreeModification transaction);
 
      */
     void apply(DataTreeModification transaction);
 
index 0c9a73a0d0dd913538beb5bf8f3279866f46bba3..163e23d2d158b3028be3af5df661a37a64bd3e4d 100644 (file)
@@ -23,8 +23,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
 /**
- * MutableCompositeModification is just a mutable version of a
- * CompositeModification {@link org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification#addModification(Modification)}
+ * MutableCompositeModification is just a mutable version of a CompositeModification.
  */
 public class MutableCompositeModification extends VersionedExternalizableMessage implements CompositeModification {
     private static final long serialVersionUID = 1L;
  */
 public class MutableCompositeModification extends VersionedExternalizableMessage implements CompositeModification {
     private static final long serialVersionUID = 1L;
@@ -59,10 +58,9 @@ public class MutableCompositeModification extends VersionedExternalizableMessage
     }
 
     /**
     }
 
     /**
-     * Add a new Modification to the list of Modifications represented by this
-     * composite
+     * Add a new Modification to the list of Modifications represented by this composite.
      *
      *
-     * @param modification
+     * @param modification the modification to add.
      */
     public void addModification(Modification modification) {
         modifications.add(modification);
      */
     public void addModification(Modification modification) {
         modifications.add(modification);
@@ -79,25 +77,27 @@ public class MutableCompositeModification extends VersionedExternalizableMessage
 
         int size = in.readInt();
 
 
         int size = in.readInt();
 
-        if(size > 1) {
+        if (size > 1) {
             SerializationUtils.REUSABLE_READER_TL.set(new NormalizedNodeInputStreamReader(in));
         }
 
         try {
             SerializationUtils.REUSABLE_READER_TL.set(new NormalizedNodeInputStreamReader(in));
         }
 
         try {
-            for(int i = 0; i < size; i++) {
+            for (int i = 0; i < size; i++) {
                 byte type = in.readByte();
                 byte type = in.readByte();
-                switch(type) {
-                case Modification.WRITE:
-                    modifications.add(WriteModification.fromStream(in, getVersion()));
-                    break;
-
-                case Modification.MERGE:
-                    modifications.add(MergeModification.fromStream(in, getVersion()));
-                    break;
-
-                case Modification.DELETE:
-                    modifications.add(DeleteModification.fromStream(in, getVersion()));
-                    break;
+                switch (type) {
+                    case Modification.WRITE:
+                        modifications.add(WriteModification.fromStream(in, getVersion()));
+                        break;
+
+                    case Modification.MERGE:
+                        modifications.add(MergeModification.fromStream(in, getVersion()));
+                        break;
+
+                    case Modification.DELETE:
+                        modifications.add(DeleteModification.fromStream(in, getVersion()));
+                        break;
+                    default:
+                        break;
                 }
             }
         } finally {
                 }
             }
         } finally {
@@ -111,12 +111,12 @@ public class MutableCompositeModification extends VersionedExternalizableMessage
 
         out.writeInt(modifications.size());
 
 
         out.writeInt(modifications.size());
 
-        if(modifications.size() > 1) {
+        if (modifications.size() > 1) {
             SerializationUtils.REUSABLE_WRITER_TL.set(NormalizedNodeInputOutput.newDataOutput(out));
         }
 
         try {
             SerializationUtils.REUSABLE_WRITER_TL.set(NormalizedNodeInputOutput.newDataOutput(out));
         }
 
         try {
-            for(Modification mod: modifications) {
+            for (Modification mod: modifications) {
                 out.writeByte(mod.getType());
                 mod.writeExternal(out);
             }
                 out.writeByte(mod.getType());
                 mod.writeExternal(out);
             }
index e400fcc1dfbf5196bef1caa541069ab1c052f2ea..cbc25d71c3d52465f1eb6caf94907d05ba1eb6d5 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
 /**
- * WriteModification stores all the parameters required to write data to the specified path
+ * WriteModification stores all the parameters required to write data to the specified path.
  */
 public class WriteModification extends AbstractModification {
     private static final long serialVersionUID = 1L;
  */
 public class WriteModification extends AbstractModification {
     private static final long serialVersionUID = 1L;
@@ -76,12 +76,8 @@ public class WriteModification extends AbstractModification {
         return mod;
     }
 
         return mod;
     }
 
-    private static final Applier<WriteModification> APPLIER = new Applier<WriteModification>() {
-        @Override
-        public void apply(WriteModification instance, YangInstanceIdentifier path,
-                NormalizedNode<?, ?> node) {
-            instance.setPath(path);
-            instance.data = node;
-        }
+    private static final Applier<WriteModification> APPLIER = (instance, path, node) -> {
+        instance.setPath(path);
+        instance.data = node;
     };
 }
     };
 }
index 5c3723e2aa8be97e1b5861c57587eba0ec838aa5..b553bf92a2739cbb1e27474fd775fd7692281718 100644 (file)
@@ -22,6 +22,9 @@ public final class AbortTransactionPayload extends AbstractIdentifiablePayload<T
     private static final class Proxy extends AbstractProxy<TransactionIdentifier> {
         private static final long serialVersionUID = 1L;
 
     private static final class Proxy extends AbstractProxy<TransactionIdentifier> {
         private static final long serialVersionUID = 1L;
 
+        // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+        // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+        @SuppressWarnings("checkstyle:RedundantModifier")
         public Proxy() {
             // For Externalizable
         }
         public Proxy() {
             // For Externalizable
         }
index 122c96938e126fd25f25bdae4b1b2a1f8d5e83a0..4692236532d4829f9a7e19d9ac9ca3abda334ff0 100644 (file)
@@ -26,7 +26,8 @@ import org.opendaylight.yangtools.concepts.Identifier;
  *
  * @author Robert Varga
  */
  *
  * @author Robert Varga
  */
-public abstract class AbstractIdentifiablePayload<T extends Identifier> extends Payload implements Identifiable<T>, Serializable {
+public abstract class AbstractIdentifiablePayload<T extends Identifier>
+        extends Payload implements Identifiable<T>, Serializable {
     protected abstract static class AbstractProxy<T extends Identifier> implements Externalizable {
         private static final long serialVersionUID = 1L;
         private byte[] serialized;
     protected abstract static class AbstractProxy<T extends Identifier> implements Externalizable {
         private static final long serialVersionUID = 1L;
         private byte[] serialized;
@@ -58,15 +59,18 @@ public abstract class AbstractIdentifiablePayload<T extends Identifier> extends
             return Verify.verifyNotNull(createObject(identifier, serialized));
         }
 
             return Verify.verifyNotNull(createObject(identifier, serialized));
         }
 
-        protected abstract @Nonnull T readIdentifier(@Nonnull DataInput in) throws IOException;
-        protected abstract @Nonnull Identifiable<T> createObject(@Nonnull T identifier, @Nonnull byte[] serialized);
+        @Nonnull
+        protected abstract T readIdentifier(@Nonnull DataInput in) throws IOException;
+
+        @Nonnull
+        protected abstract Identifiable<T> createObject(@Nonnull T identifier, @Nonnull byte[] serialized);
     }
 
     private static final long serialVersionUID = 1L;
     private final byte[] serialized;
     private final T identifier;
 
     }
 
     private static final long serialVersionUID = 1L;
     private final byte[] serialized;
     private final T identifier;
 
-    AbstractIdentifiablePayload(final @Nonnull T identifier, final @Nonnull byte[] serialized) {
+    AbstractIdentifiablePayload(@Nonnull final T identifier, @Nonnull final byte[] serialized) {
         this.identifier = Preconditions.checkNotNull(identifier);
         this.serialized = Preconditions.checkNotNull(serialized);
     }
         this.identifier = Preconditions.checkNotNull(identifier);
         this.serialized = Preconditions.checkNotNull(serialized);
     }
@@ -85,5 +89,6 @@ public abstract class AbstractIdentifiablePayload<T extends Identifier> extends
         return Verify.verifyNotNull(externalizableProxy(serialized));
     }
 
         return Verify.verifyNotNull(externalizableProxy(serialized));
     }
 
-    protected abstract @Nonnull AbstractProxy<T> externalizableProxy(@Nonnull byte[] serialized);
+    @Nonnull
+    protected abstract AbstractProxy<T> externalizableProxy(@Nonnull byte[] serialized);
 }
 }
index 0d92eac586c023444bf95ed6b7dd34394ae477cc..48d267342149e3bbcef9a4b3bc21123701c1510b 100644 (file)
@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
 abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnapshot {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractVersionedShardDataTreeSnapshot.class);
 
 abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnapshot {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractVersionedShardDataTreeSnapshot.class);
 
+    @SuppressWarnings("checkstyle:FallThrough")
     static ShardDataTreeSnapshot deserialize(final DataInputStream is) throws IOException {
         final PayloadVersion version = PayloadVersion.readFrom(is);
         switch (version) {
     static ShardDataTreeSnapshot deserialize(final DataInputStream is) throws IOException {
         final PayloadVersion version = PayloadVersion.readFrom(is);
         switch (version) {
@@ -44,6 +45,8 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
             case TEST_PAST_VERSION:
                 // These versions are never returned and this code is effectively dead
                 break;
             case TEST_PAST_VERSION:
                 // These versions are never returned and this code is effectively dead
                 break;
+            default:
+                throw new IOException("Invalid payload version in snapshot");
         }
 
         // Not included as default in above switch to ensure we get warnings when new versions are added
         }
 
         // Not included as default in above switch to ensure we get warnings when new versions are added
@@ -60,14 +63,16 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
      *
      * @return The root node.
      */
      *
      * @return The root node.
      */
-    abstract @Nonnull NormalizedNode<?, ?> rootNode();
+    @Nonnull
+    abstract NormalizedNode<?, ?> rootNode();
 
     /**
      * Return the snapshot payload version. Implementations of this method should return a constant.
      *
      * @return Snapshot payload version
      */
 
     /**
      * Return the snapshot payload version. Implementations of this method should return a constant.
      *
      * @return Snapshot payload version
      */
-    abstract @Nonnull PayloadVersion version();
+    @Nonnull
+    abstract PayloadVersion version();
 
     private void versionedSerialize(final DataOutputStream dos, final PayloadVersion version) throws IOException {
         switch (version) {
 
     private void versionedSerialize(final DataOutputStream dos, final PayloadVersion version) throws IOException {
         switch (version) {
@@ -80,7 +85,8 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
             case TEST_FUTURE_VERSION:
             case TEST_PAST_VERSION:
                 break;
             case TEST_FUTURE_VERSION:
             case TEST_PAST_VERSION:
                 break;
-
+            default:
+                throw new IOException("Invalid payload version in snapshot");
         }
 
         throw new IOException("Encountered unhandled version" + version);
         }
 
         throw new IOException("Encountered unhandled version" + version);
index c348727cf89f4136a8e00ec1719621a1154e5d9c..080ecfbe4a19f29601717782270c440749969b5c 100644 (file)
@@ -35,6 +35,9 @@ public final class CommitTransactionPayload extends Payload implements Serializa
         private static final long serialVersionUID = 1L;
         private byte[] serialized;
 
         private static final long serialVersionUID = 1L;
         private byte[] serialized;
 
+        // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+        // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+        @SuppressWarnings("checkstyle:RedundantModifier")
         public Proxy() {
             // For Externalizable
         }
         public Proxy() {
             // For Externalizable
         }
index 9d0153f6b7bfb5381de72586b8ee9708615da8b4..b765cabc7e418bd58f930e84788d446978f16d19 100644 (file)
@@ -80,20 +80,20 @@ public final class DataTreeCandidateInputOutput {
     private static DataTreeCandidateNode readNode(final NormalizedNodeDataInput in) throws IOException {
         final byte type = in.readByte();
         switch (type) {
     private static DataTreeCandidateNode readNode(final NormalizedNodeDataInput in) throws IOException {
         final byte type = in.readByte();
         switch (type) {
-        case APPEARED:
-            return readModifiedNode(ModificationType.APPEARED, in);
-        case DELETE:
-            return DeletedDataTreeCandidateNode.create(in.readPathArgument());
-        case DISAPPEARED:
-            return readModifiedNode(ModificationType.DISAPPEARED, in);
-        case SUBTREE_MODIFIED:
-            return readModifiedNode(ModificationType.SUBTREE_MODIFIED, in);
-        case UNMODIFIED:
-            return null;
-        case WRITE:
-            return DataTreeCandidateNodes.fromNormalizedNode(in.readNormalizedNode());
-        default:
-            throw new IllegalArgumentException("Unhandled node type " + type);
+            case APPEARED:
+                return readModifiedNode(ModificationType.APPEARED, in);
+            case DELETE:
+                return DeletedDataTreeCandidateNode.create(in.readPathArgument());
+            case DISAPPEARED:
+                return readModifiedNode(ModificationType.DISAPPEARED, in);
+            case SUBTREE_MODIFIED:
+                return readModifiedNode(ModificationType.SUBTREE_MODIFIED, in);
+            case UNMODIFIED:
+                return null;
+            case WRITE:
+                return DataTreeCandidateNodes.fromNormalizedNode(in.readNormalizedNode());
+            default:
+                throw new IllegalArgumentException("Unhandled node type " + type);
         }
     }
 
         }
     }
 
@@ -104,17 +104,17 @@ public final class DataTreeCandidateInputOutput {
 
         final DataTreeCandidateNode rootNode;
         switch (type) {
 
         final DataTreeCandidateNode rootNode;
         switch (type) {
-        case DELETE:
-            rootNode = DeletedDataTreeCandidateNode.create();
-            break;
-        case SUBTREE_MODIFIED:
-            rootNode = ModifiedDataTreeCandidateNode.create(readChildren(reader));
-            break;
-        case WRITE:
-            rootNode = DataTreeCandidateNodes.fromNormalizedNode(reader.readNormalizedNode());
-            break;
-        default:
-            throw new IllegalArgumentException("Unhandled node type " + type);
+            case DELETE:
+                rootNode = DeletedDataTreeCandidateNode.create();
+                break;
+            case SUBTREE_MODIFIED:
+                rootNode = ModifiedDataTreeCandidateNode.create(readChildren(reader));
+                break;
+            case WRITE:
+                rootNode = DataTreeCandidateNodes.fromNormalizedNode(reader.readNormalizedNode());
+                break;
+            default:
+                throw new IllegalArgumentException("Unhandled node type " + type);
         }
 
         return DataTreeCandidates.newDataTreeCandidate(rootPath, rootNode);
         }
 
         return DataTreeCandidates.newDataTreeCandidate(rootPath, rootNode);
@@ -132,67 +132,67 @@ public final class DataTreeCandidateInputOutput {
     private static void writeNode(final NormalizedNodeDataOutput out, final DataTreeCandidateNode node)
             throws IOException {
         switch (node.getModificationType()) {
     private static void writeNode(final NormalizedNodeDataOutput out, final DataTreeCandidateNode node)
             throws IOException {
         switch (node.getModificationType()) {
-        case APPEARED:
-            out.writeByte(APPEARED);
-            out.writePathArgument(node.getIdentifier());
-            writeChildren(out, node.getChildNodes());
-            break;
-        case DELETE:
-            out.writeByte(DELETE);
-            out.writePathArgument(node.getIdentifier());
-            break;
-        case DISAPPEARED:
-            out.writeByte(DISAPPEARED);
-            out.writePathArgument(node.getIdentifier());
-            writeChildren(out, node.getChildNodes());
-            break;
-        case SUBTREE_MODIFIED:
-            out.writeByte(SUBTREE_MODIFIED);
-            out.writePathArgument(node.getIdentifier());
-            writeChildren(out, node.getChildNodes());
-            break;
-        case WRITE:
-            out.writeByte(WRITE);
-            out.writeNormalizedNode(node.getDataAfter().get());
-            break;
-        case UNMODIFIED:
-            out.writeByte(UNMODIFIED);
-            break;
-        default:
-            throw new IllegalArgumentException("Unhandled node type " + node.getModificationType());
-        }
-    }
-
-    public static void writeDataTreeCandidate(final DataOutput out, DataTreeCandidate candidate) throws IOException {
-        try (final NormalizedNodeDataOutput writer = NormalizedNodeInputOutput.newDataOutput(out)) {
-            writer.writeYangInstanceIdentifier(candidate.getRootPath());
-
-            final DataTreeCandidateNode node = candidate.getRootNode();
-            switch (node.getModificationType()) {
             case APPEARED:
             case APPEARED:
-                writer.writeByte(APPEARED);
-                writeChildren(writer, node.getChildNodes());
+                out.writeByte(APPEARED);
+                out.writePathArgument(node.getIdentifier());
+                writeChildren(out, node.getChildNodes());
                 break;
             case DELETE:
                 break;
             case DELETE:
-                writer.writeByte(DELETE);
+                out.writeByte(DELETE);
+                out.writePathArgument(node.getIdentifier());
                 break;
             case DISAPPEARED:
                 break;
             case DISAPPEARED:
-                writer.writeByte(DISAPPEARED);
-                writeChildren(writer, node.getChildNodes());
+                out.writeByte(DISAPPEARED);
+                out.writePathArgument(node.getIdentifier());
+                writeChildren(out, node.getChildNodes());
                 break;
             case SUBTREE_MODIFIED:
                 break;
             case SUBTREE_MODIFIED:
-                writer.writeByte(SUBTREE_MODIFIED);
-                writeChildren(writer, node.getChildNodes());
-                break;
-            case UNMODIFIED:
-                writer.writeByte(UNMODIFIED);
+                out.writeByte(SUBTREE_MODIFIED);
+                out.writePathArgument(node.getIdentifier());
+                writeChildren(out, node.getChildNodes());
                 break;
             case WRITE:
                 break;
             case WRITE:
-                writer.writeByte(WRITE);
-                writer.writeNormalizedNode(node.getDataAfter().get());
+                out.writeByte(WRITE);
+                out.writeNormalizedNode(node.getDataAfter().get());
+                break;
+            case UNMODIFIED:
+                out.writeByte(UNMODIFIED);
                 break;
             default:
                 throw new IllegalArgumentException("Unhandled node type " + node.getModificationType());
                 break;
             default:
                 throw new IllegalArgumentException("Unhandled node type " + node.getModificationType());
+        }
+    }
+
+    public static void writeDataTreeCandidate(final DataOutput out, DataTreeCandidate candidate) throws IOException {
+        try (final NormalizedNodeDataOutput writer = NormalizedNodeInputOutput.newDataOutput(out)) {
+            writer.writeYangInstanceIdentifier(candidate.getRootPath());
+
+            final DataTreeCandidateNode node = candidate.getRootNode();
+            switch (node.getModificationType()) {
+                case APPEARED:
+                    writer.writeByte(APPEARED);
+                    writeChildren(writer, node.getChildNodes());
+                    break;
+                case DELETE:
+                    writer.writeByte(DELETE);
+                    break;
+                case DISAPPEARED:
+                    writer.writeByte(DISAPPEARED);
+                    writeChildren(writer, node.getChildNodes());
+                    break;
+                case SUBTREE_MODIFIED:
+                    writer.writeByte(SUBTREE_MODIFIED);
+                    writeChildren(writer, node.getChildNodes());
+                    break;
+                case UNMODIFIED:
+                    writer.writeByte(UNMODIFIED);
+                    break;
+                case WRITE:
+                    writer.writeByte(WRITE);
+                    writer.writeNormalizedNode(node.getDataAfter().get());
+                    break;
+                default:
+                    throw new IllegalArgumentException("Unhandled node type " + node.getModificationType());
             }
         }
     }
             }
         }
     }
index 14397794ede923e8c75316cb1209ab88b0b10594..085a8457d1503af6b6f92f34eb6d645bb61afc67 100644 (file)
@@ -34,7 +34,7 @@ abstract class DeletedDataTreeCandidateNode extends AbstractDataTreeCandidateNod
     static DataTreeCandidateNode create(final PathArgument identifier) {
         return new DeletedDataTreeCandidateNode() {
             @Override
     static DataTreeCandidateNode create(final PathArgument identifier) {
         return new DeletedDataTreeCandidateNode() {
             @Override
-            public final PathArgument getIdentifier() {
+            public PathArgument getIdentifier() {
                 return identifier;
             }
         };
                 return identifier;
             }
         };
index 55d97573715748b8324305679e2b31eb889f40b0..4ad82602b1ae8339b9380c78b5fa4f1ad945572e 100644 (file)
@@ -25,6 +25,9 @@ public final class FrontendShardDataTreeSnapshotMetadata extends
 
         private List<FrontendClientMetadata> clients;
 
 
         private List<FrontendClientMetadata> clients;
 
+        // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+        // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+        @SuppressWarnings("checkstyle:RedundantModifier")
         public Proxy() {
             // For Externalizable
         }
         public Proxy() {
             // For Externalizable
         }
index 8cde0d953287691b440d10476ecbe6e801710383..36a82e543e6d1ffb969660c6cc12587feaab295b 100644 (file)
@@ -29,7 +29,8 @@ import org.slf4j.LoggerFactory;
  * @author Robert Varga
  */
 @Beta
  * @author Robert Varga
  */
 @Beta
-public final class MetadataShardDataTreeSnapshot extends AbstractVersionedShardDataTreeSnapshot implements Serializable {
+public final class MetadataShardDataTreeSnapshot extends AbstractVersionedShardDataTreeSnapshot
+        implements Serializable {
     private static final class Proxy implements Externalizable {
         private static final long serialVersionUID = 1L;
         private static final Logger LOG = LoggerFactory.getLogger(MetadataShardDataTreeSnapshot.class);
     private static final class Proxy implements Externalizable {
         private static final long serialVersionUID = 1L;
         private static final Logger LOG = LoggerFactory.getLogger(MetadataShardDataTreeSnapshot.class);
@@ -37,6 +38,9 @@ public final class MetadataShardDataTreeSnapshot extends AbstractVersionedShardD
         private Map<Class<? extends ShardDataTreeSnapshotMetadata<?>>, ShardDataTreeSnapshotMetadata<?>> metadata;
         private NormalizedNode<?, ?> rootNode;
 
         private Map<Class<? extends ShardDataTreeSnapshotMetadata<?>>, ShardDataTreeSnapshotMetadata<?>> metadata;
         private NormalizedNode<?, ?> rootNode;
 
+        // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+        // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+        @SuppressWarnings("checkstyle:RedundantModifier")
         public Proxy() {
             // For Externalizable
         }
         public Proxy() {
             // For Externalizable
         }
@@ -62,8 +66,8 @@ public final class MetadataShardDataTreeSnapshot extends AbstractVersionedShardD
             Preconditions.checkArgument(metaSize >= 0, "Invalid negative metadata map length %s", metaSize);
 
             // Default pre-allocate is 4, which should be fine
             Preconditions.checkArgument(metaSize >= 0, "Invalid negative metadata map length %s", metaSize);
 
             // Default pre-allocate is 4, which should be fine
-            final Builder<Class<? extends ShardDataTreeSnapshotMetadata<?>>, ShardDataTreeSnapshotMetadata<?>> metaBuilder =
-                    ImmutableMap.builder();
+            final Builder<Class<? extends ShardDataTreeSnapshotMetadata<?>>, ShardDataTreeSnapshotMetadata<?>>
+                    metaBuilder = ImmutableMap.builder();
             for (int i = 0; i < metaSize; ++i) {
                 final ShardDataTreeSnapshotMetadata<?> m = (ShardDataTreeSnapshotMetadata<?>) in.readObject();
                 if (m != null) {
             for (int i = 0; i < metaSize; ++i) {
                 final ShardDataTreeSnapshotMetadata<?> m = (ShardDataTreeSnapshotMetadata<?>) in.readObject();
                 if (m != null) {
index 59d03d465e203cee23ef4cf3f06717cbbd35dd2b..c319286bf7ca01da44a8c1528f91a4c5a7c6dd0b 100644 (file)
@@ -22,7 +22,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 abstract class ModifiedDataTreeCandidateNode extends AbstractDataTreeCandidateNode {
     private final Collection<DataTreeCandidateNode> children;
 
 abstract class ModifiedDataTreeCandidateNode extends AbstractDataTreeCandidateNode {
     private final Collection<DataTreeCandidateNode> children;
 
-    private ModifiedDataTreeCandidateNode(final ModificationType type, final Collection<DataTreeCandidateNode> children) {
+    private ModifiedDataTreeCandidateNode(final ModificationType type,
+            final Collection<DataTreeCandidateNode> children) {
         super(type);
         this.children = Preconditions.checkNotNull(children);
     }
         super(type);
         this.children = Preconditions.checkNotNull(children);
     }
@@ -36,10 +37,11 @@ abstract class ModifiedDataTreeCandidateNode extends AbstractDataTreeCandidateNo
         };
     }
 
         };
     }
 
-    static DataTreeCandidateNode create(final PathArgument identifier, final ModificationType type, final Collection<DataTreeCandidateNode> children) {
+    static DataTreeCandidateNode create(final PathArgument identifier, final ModificationType type,
+            final Collection<DataTreeCandidateNode> children) {
         return new ModifiedDataTreeCandidateNode(type, children) {
             @Override
         return new ModifiedDataTreeCandidateNode(type, children) {
             @Override
-            public final PathArgument getIdentifier() {
+            public PathArgument getIdentifier() {
                 return identifier;
             }
         };
                 return identifier;
             }
         };
index 051a375cd66f3f506ce83955620c2fbaafb6d9ca..0f52dacc5b8bbbf3dfcc0d8eafb0aeb5ec7dade6 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.yangtools.concepts.WritableObject;
  * whenever:
  * - a new event is defined
  * - serialization format is changed
  * whenever:
  * - a new event is defined
  * - serialization format is changed
- *
+ * <p/>
  * This version effectively defines the protocol version between actors participating on a particular shard. A shard
  * participant instance should oppose RAFT candidates which produce persistence of an unsupported version. If a follower
  * encounters an unsupported version it must not become fully-operational, as it does not have an accurate view
  * This version effectively defines the protocol version between actors participating on a particular shard. A shard
  * participant instance should oppose RAFT candidates which produce persistence of an unsupported version. If a follower
  * encounters an unsupported version it must not become fully-operational, as it does not have an accurate view
@@ -73,7 +73,8 @@ public enum PayloadVersion implements WritableObject {
      *
      * @return Current {@link PayloadVersion}
      */
      *
      * @return Current {@link PayloadVersion}
      */
-    public static @Nonnull PayloadVersion current() {
+    @Nonnull
+    public static PayloadVersion current() {
         return BORON;
     }
 
         return BORON;
     }
 
@@ -81,23 +82,24 @@ public enum PayloadVersion implements WritableObject {
      * Return the {@link PayloadVersion} corresponding to an unsigned short integer. This method is provided for callers
      * which provide their own recovery strategy in case of version incompatibility.
      *
      * Return the {@link PayloadVersion} corresponding to an unsigned short integer. This method is provided for callers
      * which provide their own recovery strategy in case of version incompatibility.
      *
-     * @param s Short integer as returned from {@link #shortValue()}
+     * @param version Short integer as returned from {@link #shortValue()}
      * @return {@link PayloadVersion}
      * @throws FutureVersionException if the specified integer identifies a future version
      * @throws PastVersionException if the specified integer identifies a past version which is no longer supported
      */
      * @return {@link PayloadVersion}
      * @throws FutureVersionException if the specified integer identifies a future version
      * @throws PastVersionException if the specified integer identifies a past version which is no longer supported
      */
-    public static @Nonnull PayloadVersion valueOf(final short s) throws FutureVersionException, PastVersionException {
-        switch (Short.toUnsignedInt(s)) {
+    @Nonnull
+    public static PayloadVersion valueOf(final short version) throws FutureVersionException, PastVersionException {
+        switch (Short.toUnsignedInt(version)) {
             case 0:
             case 1:
             case 2:
             case 3:
             case 4:
             case 0:
             case 1:
             case 2:
             case 3:
             case 4:
-                throw new PastVersionException(s, BORON);
+                throw new PastVersionException(version, BORON);
             case 5:
                 return BORON;
             default:
             case 5:
                 return BORON;
             default:
-                throw new FutureVersionException(s, BORON);
+                throw new FutureVersionException(version, BORON);
         }
     }
 
         }
     }
 
@@ -114,7 +116,8 @@ public enum PayloadVersion implements WritableObject {
      * @return An {@link PayloadVersion}
      * @throws IOException If read fails or an unsupported version is encountered
      */
      * @return An {@link PayloadVersion}
      * @throws IOException If read fails or an unsupported version is encountered
      */
-    public static @Nonnull PayloadVersion readFrom(final @Nonnull DataInput in) throws IOException {
+    @Nonnull
+    public static PayloadVersion readFrom(@Nonnull final DataInput in) throws IOException {
         final short s = in.readShort();
         try {
             return valueOf(s);
         final short s = in.readShort();
         try {
             return valueOf(s);
index 7941c9fa599a5ffee00321564b635e56b68be520..f883a8d358f091385b0096ee35b6ab5eabe44688 100644 (file)
@@ -16,17 +16,18 @@ import javax.annotation.Nonnull;
  * Base class for various bits of metadata attached to a {@link MetadataShardDataTreeSnapshot}. This class is not
  * an interface because we want to make sure all subclasses implement the externalizable proxy pattern, for which
  * we need to force {@link #readResolve()} to be abstract.
  * Base class for various bits of metadata attached to a {@link MetadataShardDataTreeSnapshot}. This class is not
  * an interface because we want to make sure all subclasses implement the externalizable proxy pattern, for which
  * we need to force {@link #readResolve()} to be abstract.
- *
+ * <p/>
  * All concrete subclasses of this class should be final so as to form a distinct set of possible metadata. Since
  * metadata is serialized along with {@link MetadataShardDataTreeSnapshot}, this set is part of the serialization format
  * guarded by {@link PayloadVersion}.
  * All concrete subclasses of this class should be final so as to form a distinct set of possible metadata. Since
  * metadata is serialized along with {@link MetadataShardDataTreeSnapshot}, this set is part of the serialization format
  * guarded by {@link PayloadVersion}.
- *
+ * <p/>
  * If a new metadata type is introduced or a type is removed, {@link PayloadVersion} needs to be bumped to ensure
  * compatibility.
  *
  * @author Robert Varga
  */
  * If a new metadata type is introduced or a type is removed, {@link PayloadVersion} needs to be bumped to ensure
  * compatibility.
  *
  * @author Robert Varga
  */
-public abstract class ShardDataTreeSnapshotMetadata<T extends ShardDataTreeSnapshotMetadata<T>> implements Serializable {
+public abstract class ShardDataTreeSnapshotMetadata<T extends ShardDataTreeSnapshotMetadata<T>>
+        implements Serializable {
     private static final long serialVersionUID = 1L;
 
     ShardDataTreeSnapshotMetadata() {
     private static final long serialVersionUID = 1L;
 
     ShardDataTreeSnapshotMetadata() {
@@ -38,7 +39,7 @@ public abstract class ShardDataTreeSnapshotMetadata<T extends ShardDataTreeSnaps
     }
 
     /**
     }
 
     /**
-     * Return an Externalizable proxy
+     * Return an Externalizable proxy.
      *
      * @return Externalizable proxy, may not be null
      */
      *
      * @return Externalizable proxy, may not be null
      */
index b236a05e05f2acab37f1e2588878d4bec949d91f..9ee1820abcf4e5916d83e45f156a72cb21e4ee71 100644 (file)
@@ -42,9 +42,9 @@ public abstract class AbstractShardManagerCreator<T extends AbstractShardManager
         return cluster;
     }
 
         return cluster;
     }
 
-    public T cluster(ClusterWrapper cluster) {
+    public T cluster(ClusterWrapper newCluster) {
         checkSealed();
         checkSealed();
-        this.cluster = cluster;
+        this.cluster = newCluster;
         return self();
     }
 
         return self();
     }
 
@@ -52,9 +52,9 @@ public abstract class AbstractShardManagerCreator<T extends AbstractShardManager
         return configuration;
     }
 
         return configuration;
     }
 
-    public T configuration(Configuration configuration) {
+    public T configuration(Configuration newConfiguration) {
         checkSealed();
         checkSealed();
-        this.configuration = configuration;
+        this.configuration = newConfiguration;
         return self();
     }
 
         return self();
     }
 
@@ -62,9 +62,9 @@ public abstract class AbstractShardManagerCreator<T extends AbstractShardManager
         return datastoreContextFactory;
     }
 
         return datastoreContextFactory;
     }
 
-    public T datastoreContextFactory(DatastoreContextFactory datastoreContextFactory) {
+    public T datastoreContextFactory(DatastoreContextFactory newDatastoreContextFactory) {
         checkSealed();
         checkSealed();
-        this.datastoreContextFactory = datastoreContextFactory;
+        this.datastoreContextFactory = newDatastoreContextFactory;
         return self();
     }
 
         return self();
     }
 
@@ -72,9 +72,9 @@ public abstract class AbstractShardManagerCreator<T extends AbstractShardManager
         return waitTillReadyCountdownLatch;
     }
 
         return waitTillReadyCountdownLatch;
     }
 
-    public T waitTillReadyCountdownLatch(CountDownLatch waitTillReadyCountdownLatch) {
+    public T waitTillReadyCountdownLatch(CountDownLatch newWaitTillReadyCountdownLatch) {
         checkSealed();
         checkSealed();
-        this.waitTillReadyCountdownLatch = waitTillReadyCountdownLatch;
+        this.waitTillReadyCountdownLatch = newWaitTillReadyCountdownLatch;
         return self();
     }
 
         return self();
     }
 
@@ -82,9 +82,9 @@ public abstract class AbstractShardManagerCreator<T extends AbstractShardManager
         return primaryShardInfoCache;
     }
 
         return primaryShardInfoCache;
     }
 
-    public T primaryShardInfoCache(PrimaryShardInfoFutureCache primaryShardInfoCache) {
+    public T primaryShardInfoCache(PrimaryShardInfoFutureCache newPrimaryShardInfoCache) {
         checkSealed();
         checkSealed();
-        this.primaryShardInfoCache = primaryShardInfoCache;
+        this.primaryShardInfoCache = newPrimaryShardInfoCache;
         return self();
     }
 
         return self();
     }
 
@@ -92,9 +92,9 @@ public abstract class AbstractShardManagerCreator<T extends AbstractShardManager
         return restoreFromSnapshot;
     }
 
         return restoreFromSnapshot;
     }
 
-    public T restoreFromSnapshot(DatastoreSnapshot restoreFromSnapshot) {
+    public T restoreFromSnapshot(DatastoreSnapshot newRestoreFromSnapshot) {
         checkSealed();
         checkSealed();
-        this.restoreFromSnapshot = restoreFromSnapshot;
+        this.restoreFromSnapshot = newRestoreFromSnapshot;
         return self();
     }
 
         return self();
     }
 
@@ -111,4 +111,4 @@ public abstract class AbstractShardManagerCreator<T extends AbstractShardManager
         verify();
         return Props.create(ShardManager.class, this);
     }
         verify();
         return Props.create(ShardManager.class, this);
     }
-}
\ No newline at end of file
+}
index 1ee161df01c9c6b8443a8c564fcf81e8bdced702..a487ff1564e9cd2b892a928b10edc82948e87010 100644 (file)
@@ -72,8 +72,8 @@ final class ShardInformation {
 
     Props newProps(SchemaContext schemaContext) {
         Preconditions.checkNotNull(builder);
 
     Props newProps(SchemaContext schemaContext) {
         Preconditions.checkNotNull(builder);
-        Props props = builder.id(shardId).peerAddresses(initialPeerAddresses).datastoreContext(datastoreContext).
-                schemaContext(schemaContext).props();
+        Props props = builder.id(shardId).peerAddresses(initialPeerAddresses).datastoreContext(datastoreContext)
+                .schemaContext(schemaContext).props();
         builder = null;
         return props;
     }
         builder = null;
         return props;
     }
@@ -83,7 +83,7 @@ final class ShardInformation {
     }
 
     @Nullable
     }
 
     @Nullable
-    ActorRef getActor(){
+    ActorRef getActor() {
         return actor;
     }
 
         return actor;
     }
 
@@ -115,14 +115,12 @@ final class ShardInformation {
         }
     }
 
         }
     }
 
-    void updatePeerAddress(String peerId, String peerAddress, ActorRef sender){
+    void updatePeerAddress(String peerId, String peerAddress, ActorRef sender) {
         LOG.info("updatePeerAddress for peer {} with address {}", peerId, peerAddress);
 
         LOG.info("updatePeerAddress for peer {} with address {}", peerId, peerAddress);
 
-        if(actor != null) {
-            if(LOG.isDebugEnabled()) {
-                LOG.debug("Sending PeerAddressResolved for peer {} with address {} to {}",
-                        peerId, peerAddress, actor.path());
-            }
+        if (actor != null) {
+            LOG.debug("Sending PeerAddressResolved for peer {} with address {} to {}", peerId,
+                    peerAddress, actor.path());
 
             actor.tell(new PeerAddressResolved(peerId, peerAddress), sender);
         }
 
             actor.tell(new PeerAddressResolved(peerId, peerAddress), sender);
         }
@@ -131,13 +129,13 @@ final class ShardInformation {
     }
 
     void peerDown(MemberName memberName, String peerId, ActorRef sender) {
     }
 
     void peerDown(MemberName memberName, String peerId, ActorRef sender) {
-        if(actor != null) {
+        if (actor != null) {
             actor.tell(new PeerDown(memberName, peerId), sender);
         }
     }
 
     void peerUp(MemberName memberName, String peerId, ActorRef sender) {
             actor.tell(new PeerDown(memberName, peerId), sender);
         }
     }
 
     void peerUp(MemberName memberName, String peerId, ActorRef sender) {
-        if(actor != null) {
+        if (actor != null) {
             actor.tell(new PeerUp(memberName, peerId), sender);
         }
     }
             actor.tell(new PeerUp(memberName, peerId), sender);
         }
     }
@@ -147,9 +145,9 @@ final class ShardInformation {
     }
 
     boolean isShardReadyWithLeaderId() {
     }
 
     boolean isShardReadyWithLeaderId() {
-        return leaderAvailable && isShardReady() && !RaftState.IsolatedLeader.name().equals(role) &&
-                !RaftState.PreLeader.name().equals(role) &&
-                    (isLeader() || addressResolver.resolve(leaderId) != null);
+        return leaderAvailable && isShardReady() && !RaftState.IsolatedLeader.name().equals(role)
+                && !RaftState.PreLeader.name().equals(role)
+                && (isLeader() || addressResolver.resolve(leaderId) != null);
     }
 
     boolean isShardInitialized() {
     }
 
     boolean isShardInitialized() {
@@ -161,7 +159,7 @@ final class ShardInformation {
     }
 
     String getSerializedLeaderActor() {
     }
 
     String getSerializedLeaderActor() {
-        if(isLeader()) {
+        if (isLeader()) {
             return Serialization.serializedActorPath(getActor());
         } else {
             return addressResolver.resolve(leaderId);
             return Serialization.serializedActorPath(getActor());
         } else {
             return addressResolver.resolve(leaderId);
@@ -177,7 +175,7 @@ final class ShardInformation {
     }
 
     private void notifyOnShardInitializedCallbacks() {
     }
 
     private void notifyOnShardInitializedCallbacks() {
-        if(onShardInitializedSet.isEmpty()) {
+        if (onShardInitializedSet.isEmpty()) {
             return;
         }
 
             return;
         }
 
@@ -187,7 +185,7 @@ final class ShardInformation {
             ready ? "ready" : "initialized", onShardInitializedSet.size());
 
         Iterator<OnShardInitialized> iter = onShardInitializedSet.iterator();
             ready ? "ready" : "initialized", onShardInitializedSet.size());
 
         Iterator<OnShardInitialized> iter = onShardInitializedSet.iterator();
-        while(iter.hasNext()) {
+        while (iter.hasNext()) {
             OnShardInitialized onShardInitialized = iter.next();
             if (!(onShardInitialized instanceof OnShardReady) || ready) {
                 iter.remove();
             OnShardInitialized onShardInitialized = iter.next();
             if (!(onShardInitialized instanceof OnShardReady) || ready) {
                 iter.remove();
@@ -211,14 +209,14 @@ final class ShardInformation {
         notifyOnShardInitializedCallbacks();
     }
 
         notifyOnShardInitializedCallbacks();
     }
 
-    void setFollowerSyncStatus(boolean syncStatus){
+    void setFollowerSyncStatus(boolean syncStatus) {
         this.followerSyncStatus = syncStatus;
     }
 
         this.followerSyncStatus = syncStatus;
     }
 
-    boolean isInSync(){
-        if(RaftState.Follower.name().equals(this.role)){
+    boolean isInSync() {
+        if (RaftState.Follower.name().equals(this.role)) {
             return followerSyncStatus;
             return followerSyncStatus;
-        } else if(RaftState.Leader.name().equals(this.role)){
+        } else if (RaftState.Leader.name().equals(this.role)) {
             return true;
         }
 
             return true;
         }
 
@@ -226,9 +224,9 @@ final class ShardInformation {
     }
 
     boolean setLeaderId(String leaderId) {
     }
 
     boolean setLeaderId(String leaderId) {
-        boolean changed = !Objects.equals(this.leaderId, leaderId);
+        final boolean changed = !Objects.equals(this.leaderId, leaderId);
         this.leaderId = leaderId;
         this.leaderId = leaderId;
-        if(leaderId != null) {
+        if (leaderId != null) {
             this.leaderAvailable = true;
         }
         notifyOnShardInitializedCallbacks();
             this.leaderAvailable = true;
         }
         notifyOnShardInitializedCallbacks();
@@ -243,7 +241,7 @@ final class ShardInformation {
     void setLeaderAvailable(boolean leaderAvailable) {
         this.leaderAvailable = leaderAvailable;
 
     void setLeaderAvailable(boolean leaderAvailable) {
         this.leaderAvailable = leaderAvailable;
 
-        if(leaderAvailable) {
+        if (leaderAvailable) {
             notifyOnShardInitializedCallbacks();
         }
     }
             notifyOnShardInitializedCallbacks();
         }
     }
@@ -263,4 +261,4 @@ final class ShardInformation {
     void setActiveMember(boolean isActiveMember) {
         this.isActiveMember = isActiveMember;
     }
     void setActiveMember(boolean isActiveMember) {
         this.isActiveMember = isActiveMember;
     }
-}
\ No newline at end of file
+}
index bbb598596070bfe2cc0a3a115bc2c1fe14b2d614..7653aea3fb814b2c69e36684800902df013aab72 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.cluster.datastore.shardmanager;
 
 import static akka.pattern.Patterns.ask;
 package org.opendaylight.controller.cluster.datastore.shardmanager;
 
 import static akka.pattern.Patterns.ask;
+
 import akka.actor.ActorRef;
 import akka.actor.Address;
 import akka.actor.Cancellable;
 import akka.actor.ActorRef;
 import akka.actor.Address;
 import akka.actor.Cancellable;
@@ -106,16 +107,15 @@ import scala.concurrent.duration.Duration;
 import scala.concurrent.duration.FiniteDuration;
 
 /**
 import scala.concurrent.duration.FiniteDuration;
 
 /**
- * The ShardManager has the following jobs,
+ * Manages the shards for a data store. The ShardManager has the following jobs:
  * <ul>
  * <li> Create all the local shard replicas that belong on this cluster member
  * <li> Find the address of the local shard
  * <li> Find the primary replica for any given shard
  * <li> Monitor the cluster members and store their addresses
  * <ul>
  * <li> Create all the local shard replicas that belong on this cluster member
  * <li> Find the address of the local shard
  * <li> Find the primary replica for any given shard
  * <li> Monitor the cluster members and store their addresses
- * <ul>
+ * </ul>
  */
 class ShardManager extends AbstractUntypedPersistentActorWithMetering {
  */
 class ShardManager extends AbstractUntypedPersistentActorWithMetering {
-
     private static final Logger LOG = LoggerFactory.getLogger(ShardManager.class);
 
     // Stores a mapping between a shard name and it's corresponding information
     private static final Logger LOG = LoggerFactory.getLogger(ShardManager.class);
 
     // Stores a mapping between a shard name and it's corresponding information
@@ -133,7 +133,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
     private final String shardDispatcherPath;
 
 
     private final String shardDispatcherPath;
 
-    private final ShardManagerInfo mBean;
+    private final ShardManagerInfo shardManagerMBean;
 
     private DatastoreContextFactory datastoreContextFactory;
 
 
     private DatastoreContextFactory datastoreContextFactory;
 
@@ -172,85 +172,85 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         // Subscribe this actor to cluster member events
         cluster.subscribeToMemberEvents(getSelf());
 
         // Subscribe this actor to cluster member events
         cluster.subscribeToMemberEvents(getSelf());
 
-        mBean = new ShardManagerInfo(getSelf(), cluster.getCurrentMemberName(), "shard-manager-" + this.type,
+        shardManagerMBean = new ShardManagerInfo(getSelf(), cluster.getCurrentMemberName(),
+                "shard-manager-" + this.type,
                 datastoreContextFactory.getBaseDatastoreContext().getDataStoreMXBeanType());
                 datastoreContextFactory.getBaseDatastoreContext().getDataStoreMXBeanType());
-        mBean.registerMBean();
+        shardManagerMBean.registerMBean();
     }
 
     @Override
     public void postStop() {
         LOG.info("Stopping ShardManager {}", persistenceId());
 
     }
 
     @Override
     public void postStop() {
         LOG.info("Stopping ShardManager {}", persistenceId());
 
-        mBean.unregisterMBean();
+        shardManagerMBean.unregisterMBean();
     }
 
     @Override
     public void handleCommand(Object message) throws Exception {
         if (message  instanceof FindPrimary) {
             findPrimary((FindPrimary)message);
     }
 
     @Override
     public void handleCommand(Object message) throws Exception {
         if (message  instanceof FindPrimary) {
             findPrimary((FindPrimary)message);
-        } else if(message instanceof FindLocalShard){
+        } else if (message instanceof FindLocalShard) {
             findLocalShard((FindLocalShard) message);
         } else if (message instanceof UpdateSchemaContext) {
             updateSchemaContext(message);
             findLocalShard((FindLocalShard) message);
         } else if (message instanceof UpdateSchemaContext) {
             updateSchemaContext(message);
-        } else if(message instanceof ActorInitialized) {
+        } else if (message instanceof ActorInitialized) {
             onActorInitialized(message);
             onActorInitialized(message);
-        } else if (message instanceof ClusterEvent.MemberUp){
+        } else if (message instanceof ClusterEvent.MemberUp) {
             memberUp((ClusterEvent.MemberUp) message);
             memberUp((ClusterEvent.MemberUp) message);
-        } else if (message instanceof ClusterEvent.MemberWeaklyUp){
+        } else if (message instanceof ClusterEvent.MemberWeaklyUp) {
             memberWeaklyUp((ClusterEvent.MemberWeaklyUp) message);
             memberWeaklyUp((ClusterEvent.MemberWeaklyUp) message);
-        } else if (message instanceof ClusterEvent.MemberExited){
+        } else if (message instanceof ClusterEvent.MemberExited) {
             memberExited((ClusterEvent.MemberExited) message);
             memberExited((ClusterEvent.MemberExited) message);
-        } else if(message instanceof ClusterEvent.MemberRemoved) {
+        } else if (message instanceof ClusterEvent.MemberRemoved) {
             memberRemoved((ClusterEvent.MemberRemoved) message);
             memberRemoved((ClusterEvent.MemberRemoved) message);
-        } else if(message instanceof ClusterEvent.UnreachableMember) {
-            memberUnreachable((ClusterEvent.UnreachableMember)message);
-        } else if(message instanceof ClusterEvent.ReachableMember) {
+        } else if (message instanceof ClusterEvent.UnreachableMember) {
+            memberUnreachable((ClusterEvent.UnreachableMember) message);
+        } else if (message instanceof ClusterEvent.ReachableMember) {
             memberReachable((ClusterEvent.ReachableMember) message);
             memberReachable((ClusterEvent.ReachableMember) message);
-        } else if(message instanceof DatastoreContextFactory) {
-            onDatastoreContextFactory((DatastoreContextFactory)message);
-        } else if(message instanceof RoleChangeNotification) {
+        } else if (message instanceof DatastoreContextFactory) {
+            onDatastoreContextFactory((DatastoreContextFactory) message);
+        } else if (message instanceof RoleChangeNotification) {
             onRoleChangeNotification((RoleChangeNotification) message);
             onRoleChangeNotification((RoleChangeNotification) message);
-        } else if(message instanceof FollowerInitialSyncUpStatus){
+        } else if (message instanceof FollowerInitialSyncUpStatus) {
             onFollowerInitialSyncStatus((FollowerInitialSyncUpStatus) message);
             onFollowerInitialSyncStatus((FollowerInitialSyncUpStatus) message);
-        } else if(message instanceof ShardNotInitializedTimeout) {
-            onShardNotInitializedTimeout((ShardNotInitializedTimeout)message);
-        } else if(message instanceof ShardLeaderStateChanged) {
+        } else if (message instanceof ShardNotInitializedTimeout) {
+            onShardNotInitializedTimeout((ShardNotInitializedTimeout) message);
+        } else if (message instanceof ShardLeaderStateChanged) {
             onLeaderStateChanged((ShardLeaderStateChanged) message);
             onLeaderStateChanged((ShardLeaderStateChanged) message);
-        } else if(message instanceof SwitchShardBehavior){
+        } else if (message instanceof SwitchShardBehavior) {
             onSwitchShardBehavior((SwitchShardBehavior) message);
             onSwitchShardBehavior((SwitchShardBehavior) message);
-        } else if(message instanceof CreateShard) {
-            onCreateShard((CreateShard)message);
-        } else if(message instanceof AddShardReplica){
-            onAddShardReplica((AddShardReplica)message);
-        } else if(message instanceof ForwardedAddServerReply) {
-            ForwardedAddServerReply msg = (ForwardedAddServerReply)message;
-            onAddServerReply(msg.shardInfo, msg.addServerReply, getSender(), msg.leaderPath,
-                    msg.removeShardOnFailure);
-        } else if(message instanceof ForwardedAddServerFailure) {
-            ForwardedAddServerFailure msg = (ForwardedAddServerFailure)message;
+        } else if (message instanceof CreateShard) {
+            onCreateShard((CreateShard) message);
+        } else if (message instanceof AddShardReplica) {
+            onAddShardReplica((AddShardReplica) message);
+        } else if (message instanceof ForwardedAddServerReply) {
+            ForwardedAddServerReply msg = (ForwardedAddServerReply) message;
+            onAddServerReply(msg.shardInfo, msg.addServerReply, getSender(), msg.leaderPath, msg.removeShardOnFailure);
+        } else if (message instanceof ForwardedAddServerFailure) {
+            ForwardedAddServerFailure msg = (ForwardedAddServerFailure) message;
             onAddServerFailure(msg.shardName, msg.failureMessage, msg.failure, getSender(), msg.removeShardOnFailure);
             onAddServerFailure(msg.shardName, msg.failureMessage, msg.failure, getSender(), msg.removeShardOnFailure);
-        } else if(message instanceof RemoveShardReplica) {
+        } else if (message instanceof RemoveShardReplica) {
             onRemoveShardReplica((RemoveShardReplica) message);
             onRemoveShardReplica((RemoveShardReplica) message);
-        } else if(message instanceof WrappedShardResponse){
+        } else if (message instanceof WrappedShardResponse) {
             onWrappedShardResponse((WrappedShardResponse) message);
             onWrappedShardResponse((WrappedShardResponse) message);
-        } else if(message instanceof GetSnapshot) {
+        } else if (message instanceof GetSnapshot) {
             onGetSnapshot();
             onGetSnapshot();
-        } else if(message instanceof ServerRemoved){
+        } else if (message instanceof ServerRemoved) {
             onShardReplicaRemoved((ServerRemoved) message);
             onShardReplicaRemoved((ServerRemoved) message);
-        } else if(message instanceof ChangeShardMembersVotingStatus){
+        } else if (message instanceof ChangeShardMembersVotingStatus) {
             onChangeShardServersVotingStatus((ChangeShardMembersVotingStatus) message);
             onChangeShardServersVotingStatus((ChangeShardMembersVotingStatus) message);
-        } else if(message instanceof FlipShardMembersVotingStatus){
+        } else if (message instanceof FlipShardMembersVotingStatus) {
             onFlipShardMembersVotingStatus((FlipShardMembersVotingStatus) message);
             onFlipShardMembersVotingStatus((FlipShardMembersVotingStatus) message);
-        } else if(message instanceof SaveSnapshotSuccess) {
-            onSaveSnapshotSuccess((SaveSnapshotSuccess)message);
-        } else if(message instanceof SaveSnapshotFailure) {
-            LOG.error("{}: SaveSnapshotFailure received for saving snapshot of shards",
-                    persistenceId(), ((SaveSnapshotFailure) message).cause());
-        } else if(message instanceof Shutdown) {
+        } else if (message instanceof SaveSnapshotSuccess) {
+            onSaveSnapshotSuccess((SaveSnapshotSuccess) message);
+        } else if (message instanceof SaveSnapshotFailure) {
+            LOG.error("{}: SaveSnapshotFailure received for saving snapshot of shards", persistenceId(),
+                    ((SaveSnapshotFailure) message).cause());
+        } else if (message instanceof Shutdown) {
             onShutDown();
         } else if (message instanceof GetLocalShardIds) {
             onGetLocalShardIds();
             onShutDown();
         } else if (message instanceof GetLocalShardIds) {
             onGetLocalShardIds();
-        } else if(message instanceof RunnableMessage) {
+        } else if (message instanceof RunnableMessage) {
             ((RunnableMessage)message).run();
         } else {
             unknownMessage(message);
             ((RunnableMessage)message).run();
         } else {
             unknownMessage(message);
@@ -263,14 +263,16 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             if (info.getActor() != null) {
                 LOG.debug("{}: Issuing gracefulStop to shard {}", persistenceId(), info.getShardId());
 
             if (info.getActor() != null) {
                 LOG.debug("{}: Issuing gracefulStop to shard {}", persistenceId(), info.getShardId());
 
-                FiniteDuration duration = info.getDatastoreContext().getShardRaftConfig().getElectionTimeOutInterval().$times(2);
+                FiniteDuration duration = info.getDatastoreContext().getShardRaftConfig()
+                        .getElectionTimeOutInterval().$times(2);
                 stopFutures.add(Patterns.gracefulStop(info.getActor(), duration, Shutdown.INSTANCE));
             }
         }
 
         LOG.info("Shutting down ShardManager {} - waiting on {} shards", persistenceId(), stopFutures.size());
 
                 stopFutures.add(Patterns.gracefulStop(info.getActor(), duration, Shutdown.INSTANCE));
             }
         }
 
         LOG.info("Shutting down ShardManager {} - waiting on {} shards", persistenceId(), stopFutures.size());
 
-        ExecutionContext dispatcher = new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client);
+        ExecutionContext dispatcher = new Dispatchers(context().system().dispatchers())
+                .getDispatcher(Dispatchers.DispatcherType.Client);
         Future<Iterable<Boolean>> combinedFutures = Futures.sequence(stopFutures, dispatcher);
 
         combinedFutures.onComplete(new OnComplete<Iterable<Boolean>>() {
         Future<Iterable<Boolean>> combinedFutures = Futures.sequence(stopFutures, dispatcher);
 
         combinedFutures.onComplete(new OnComplete<Iterable<Boolean>>() {
@@ -280,17 +282,17 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
                 self().tell(PoisonPill.getInstance(), self());
 
 
                 self().tell(PoisonPill.getInstance(), self());
 
-                if(failure != null) {
+                if (failure != null) {
                     LOG.warn("{}: An error occurred attempting to shut down the shards", persistenceId(), failure);
                 } else {
                     int nfailed = 0;
                     LOG.warn("{}: An error occurred attempting to shut down the shards", persistenceId(), failure);
                 } else {
                     int nfailed = 0;
-                    for(Boolean r: results) {
-                        if(!r) {
+                    for (Boolean result: results) {
+                        if (!result) {
                             nfailed++;
                         }
                     }
 
                             nfailed++;
                         }
                     }
 
-                    if(nfailed > 0) {
+                    if (nfailed > 0) {
                         LOG.warn("{}: {} shards did not shut down gracefully", persistenceId(), nfailed);
                     }
                 }
                         LOG.warn("{}: {} shards did not shut down gracefully", persistenceId(), nfailed);
                     }
                 }
@@ -309,14 +311,14 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             String leaderPath) {
         shardReplicaOperationsInProgress.remove(shardId.getShardName());
 
             String leaderPath) {
         shardReplicaOperationsInProgress.remove(shardId.getShardName());
 
-        LOG.debug ("{}: Received {} for shard {}", persistenceId(), replyMsg, shardId.getShardName());
+        LOG.debug("{}: Received {} for shard {}", persistenceId(), replyMsg, shardId.getShardName());
 
         if (replyMsg.getStatus() == ServerChangeStatus.OK) {
 
         if (replyMsg.getStatus() == ServerChangeStatus.OK) {
-            LOG.debug ("{}: Leader shard successfully removed the replica shard {}", persistenceId(),
+            LOG.debug("{}: Leader shard successfully removed the replica shard {}", persistenceId(),
                     shardId.getShardName());
             originalSender.tell(new Status.Success(null), getSelf());
         } else {
                     shardId.getShardName());
             originalSender.tell(new Status.Success(null), getSelf());
         } else {
-            LOG.warn ("{}: Leader failed to remove shard replica {} with status {}",
+            LOG.warn("{}: Leader failed to remove shard replica {} with status {}",
                     persistenceId(), shardId, replyMsg.getStatus());
 
             Exception failure = getServerChangeException(RemoveServer.class, replyMsg.getStatus(), leaderPath, shardId);
                     persistenceId(), shardId, replyMsg.getStatus());
 
             Exception failure = getServerChangeException(RemoveServer.class, replyMsg.getStatus(), leaderPath, shardId);
@@ -326,7 +328,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
     private void removeShardReplica(RemoveShardReplica contextMessage, final String shardName, final String primaryPath,
             final ActorRef sender) {
 
     private void removeShardReplica(RemoveShardReplica contextMessage, final String shardName, final String primaryPath,
             final ActorRef sender) {
-        if(isShardReplicaOperationInProgress(shardName, sender)) {
+        if (isShardReplicaOperationInProgress(shardName, sender)) {
             return;
         }
 
             return;
         }
 
@@ -337,11 +339,10 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         final DatastoreContext datastoreContext = newShardDatastoreContextBuilder(shardName).build();
 
         //inform ShardLeader to remove this shard as a replica by sending an RemoveServer message
         final DatastoreContext datastoreContext = newShardDatastoreContextBuilder(shardName).build();
 
         //inform ShardLeader to remove this shard as a replica by sending an RemoveServer message
-        LOG.debug ("{}: Sending RemoveServer message to peer {} for shard {}", persistenceId(),
+        LOG.debug("{}: Sending RemoveServer message to peer {} for shard {}", persistenceId(),
                 primaryPath, shardId);
 
                 primaryPath, shardId);
 
-        Timeout removeServerTimeout = new Timeout(datastoreContext.getShardLeaderElectionTimeout().
-                duration());
+        Timeout removeServerTimeout = new Timeout(datastoreContext.getShardLeaderElectionTimeout().duration());
         Future<Object> futureObj = ask(getContext().actorSelection(primaryPath),
                 new RemoveServer(shardId.toString()), removeServerTimeout);
 
         Future<Object> futureObj = ask(getContext().actorSelection(primaryPath),
                 new RemoveServer(shardId.toString()), removeServerTimeout);
 
@@ -353,7 +354,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                     String msg = String.format("RemoveServer request to leader %s for shard %s failed",
                             primaryPath, shardName);
 
                     String msg = String.format("RemoveServer request to leader %s for shard %s failed",
                             primaryPath, shardName);
 
-                    LOG.debug ("{}: {}", persistenceId(), msg, failure);
+                    LOG.debug("{}: {}", persistenceId(), msg, failure);
 
                     // FAILURE
                     sender.tell(new Status.Failure(new RuntimeException(msg, failure)), self());
 
                     // FAILURE
                     sender.tell(new Status.Failure(new RuntimeException(msg, failure)), self());
@@ -368,10 +369,10 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     private void onShardReplicaRemoved(ServerRemoved message) {
         final ShardIdentifier shardId = new ShardIdentifier.Builder().fromShardIdString(message.getServerId()).build();
         final ShardInformation shardInformation = localShards.remove(shardId.getShardName());
     private void onShardReplicaRemoved(ServerRemoved message) {
         final ShardIdentifier shardId = new ShardIdentifier.Builder().fromShardIdString(message.getServerId()).build();
         final ShardInformation shardInformation = localShards.remove(shardId.getShardName());
-        if(shardInformation == null) {
+        if (shardInformation == null) {
             LOG.debug("{} : Shard replica {} is not present in list", persistenceId(), shardId.toString());
             return;
             LOG.debug("{} : Shard replica {} is not present in list", persistenceId(), shardId.toString());
             return;
-        } else if(shardInformation.getActor() != null) {
+        } else if (shardInformation.getActor() != null) {
             LOG.debug("{} : Sending Shutdown to Shard actor {}", persistenceId(), shardInformation.getActor());
             shardInformation.getActor().tell(Shutdown.INSTANCE, self());
         }
             LOG.debug("{} : Sending Shutdown to Shard actor {}", persistenceId(), shardInformation.getActor());
             shardInformation.getActor().tell(Shutdown.INSTANCE, self());
         }
@@ -383,9 +384,9 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         LOG.debug("{}: onGetSnapshot", persistenceId());
 
         List<String> notInitialized = null;
         LOG.debug("{}: onGetSnapshot", persistenceId());
 
         List<String> notInitialized = null;
-        for(ShardInformation shardInfo: localShards.values()) {
-            if(!shardInfo.isShardInitialized()) {
-                if(notInitialized == null) {
+        for (ShardInformation shardInfo : localShards.values()) {
+            if (!shardInfo.isShardInitialized()) {
+                if (notInitialized == null) {
                     notInitialized = new ArrayList<>();
                 }
 
                     notInitialized = new ArrayList<>();
                 }
 
@@ -393,14 +394,14 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             }
         }
 
             }
         }
 
-        if(notInitialized != null) {
+        if (notInitialized != null) {
             getSender().tell(new Status.Failure(new IllegalStateException(String.format(
                     "%d shard(s) %s are not initialized", notInitialized.size(), notInitialized))), getSelf());
             return;
         }
 
         byte[] shardManagerSnapshot = null;
             getSender().tell(new Status.Failure(new IllegalStateException(String.format(
                     "%d shard(s) %s are not initialized", notInitialized.size(), notInitialized))), getSelf());
             return;
         }
 
         byte[] shardManagerSnapshot = null;
-        if(currentSnapshot != null) {
+        if (currentSnapshot != null) {
             shardManagerSnapshot = SerializationUtils.serialize(currentSnapshot);
         }
 
             shardManagerSnapshot = SerializationUtils.serialize(currentSnapshot);
         }
 
@@ -408,18 +409,19 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 new ArrayList<>(localShards.keySet()), type, shardManagerSnapshot , getSender(), persistenceId(),
                 datastoreContextFactory.getBaseDatastoreContext().getShardInitializationTimeout().duration()));
 
                 new ArrayList<>(localShards.keySet()), type, shardManagerSnapshot , getSender(), persistenceId(),
                 datastoreContextFactory.getBaseDatastoreContext().getShardInitializationTimeout().duration()));
 
-        for(ShardInformation shardInfo: localShards.values()) {
+        for (ShardInformation shardInfo: localShards.values()) {
             shardInfo.getActor().tell(GetSnapshot.INSTANCE, replyActor);
         }
     }
 
             shardInfo.getActor().tell(GetSnapshot.INSTANCE, replyActor);
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void onCreateShard(CreateShard createShard) {
         LOG.debug("{}: onCreateShard: {}", persistenceId(), createShard);
 
         Object reply;
         try {
             String shardName = createShard.getModuleShardConfig().getShardName();
     private void onCreateShard(CreateShard createShard) {
         LOG.debug("{}: onCreateShard: {}", persistenceId(), createShard);
 
         Object reply;
         try {
             String shardName = createShard.getModuleShardConfig().getShardName();
-            if(localShards.containsKey(shardName)) {
+            if (localShards.containsKey(shardName)) {
                 LOG.debug("{}: Shard {} already exists", persistenceId(), shardName);
                 reply = new Status.Success(String.format("Shard with name %s already exists", shardName));
             } else {
                 LOG.debug("{}: Shard {} already exists", persistenceId(), shardName);
                 reply = new Status.Success(String.format("Shard with name %s already exists", shardName));
             } else {
@@ -431,7 +433,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             reply = new Status.Failure(e);
         }
 
             reply = new Status.Failure(e);
         }
 
-        if(getSender() != null && !getContext().system().deadLetters().equals(getSender())) {
+        if (getSender() != null && !getContext().system().deadLetters().equals(getSender())) {
             getSender().tell(reply, getSelf());
         }
     }
             getSender().tell(reply, getSelf());
         }
     }
@@ -443,7 +445,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         configuration.addModuleShardConfiguration(moduleShardConfig);
 
         DatastoreContext shardDatastoreContext = createShard.getDatastoreContext();
         configuration.addModuleShardConfiguration(moduleShardConfig);
 
         DatastoreContext shardDatastoreContext = createShard.getDatastoreContext();
-        if(shardDatastoreContext == null) {
+        if (shardDatastoreContext == null) {
             shardDatastoreContext = newShardDatastoreContext(shardName);
         } else {
             shardDatastoreContext = DatastoreContext.newBuilderFrom(shardDatastoreContext).shardPeerAddressResolver(
             shardDatastoreContext = newShardDatastoreContext(shardName);
         } else {
             shardDatastoreContext = DatastoreContext.newBuilderFrom(shardDatastoreContext).shardPeerAddressResolver(
@@ -452,13 +454,13 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         ShardIdentifier shardId = getShardIdentifier(cluster.getCurrentMemberName(), shardName);
 
 
         ShardIdentifier shardId = getShardIdentifier(cluster.getCurrentMemberName(), shardName);
 
-        boolean shardWasInRecoveredSnapshot = currentSnapshot != null &&
-                currentSnapshot.getShardList().contains(shardName);
+        boolean shardWasInRecoveredSnapshot = currentSnapshot != null
+                && currentSnapshot.getShardList().contains(shardName);
 
         Map<String, String> peerAddresses;
         boolean isActiveMember;
 
         Map<String, String> peerAddresses;
         boolean isActiveMember;
-        if(shardWasInRecoveredSnapshot || configuration.getMembersFromShardName(shardName).
-                contains(cluster.getCurrentMemberName())) {
+        if (shardWasInRecoveredSnapshot || configuration.getMembersFromShardName(shardName)
+                .contains(cluster.getCurrentMemberName())) {
             peerAddresses = getPeerAddresses(shardName);
             isActiveMember = true;
         } else {
             peerAddresses = getPeerAddresses(shardName);
             isActiveMember = true;
         } else {
@@ -468,8 +470,8 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             // subsequent AddServer request will be needed to make it an active member.
             isActiveMember = false;
             peerAddresses = Collections.emptyMap();
             // subsequent AddServer request will be needed to make it an active member.
             isActiveMember = false;
             peerAddresses = Collections.emptyMap();
-            shardDatastoreContext = DatastoreContext.newBuilderFrom(shardDatastoreContext).
-                    customRaftPolicyImplementation(DisableElectionsRaftPolicy.class.getName()).build();
+            shardDatastoreContext = DatastoreContext.newBuilderFrom(shardDatastoreContext)
+                    .customRaftPolicyImplementation(DisableElectionsRaftPolicy.class.getName()).build();
         }
 
         LOG.debug("{} doCreateShard: shardId: {}, memberNames: {}, peerAddresses: {}, isActiveMember: {}",
         }
 
         LOG.debug("{} doCreateShard: shardId: {}, memberNames: {}, peerAddresses: {}, isActiveMember: {}",
@@ -481,21 +483,21 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         info.setActiveMember(isActiveMember);
         localShards.put(info.getShardName(), info);
 
         info.setActiveMember(isActiveMember);
         localShards.put(info.getShardName(), info);
 
-        if(schemaContext != null) {
+        if (schemaContext != null) {
             info.setActor(newShardActor(schemaContext, info));
         }
     }
 
     private DatastoreContext.Builder newShardDatastoreContextBuilder(String shardName) {
             info.setActor(newShardActor(schemaContext, info));
         }
     }
 
     private DatastoreContext.Builder newShardDatastoreContextBuilder(String shardName) {
-        return DatastoreContext.newBuilderFrom(datastoreContextFactory.getShardDatastoreContext(shardName)).
-                shardPeerAddressResolver(peerAddressResolver);
+        return DatastoreContext.newBuilderFrom(datastoreContextFactory.getShardDatastoreContext(shardName))
+                .shardPeerAddressResolver(peerAddressResolver);
     }
 
     private DatastoreContext newShardDatastoreContext(String shardName) {
         return newShardDatastoreContextBuilder(shardName).build();
     }
 
     }
 
     private DatastoreContext newShardDatastoreContext(String shardName) {
         return newShardDatastoreContextBuilder(shardName).build();
     }
 
-    private void checkReady(){
+    private void checkReady() {
         if (isReadyWithLeaderId()) {
             LOG.info("{}: All Shards are ready - data store {} is ready, available count is {}",
                     persistenceId(), type, waitTillReadyCountdownLatch.getCount());
         if (isReadyWithLeaderId()) {
             LOG.info("{}: All Shards are ready - data store {} is ready, available count is {}",
                     persistenceId(), type, waitTillReadyCountdownLatch.getCount());
@@ -508,10 +510,10 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         LOG.info("{}: Received LeaderStateChanged message: {}", persistenceId(), leaderStateChanged);
 
         ShardInformation shardInformation = findShardInformation(leaderStateChanged.getMemberId());
         LOG.info("{}: Received LeaderStateChanged message: {}", persistenceId(), leaderStateChanged);
 
         ShardInformation shardInformation = findShardInformation(leaderStateChanged.getMemberId());
-        if(shardInformation != null) {
+        if (shardInformation != null) {
             shardInformation.setLocalDataTree(leaderStateChanged.getLocalShardDataTree());
             shardInformation.setLeaderVersion(leaderStateChanged.getLeaderPayloadVersion());
             shardInformation.setLocalDataTree(leaderStateChanged.getLocalShardDataTree());
             shardInformation.setLeaderVersion(leaderStateChanged.getLeaderPayloadVersion());
-            if(shardInformation.setLeaderId(leaderStateChanged.getLeaderId())) {
+            if (shardInformation.setLeaderId(leaderStateChanged.getLeaderId())) {
                 primaryShardInfoCache.remove(shardInformation.getShardName());
             }
 
                 primaryShardInfoCache.remove(shardInformation.getShardName());
             }
 
@@ -529,7 +531,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         shardInfo.removeOnShardInitialized(message.getOnShardInitialized());
 
 
         shardInfo.removeOnShardInitialized(message.getOnShardInitialized());
 
-        if(!shardInfo.isShardInitialized()) {
+        if (!shardInfo.isShardInitialized()) {
             LOG.debug("{}: Returning NotInitializedException for shard {}", persistenceId(), shardInfo.getShardName());
             message.getSender().tell(createNotInitializedException(shardInfo.getShardId()), getSelf());
         } else {
             LOG.debug("{}: Returning NotInitializedException for shard {}", persistenceId(), shardInfo.getShardName());
             message.getSender().tell(createNotInitializedException(shardInfo.getShardId()), getSelf());
         } else {
@@ -544,10 +546,10 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         ShardInformation shardInformation = findShardInformation(status.getName());
 
 
         ShardInformation shardInformation = findShardInformation(status.getName());
 
-        if(shardInformation != null) {
+        if (shardInformation != null) {
             shardInformation.setFollowerSyncStatus(status.isInitialSyncDone());
 
             shardInformation.setFollowerSyncStatus(status.isInitialSyncDone());
 
-            mBean.setSyncStatus(isInSync());
+            shardManagerMBean.setSyncStatus(isInSync());
         }
 
     }
         }
 
     }
@@ -557,17 +559,17 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 roleChanged.getOldRole(), roleChanged.getNewRole());
 
         ShardInformation shardInformation = findShardInformation(roleChanged.getMemberId());
                 roleChanged.getOldRole(), roleChanged.getNewRole());
 
         ShardInformation shardInformation = findShardInformation(roleChanged.getMemberId());
-        if(shardInformation != null) {
+        if (shardInformation != null) {
             shardInformation.setRole(roleChanged.getNewRole());
             checkReady();
             shardInformation.setRole(roleChanged.getNewRole());
             checkReady();
-            mBean.setSyncStatus(isInSync());
+            shardManagerMBean.setSyncStatus(isInSync());
         }
     }
 
 
     private ShardInformation findShardInformation(String memberId) {
         }
     }
 
 
     private ShardInformation findShardInformation(String memberId) {
-        for(ShardInformation info : localShards.values()){
-            if(info.getShardId().toString().equals(memberId)){
+        for (ShardInformation info : localShards.values()) {
+            if (info.getShardId().toString().equals(memberId)) {
                 return info;
             }
         }
                 return info;
             }
         }
@@ -578,7 +580,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     private boolean isReadyWithLeaderId() {
         boolean isReady = true;
         for (ShardInformation info : localShards.values()) {
     private boolean isReadyWithLeaderId() {
         boolean isReady = true;
         for (ShardInformation info : localShards.values()) {
-            if(!info.isShardReadyWithLeaderId()){
+            if (!info.isShardReadyWithLeaderId()) {
                 isReady = false;
                 break;
             }
                 isReady = false;
                 break;
             }
@@ -586,9 +588,9 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         return isReady;
     }
 
         return isReady;
     }
 
-    private boolean isInSync(){
+    private boolean isInSync() {
         for (ShardInformation info : localShards.values()) {
         for (ShardInformation info : localShards.values()) {
-            if(!info.isInSync()){
+            if (!info.isInSync()) {
                 return false;
             }
         }
                 return false;
             }
         }
@@ -636,6 +638,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         }
     }
 
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void onRecoveryCompleted() {
         LOG.info("Recovery complete : {}", persistenceId());
 
     private void onRecoveryCompleted() {
         LOG.info("Recovery complete : {}", persistenceId());
 
@@ -643,16 +646,16 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         // journal on upgrade from Helium.
         deleteMessages(lastSequenceNr());
 
         // journal on upgrade from Helium.
         deleteMessages(lastSequenceNr());
 
-        if(currentSnapshot == null && restoreFromSnapshot != null &&
-                restoreFromSnapshot.getShardManagerSnapshot() != null) {
-            try(ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
+        if (currentSnapshot == null && restoreFromSnapshot != null
+                && restoreFromSnapshot.getShardManagerSnapshot() != null) {
+            try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
                     restoreFromSnapshot.getShardManagerSnapshot()))) {
                 ShardManagerSnapshot snapshot = (ShardManagerSnapshot) ois.readObject();
 
                 LOG.debug("{}: Deserialized restored ShardManagerSnapshot: {}", persistenceId(), snapshot);
 
                 applyShardManagerSnapshot(snapshot);
                     restoreFromSnapshot.getShardManagerSnapshot()))) {
                 ShardManagerSnapshot snapshot = (ShardManagerSnapshot) ois.readObject();
 
                 LOG.debug("{}: Deserialized restored ShardManagerSnapshot: {}", persistenceId(), snapshot);
 
                 applyShardManagerSnapshot(snapshot);
-            } catch(Exception e) {
+            } catch (Exception e) {
                 LOG.error("{}: Error deserializing restored ShardManagerSnapshot", persistenceId(), e);
             }
         }
                 LOG.error("{}: Error deserializing restored ShardManagerSnapshot", persistenceId(), e);
             }
         }
@@ -660,21 +663,10 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         createLocalShards();
     }
 
         createLocalShards();
     }
 
-    private void findLocalShard(FindLocalShard message) {
-        final ShardInformation shardInformation = localShards.get(message.getShardName());
-
-        if(shardInformation == null){
-            getSender().tell(new LocalShardNotFound(message.getShardName()), getSelf());
-            return;
-        }
-
-        sendResponse(shardInformation, message.isWaitUntilInitialized(), false, () -> new LocalShardFound(shardInformation.getActor()));
-    }
-
     private void sendResponse(ShardInformation shardInformation, boolean doWait,
             boolean wantShardReady, final Supplier<Object> messageSupplier) {
     private void sendResponse(ShardInformation shardInformation, boolean doWait,
             boolean wantShardReady, final Supplier<Object> messageSupplier) {
-        if (!shardInformation.isShardInitialized() || (wantShardReady && !shardInformation.isShardReadyWithLeaderId())) {
-            if(doWait) {
+        if (!shardInformation.isShardInitialized() || wantShardReady && !shardInformation.isShardReadyWithLeaderId()) {
+            if (doWait) {
                 final ActorRef sender = getSender();
                 final ActorRef self = self();
 
                 final ActorRef sender = getSender();
                 final ActorRef self = self();
 
@@ -685,8 +677,9 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
                 shardInformation.addOnShardInitialized(onShardInitialized);
 
 
                 shardInformation.addOnShardInitialized(onShardInitialized);
 
-                FiniteDuration timeout = shardInformation.getDatastoreContext().getShardInitializationTimeout().duration();
-                if(shardInformation.isShardInitialized()) {
+                FiniteDuration timeout = shardInformation.getDatastoreContext()
+                        .getShardInitializationTimeout().duration();
+                if (shardInformation.isShardInitialized()) {
                     // If the shard is already initialized then we'll wait enough time for the shard to
                     // elect a leader, ie 2 times the election timeout.
                     timeout = FiniteDuration.create(shardInformation.getDatastoreContext().getShardRaftConfig()
                     // If the shard is already initialized then we'll wait enough time for the shard to
                     // elect a leader, ie 2 times the election timeout.
                     timeout = FiniteDuration.create(shardInformation.getDatastoreContext().getShardRaftConfig()
@@ -741,7 +734,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         peerAddressResolver.removePeerAddress(memberName);
 
 
         peerAddressResolver.removePeerAddress(memberName);
 
-        for(ShardInformation info : localShards.values()){
+        for (ShardInformation info : localShards.values()) {
             info.peerDown(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
         }
     }
             info.peerDown(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
         }
     }
@@ -754,7 +747,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         peerAddressResolver.removePeerAddress(memberName);
 
 
         peerAddressResolver.removePeerAddress(memberName);
 
-        for(ShardInformation info : localShards.values()){
+        for (ShardInformation info : localShards.values()) {
             info.peerDown(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
         }
     }
             info.peerDown(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
         }
     }
@@ -785,7 +778,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     private void addPeerAddress(MemberName memberName, Address address) {
         peerAddressResolver.addPeerAddress(memberName, address);
 
     private void addPeerAddress(MemberName memberName, Address address) {
         peerAddressResolver.addPeerAddress(memberName, address);
 
-        for(ShardInformation info : localShards.values()){
+        for (ShardInformation info : localShards.values()) {
             String shardName = info.getShardName();
             String peerId = getShardIdentifier(memberName, shardName).toString();
             info.updatePeerAddress(peerId, peerAddressResolver.getShardActorAddress(shardName, memberName), getSelf());
             String shardName = info.getShardName();
             String peerId = getShardIdentifier(memberName, shardName).toString();
             info.updatePeerAddress(peerId, peerAddressResolver.getShardActorAddress(shardName, memberName), getSelf());
@@ -882,16 +875,16 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         final ActorRef actor = info.getActor();
         if (actor != null) {
             actor.tell(switchBehavior, getSelf());
         final ActorRef actor = info.getActor();
         if (actor != null) {
             actor.tell(switchBehavior, getSelf());
-          } else {
+        } else {
             LOG.warn("Could not switch the behavior of shard {} to {} - shard is not yet available",
                 info.getShardName(), switchBehavior.getNewState());
         }
     }
 
     /**
             LOG.warn("Could not switch the behavior of shard {} to {} - shard is not yet available",
                 info.getShardName(), switchBehavior.getNewState());
         }
     }
 
     /**
-     * Notifies all the local shards of a change in the schema context
+     * Notifies all the local shards of a change in the schema context.
      *
      *
-     * @param message
+     * @param message the message to send
      */
     private void updateSchemaContext(final Object message) {
         schemaContext = ((UpdateSchemaContext) message).getSchemaContext();
      */
     private void updateSchemaContext(final Object message) {
         schemaContext = ((UpdateSchemaContext) message).getSchemaContext();
@@ -930,22 +923,19 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         if (info != null && info.isActiveMember()) {
             sendResponse(info, message.isWaitUntilReady(), true, () -> {
                 String primaryPath = info.getSerializedLeaderActor();
         if (info != null && info.isActiveMember()) {
             sendResponse(info, message.isWaitUntilReady(), true, () -> {
                 String primaryPath = info.getSerializedLeaderActor();
-                Object found = canReturnLocalShardState && info.isLeader() ?
-                        new LocalPrimaryShardFound(primaryPath, info.getLocalShardDataTree().get()) :
+                Object found = canReturnLocalShardState && info.isLeader()
+                        new LocalPrimaryShardFound(primaryPath, info.getLocalShardDataTree().get()) :
                             new RemotePrimaryShardFound(primaryPath, info.getLeaderVersion());
 
                             new RemotePrimaryShardFound(primaryPath, info.getLeaderVersion());
 
-                        if(LOG.isDebugEnabled()) {
-                            LOG.debug("{}: Found primary for {}: {}", persistenceId(), shardName, found);
-                        }
-
-                        return found;
+                LOG.debug("{}: Found primary for {}: {}", persistenceId(), shardName, found);
+                return found;
             });
 
             return;
         }
 
         final Collection<String> visitedAddresses;
             });
 
             return;
         }
 
         final Collection<String> visitedAddresses;
-        if(message instanceof RemoteFindPrimary) {
+        if (message instanceof RemoteFindPrimary) {
             visitedAddresses = ((RemoteFindPrimary)message).getVisitedAddresses();
         } else {
             visitedAddresses = new ArrayList<>(1);
             visitedAddresses = ((RemoteFindPrimary)message).getVisitedAddresses();
         } else {
             visitedAddresses = new ArrayList<>(1);
@@ -953,8 +943,8 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         visitedAddresses.add(peerAddressResolver.getShardManagerActorPathBuilder(cluster.getSelfAddress()).toString());
 
 
         visitedAddresses.add(peerAddressResolver.getShardManagerActorPathBuilder(cluster.getSelfAddress()).toString());
 
-        for(String address: peerAddressResolver.getShardManagerPeerActorAddresses()) {
-            if(visitedAddresses.contains(address)) {
+        for (String address: peerAddressResolver.getShardManagerPeerActorAddresses()) {
+            if (visitedAddresses.contains(address)) {
                 continue;
             }
 
                 continue;
             }
 
@@ -972,38 +962,58 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 String.format("No primary shard found for %s.", shardName)), getSelf());
     }
 
                 String.format("No primary shard found for %s.", shardName)), getSelf());
     }
 
+    private void findPrimary(final String shardName, final FindPrimaryResponseHandler handler) {
+        Timeout findPrimaryTimeout = new Timeout(datastoreContextFactory.getBaseDatastoreContext()
+                .getShardInitializationTimeout().duration().$times(2));
+
+        Future<Object> futureObj = ask(getSelf(), new FindPrimary(shardName, true), findPrimaryTimeout);
+        futureObj.onComplete(new OnComplete<Object>() {
+            @Override
+            public void onComplete(Throwable failure, Object response) {
+                if (failure != null) {
+                    handler.onFailure(failure);
+                } else {
+                    if (response instanceof RemotePrimaryShardFound) {
+                        handler.onRemotePrimaryShardFound((RemotePrimaryShardFound) response);
+                    } else if (response instanceof LocalPrimaryShardFound) {
+                        handler.onLocalPrimaryFound((LocalPrimaryShardFound) response);
+                    } else {
+                        handler.onUnknownResponse(response);
+                    }
+                }
+            }
+        }, new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client));
+    }
+
     /**
      * Construct the name of the shard actor given the name of the member on
     /**
      * Construct the name of the shard actor given the name of the member on
-     * which the shard resides and the name of the shard
+     * which the shard resides and the name of the shard.
      *
      *
-     * @param memberName
-     * @param shardName
-     * @return
+     * @param memberName the member name
+     * @param shardName the shard name
+     * @return a b
      */
      */
-    private ShardIdentifier getShardIdentifier(MemberName memberName, String shardName){
+    private ShardIdentifier getShardIdentifier(MemberName memberName, String shardName) {
         return peerAddressResolver.getShardIdentifier(memberName, shardName);
     }
 
     /**
         return peerAddressResolver.getShardIdentifier(memberName, shardName);
     }
 
     /**
-     * Create shards that are local to the member on which the ShardManager
-     * runs
-     *
+     * Create shards that are local to the member on which the ShardManager runs.
      */
     private void createLocalShards() {
         MemberName memberName = this.cluster.getCurrentMemberName();
         Collection<String> memberShardNames = this.configuration.getMemberShardNames(memberName);
 
         Map<String, DatastoreSnapshot.ShardSnapshot> shardSnapshots = new HashMap<>();
      */
     private void createLocalShards() {
         MemberName memberName = this.cluster.getCurrentMemberName();
         Collection<String> memberShardNames = this.configuration.getMemberShardNames(memberName);
 
         Map<String, DatastoreSnapshot.ShardSnapshot> shardSnapshots = new HashMap<>();
-        if(restoreFromSnapshot != null)
-        {
-            for(DatastoreSnapshot.ShardSnapshot snapshot: restoreFromSnapshot.getShardSnapshots()) {
+        if (restoreFromSnapshot != null) {
+            for (DatastoreSnapshot.ShardSnapshot snapshot: restoreFromSnapshot.getShardSnapshots()) {
                 shardSnapshots.put(snapshot.getName(), snapshot);
             }
         }
 
         restoreFromSnapshot = null; // null out to GC
 
                 shardSnapshots.put(snapshot.getName(), snapshot);
             }
         }
 
         restoreFromSnapshot = null; // null out to GC
 
-        for(String shardName : memberShardNames){
+        for (String shardName : memberShardNames) {
             ShardIdentifier shardId = getShardIdentifier(memberName, shardName);
 
             LOG.debug("{}: Creating local shard: {}", persistenceId(), shardId);
             ShardIdentifier shardId = getShardIdentifier(memberName, shardName);
 
             LOG.debug("{}: Creating local shard: {}", persistenceId(), shardId);
@@ -1016,9 +1026,9 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     }
 
     /**
     }
 
     /**
-     * Given the name of the shard find the addresses of all it's peers
+     * Given the name of the shard find the addresses of all it's peers.
      *
      *
-     * @param shardName
+     * @param shardName the shard name
      */
     private Map<String, String> getPeerAddresses(String shardName) {
         Collection<MemberName> members = configuration.getMembersFromShardName(shardName);
      */
     private Map<String, String> getPeerAddresses(String shardName) {
         Collection<MemberName> members = configuration.getMembersFromShardName(shardName);
@@ -1043,9 +1053,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 (Function<Throwable, Directive>) t -> {
                     LOG.warn("Supervisor Strategy caught unexpected exception - resuming", t);
                     return SupervisorStrategy.resume();
                 (Function<Throwable, Directive>) t -> {
                     LOG.warn("Supervisor Strategy caught unexpected exception - resuming", t);
                     return SupervisorStrategy.resume();
-                }
-                );
-
+                });
     }
 
     @Override
     }
 
     @Override
@@ -1054,14 +1062,14 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     }
 
     @VisibleForTesting
     }
 
     @VisibleForTesting
-    ShardManagerInfoMBean getMBean(){
-        return mBean;
+    ShardManagerInfoMBean getMBean() {
+        return shardManagerMBean;
     }
 
     private boolean isShardReplicaOperationInProgress(final String shardName, final ActorRef sender) {
         if (shardReplicaOperationsInProgress.contains(shardName)) {
             String msg = String.format("A shard replica operation for %s is already in progress", shardName);
     }
 
     private boolean isShardReplicaOperationInProgress(final String shardName, final ActorRef sender) {
         if (shardReplicaOperationsInProgress.contains(shardName)) {
             String msg = String.format("A shard replica operation for %s is already in progress", shardName);
-            LOG.debug ("{}: {}", persistenceId(), msg);
+            LOG.debug("{}: {}", persistenceId(), msg);
             sender.tell(new Status.Failure(new IllegalStateException(msg)), getSelf());
             return true;
         }
             sender.tell(new Status.Failure(new IllegalStateException(msg)), getSelf());
             return true;
         }
@@ -1069,15 +1077,15 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         return false;
     }
 
         return false;
     }
 
-    private void onAddShardReplica (final AddShardReplica shardReplicaMsg) {
+    private void onAddShardReplica(final AddShardReplica shardReplicaMsg) {
         final String shardName = shardReplicaMsg.getShardName();
 
         LOG.debug("{}: onAddShardReplica: {}", persistenceId(), shardReplicaMsg);
 
         // verify the shard with the specified name is present in the cluster configuration
         final String shardName = shardReplicaMsg.getShardName();
 
         LOG.debug("{}: onAddShardReplica: {}", persistenceId(), shardReplicaMsg);
 
         // verify the shard with the specified name is present in the cluster configuration
-        if (!(this.configuration.isShardConfigured(shardName))) {
+        if (!this.configuration.isShardConfigured(shardName)) {
             String msg = String.format("No module configuration exists for shard %s", shardName);
             String msg = String.format("No module configuration exists for shard %s", shardName);
-            LOG.debug ("{}: {}", persistenceId(), msg);
+            LOG.debug("{}: {}", persistenceId(), msg);
             getSender().tell(new Status.Failure(new IllegalArgumentException(msg)), getSelf());
             return;
         }
             getSender().tell(new Status.Failure(new IllegalArgumentException(msg)), getSelf());
             return;
         }
@@ -1086,15 +1094,17 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         if (schemaContext == null) {
             String msg = String.format(
                   "No SchemaContext is available in order to create a local shard instance for %s", shardName);
         if (schemaContext == null) {
             String msg = String.format(
                   "No SchemaContext is available in order to create a local shard instance for %s", shardName);
-            LOG.debug ("{}: {}", persistenceId(), msg);
+            LOG.debug("{}: {}", persistenceId(), msg);
             getSender().tell(new Status.Failure(new IllegalStateException(msg)), getSelf());
             return;
         }
 
             getSender().tell(new Status.Failure(new IllegalStateException(msg)), getSelf());
             return;
         }
 
-        findPrimary(shardName, new AutoFindPrimaryFailureResponseHandler(getSender(), shardName, persistenceId(), getSelf()) {
+        findPrimary(shardName, new AutoFindPrimaryFailureResponseHandler(getSender(), shardName, persistenceId(),
+                getSelf()) {
             @Override
             public void onRemotePrimaryShardFound(RemotePrimaryShardFound response) {
             @Override
             public void onRemotePrimaryShardFound(RemotePrimaryShardFound response) {
-                getSelf().tell((RunnableMessage) () -> addShard(getShardName(), response, getSender()), getTargetActor());
+                getSelf().tell((RunnableMessage) () -> addShard(getShardName(), response, getSender()),
+                        getTargetActor());
             }
 
             @Override
             }
 
             @Override
@@ -1107,12 +1117,12 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
     private void sendLocalReplicaAlreadyExistsReply(String shardName, ActorRef sender) {
         String msg = String.format("Local shard %s already exists", shardName);
 
     private void sendLocalReplicaAlreadyExistsReply(String shardName, ActorRef sender) {
         String msg = String.format("Local shard %s already exists", shardName);
-        LOG.debug ("{}: {}", persistenceId(), msg);
+        LOG.debug("{}: {}", persistenceId(), msg);
         sender.tell(new Status.Failure(new AlreadyExistsException(msg)), getSelf());
     }
 
     private void addShard(final String shardName, final RemotePrimaryShardFound response, final ActorRef sender) {
         sender.tell(new Status.Failure(new AlreadyExistsException(msg)), getSelf());
     }
 
     private void addShard(final String shardName, final RemotePrimaryShardFound response, final ActorRef sender) {
-        if(isShardReplicaOperationInProgress(shardName, sender)) {
+        if (isShardReplicaOperationInProgress(shardName, sender)) {
             return;
         }
 
             return;
         }
 
@@ -1121,12 +1131,12 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         final ShardInformation shardInfo;
         final boolean removeShardOnFailure;
         ShardInformation existingShardInfo = localShards.get(shardName);
         final ShardInformation shardInfo;
         final boolean removeShardOnFailure;
         ShardInformation existingShardInfo = localShards.get(shardName);
-        if(existingShardInfo == null) {
+        if (existingShardInfo == null) {
             removeShardOnFailure = true;
             ShardIdentifier shardId = getShardIdentifier(cluster.getCurrentMemberName(), shardName);
 
             removeShardOnFailure = true;
             ShardIdentifier shardId = getShardIdentifier(cluster.getCurrentMemberName(), shardName);
 
-            DatastoreContext datastoreContext = newShardDatastoreContextBuilder(shardName).customRaftPolicyImplementation(
-                    DisableElectionsRaftPolicy.class.getName()).build();
+            DatastoreContext datastoreContext = newShardDatastoreContextBuilder(shardName)
+                    .customRaftPolicyImplementation(DisableElectionsRaftPolicy.class.getName()).build();
 
             shardInfo = new ShardInformation(shardName, shardId, getPeerAddresses(shardName), datastoreContext,
                     Shard.builder(), peerAddressResolver);
 
             shardInfo = new ShardInformation(shardName, shardId, getPeerAddresses(shardName), datastoreContext,
                     Shard.builder(), peerAddressResolver);
@@ -1141,11 +1151,11 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         String localShardAddress = peerAddressResolver.getShardActorAddress(shardName, cluster.getCurrentMemberName());
 
         //inform ShardLeader to add this shard as a replica by sending an AddServer message
         String localShardAddress = peerAddressResolver.getShardActorAddress(shardName, cluster.getCurrentMemberName());
 
         //inform ShardLeader to add this shard as a replica by sending an AddServer message
-        LOG.debug ("{}: Sending AddServer message to peer {} for shard {}", persistenceId(),
+        LOG.debug("{}: Sending AddServer message to peer {} for shard {}", persistenceId(),
                 response.getPrimaryPath(), shardInfo.getShardId());
 
                 response.getPrimaryPath(), shardInfo.getShardId());
 
-        Timeout addServerTimeout = new Timeout(shardInfo.getDatastoreContext().getShardLeaderElectionTimeout().
-                duration());
+        Timeout addServerTimeout = new Timeout(shardInfo.getDatastoreContext()
+                .getShardLeaderElectionTimeout().duration());
         Future<Object> futureObj = ask(getContext().actorSelection(response.getPrimaryPath()),
             new AddServer(shardInfo.getShardId().toString(), localShardAddress, true), addServerTimeout);
 
         Future<Object> futureObj = ask(getContext().actorSelection(response.getPrimaryPath()),
             new AddServer(shardInfo.getShardId().toString(), localShardAddress, true), addServerTimeout);
 
@@ -1153,7 +1163,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             @Override
             public void onComplete(Throwable failure, Object addServerResponse) {
                 if (failure != null) {
             @Override
             public void onComplete(Throwable failure, Object addServerResponse) {
                 if (failure != null) {
-                    LOG.debug ("{}: AddServer request to {} for {} failed", persistenceId(),
+                    LOG.debug("{}: AddServer request to {} for {} failed", persistenceId(),
                             response.getPrimaryPath(), shardName, failure);
 
                     String msg = String.format("AddServer request to leader %s for shard %s failed",
                             response.getPrimaryPath(), shardName, failure);
 
                     String msg = String.format("AddServer request to leader %s for shard %s failed",
@@ -1171,7 +1181,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             boolean removeShardOnFailure) {
         shardReplicaOperationsInProgress.remove(shardName);
 
             boolean removeShardOnFailure) {
         shardReplicaOperationsInProgress.remove(shardName);
 
-        if(removeShardOnFailure) {
+        if (removeShardOnFailure) {
             ShardInformation shardInfo = localShards.remove(shardName);
             if (shardInfo.getActor() != null) {
                 shardInfo.getActor().tell(PoisonPill.getInstance(), getSelf());
             ShardInformation shardInfo = localShards.remove(shardName);
             if (shardInfo.getActor() != null) {
                 shardInfo.getActor().tell(PoisonPill.getInstance(), getSelf());
@@ -1187,10 +1197,10 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         String shardName = shardInfo.getShardName();
         shardReplicaOperationsInProgress.remove(shardName);
 
         String shardName = shardInfo.getShardName();
         shardReplicaOperationsInProgress.remove(shardName);
 
-        LOG.debug ("{}: Received {} for shard {} from leader {}", persistenceId(), replyMsg, shardName, leaderPath);
+        LOG.debug("{}: Received {} for shard {} from leader {}", persistenceId(), replyMsg, shardName, leaderPath);
 
         if (replyMsg.getStatus() == ServerChangeStatus.OK) {
 
         if (replyMsg.getStatus() == ServerChangeStatus.OK) {
-            LOG.debug ("{}: Leader shard successfully added the replica shard {}", persistenceId(), shardName);
+            LOG.debug("{}: Leader shard successfully added the replica shard {}", persistenceId(), shardName);
 
             // Make the local shard voting capable
             shardInfo.setDatastoreContext(newShardDatastoreContext(shardName), getSelf());
 
             // Make the local shard voting capable
             shardInfo.setDatastoreContext(newShardDatastoreContext(shardName), getSelf());
@@ -1198,13 +1208,14 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             persistShardList();
 
             sender.tell(new Status.Success(null), getSelf());
             persistShardList();
 
             sender.tell(new Status.Success(null), getSelf());
-        } else if(replyMsg.getStatus() == ServerChangeStatus.ALREADY_EXISTS) {
+        } else if (replyMsg.getStatus() == ServerChangeStatus.ALREADY_EXISTS) {
             sendLocalReplicaAlreadyExistsReply(shardName, sender);
         } else {
             sendLocalReplicaAlreadyExistsReply(shardName, sender);
         } else {
-            LOG.warn ("{}: Leader failed to add shard replica {} with status {}",
+            LOG.warn("{}: Leader failed to add shard replica {} with status {}",
                     persistenceId(), shardName, replyMsg.getStatus());
 
                     persistenceId(), shardName, replyMsg.getStatus());
 
-            Exception failure = getServerChangeException(AddServer.class, replyMsg.getStatus(), leaderPath, shardInfo.getShardId());
+            Exception failure = getServerChangeException(AddServer.class, replyMsg.getStatus(), leaderPath,
+                    shardInfo.getShardId());
 
             onAddServerFailure(shardName, null, failure, sender, removeShardOnFailure);
         }
 
             onAddServerFailure(shardName, null, failure, sender, removeShardOnFailure);
         }
@@ -1216,9 +1227,9 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         switch (serverChangeStatus) {
             case TIMEOUT:
                 failure = new TimeoutException(String.format(
         switch (serverChangeStatus) {
             case TIMEOUT:
                 failure = new TimeoutException(String.format(
-                        "The shard leader %s timed out trying to replicate the initial data to the new shard %s." +
-                        "Possible causes - there was a problem replicating the data or shard leadership changed while replicating the shard data",
-                        leaderPath, shardId.getShardName()));
+                        "The shard leader %s timed out trying to replicate the initial data to the new shard %s."
+                        + "Possible causes - there was a problem replicating the data or shard leadership changed "
+                        + "while replicating the shard data", leaderPath, shardId.getShardName()));
                 break;
             case NO_LEADER:
                 failure = createNoShardLeaderException(shardId);
                 break;
             case NO_LEADER:
                 failure = createNoShardLeaderException(shardId);
@@ -1235,7 +1246,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         return failure;
     }
 
         return failure;
     }
 
-    private void onRemoveShardReplica (final RemoveShardReplica shardReplicaMsg) {
+    private void onRemoveShardReplica(final RemoveShardReplica shardReplicaMsg) {
         LOG.debug("{}: onRemoveShardReplica: {}", persistenceId(), shardReplicaMsg);
 
         findPrimary(shardReplicaMsg.getShardName(), new AutoFindPrimaryFailureResponseHandler(getSender(),
         LOG.debug("{}: onRemoveShardReplica: {}", persistenceId(), shardReplicaMsg);
 
         findPrimary(shardReplicaMsg.getShardName(), new AutoFindPrimaryFailureResponseHandler(getSender(),
@@ -1251,7 +1262,8 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             }
 
             private void doRemoveShardReplicaAsync(final String primaryPath) {
             }
 
             private void doRemoveShardReplicaAsync(final String primaryPath) {
-                getSelf().tell((RunnableMessage) () -> removeShardReplica(shardReplicaMsg, getShardName(), primaryPath, getSender()), getTargetActor());
+                getSelf().tell((RunnableMessage) () -> removeShardReplica(shardReplicaMsg, getShardName(),
+                        primaryPath, getSender()), getTargetActor());
             }
         });
     }
             }
         });
     }
@@ -1263,7 +1275,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 shardList.remove(shardInfo.getShardName());
             }
         }
                 shardList.remove(shardInfo.getShardName());
             }
         }
-        LOG.debug ("{}: persisting the shard list {}", persistenceId(), shardList);
+        LOG.debug("{}: persisting the shard list {}", persistenceId(), shardList);
         saveSnapshot(updateShardManagerSnapshot(shardList));
     }
 
         saveSnapshot(updateShardManagerSnapshot(shardList));
     }
 
@@ -1275,7 +1287,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     private void applyShardManagerSnapshot(ShardManagerSnapshot snapshot) {
         currentSnapshot = snapshot;
 
     private void applyShardManagerSnapshot(ShardManagerSnapshot snapshot) {
         currentSnapshot = snapshot;
 
-        LOG.debug ("{}: onSnapshotOffer: {}", persistenceId(), currentSnapshot);
+        LOG.debug("{}: onSnapshotOffer: {}", persistenceId(), currentSnapshot);
 
         final MemberName currentMember = cluster.getCurrentMemberName();
         Set<String> configuredShardList =
 
         final MemberName currentMember = cluster.getCurrentMemberName();
         Set<String> configuredShardList =
@@ -1283,7 +1295,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         for (String shard : currentSnapshot.getShardList()) {
             if (!configuredShardList.contains(shard)) {
                 // add the current member as a replica for the shard
         for (String shard : currentSnapshot.getShardList()) {
             if (!configuredShardList.contains(shard)) {
                 // add the current member as a replica for the shard
-                LOG.debug ("{}: adding shard {}", persistenceId(), shard);
+                LOG.debug("{}: adding shard {}", persistenceId(), shard);
                 configuration.addMemberReplicaForShard(shard, currentMember);
             } else {
                 configuredShardList.remove(shard);
                 configuration.addMemberReplicaForShard(shard, currentMember);
             } else {
                 configuredShardList.remove(shard);
@@ -1291,13 +1303,13 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         }
         for (String shard : configuredShardList) {
             // remove the member as a replica for the shard
         }
         for (String shard : configuredShardList) {
             // remove the member as a replica for the shard
-            LOG.debug ("{}: removing shard {}", persistenceId(), shard);
+            LOG.debug("{}: removing shard {}", persistenceId(), shard);
             configuration.removeMemberReplicaForShard(shard, currentMember);
         }
     }
 
             configuration.removeMemberReplicaForShard(shard, currentMember);
         }
     }
 
-    private void onSaveSnapshotSuccess (SaveSnapshotSuccess successMessage) {
-        LOG.debug ("{} saved ShardManager snapshot successfully. Deleting the prev snapshot if available",
+    private void onSaveSnapshotSuccess(SaveSnapshotSuccess successMessage) {
+        LOG.debug("{} saved ShardManager snapshot successfully. Deleting the prev snapshot if available",
             persistenceId());
         deleteSnapshots(new SnapshotSelectionCriteria(scala.Long.MaxValue(), successMessage.metadata().timestamp() - 1,
             0, 0));
             persistenceId());
         deleteSnapshots(new SnapshotSelectionCriteria(scala.Long.MaxValue(), successMessage.metadata().timestamp() - 1,
             0, 0));
@@ -1308,7 +1320,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         String shardName = changeMembersVotingStatus.getShardName();
         Map<String, Boolean> serverVotingStatusMap = new HashMap<>();
 
         String shardName = changeMembersVotingStatus.getShardName();
         Map<String, Boolean> serverVotingStatusMap = new HashMap<>();
-        for(Entry<String, Boolean> e: changeMembersVotingStatus.getMeberVotingStatusMap().entrySet()) {
+        for (Entry<String, Boolean> e: changeMembersVotingStatus.getMeberVotingStatusMap().entrySet()) {
             serverVotingStatusMap.put(getShardIdentifier(MemberName.forName(e.getKey()), shardName).toString(),
                     e.getValue());
         }
             serverVotingStatusMap.put(getShardIdentifier(MemberName.forName(e.getKey()), shardName).toString(),
                     e.getValue());
         }
@@ -1316,8 +1328,8 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         ChangeServersVotingStatus changeServersVotingStatus = new ChangeServersVotingStatus(serverVotingStatusMap);
 
         findLocalShard(shardName, getSender(),
         ChangeServersVotingStatus changeServersVotingStatus = new ChangeServersVotingStatus(serverVotingStatusMap);
 
         findLocalShard(shardName, getSender(),
-                localShardFound -> changeShardMembersVotingStatus(changeServersVotingStatus, shardName,
-                        localShardFound.getPath(), getSender()));
+            localShardFound -> changeShardMembersVotingStatus(changeServersVotingStatus, shardName,
+            localShardFound.getPath(), getSender()));
     }
 
     private void onFlipShardMembersVotingStatus(FlipShardMembersVotingStatus flipMembersVotingStatus) {
     }
 
     private void onFlipShardMembersVotingStatus(FlipShardMembersVotingStatus flipMembersVotingStatus) {
@@ -1340,12 +1352,12 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
                     OnDemandRaftState raftState = (OnDemandRaftState) response;
                     Map<String, Boolean> serverVotingStatusMap = new HashMap<>();
 
                     OnDemandRaftState raftState = (OnDemandRaftState) response;
                     Map<String, Boolean> serverVotingStatusMap = new HashMap<>();
-                    for(Entry<String, Boolean> e: raftState.getPeerVotingStates().entrySet()) {
+                    for ( Entry<String, Boolean> e: raftState.getPeerVotingStates().entrySet()) {
                         serverVotingStatusMap.put(e.getKey(), !e.getValue());
                     }
 
                         serverVotingStatusMap.put(e.getKey(), !e.getValue());
                     }
 
-                    serverVotingStatusMap.put(getShardIdentifier(cluster.getCurrentMemberName(), shardName).
-                            toString(), !raftState.isVoting());
+                    serverVotingStatusMap.put(getShardIdentifier(cluster.getCurrentMemberName(), shardName)
+                            .toString(), !raftState.isVoting());
 
                     changeShardMembersVotingStatus(new ChangeServersVotingStatus(serverVotingStatusMap),
                             shardName, localShardFound.getPath(), sender);
 
                     changeShardMembersVotingStatus(new ChangeServersVotingStatus(serverVotingStatusMap),
                             shardName, localShardFound.getPath(), sender);
@@ -1355,30 +1367,44 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
     }
 
 
     }
 
+    private void findLocalShard(FindLocalShard message) {
+        final ShardInformation shardInformation = localShards.get(message.getShardName());
+
+        if (shardInformation == null) {
+            getSender().tell(new LocalShardNotFound(message.getShardName()), getSelf());
+            return;
+        }
+
+        sendResponse(shardInformation, message.isWaitUntilInitialized(), false,
+            () -> new LocalShardFound(shardInformation.getActor()));
+    }
+
     private void findLocalShard(final String shardName, final ActorRef sender,
             final Consumer<LocalShardFound> onLocalShardFound) {
     private void findLocalShard(final String shardName, final ActorRef sender,
             final Consumer<LocalShardFound> onLocalShardFound) {
-        Timeout findLocalTimeout = new Timeout(datastoreContextFactory.getBaseDatastoreContext().
-                getShardInitializationTimeout().duration().$times(2));
+        Timeout findLocalTimeout = new Timeout(datastoreContextFactory.getBaseDatastoreContext()
+                .getShardInitializationTimeout().duration().$times(2));
 
         Future<Object> futureObj = ask(getSelf(), new FindLocalShard(shardName, true), findLocalTimeout);
         futureObj.onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(Throwable failure, Object response) {
                 if (failure != null) {
 
         Future<Object> futureObj = ask(getSelf(), new FindLocalShard(shardName, true), findLocalTimeout);
         futureObj.onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(Throwable failure, Object response) {
                 if (failure != null) {
-                    LOG.debug ("{}: Received failure from FindLocalShard for shard {}", persistenceId, shardName, failure);
+                    LOG.debug("{}: Received failure from FindLocalShard for shard {}", persistenceId, shardName,
+                            failure);
                     sender.tell(new Status.Failure(new RuntimeException(
                             String.format("Failed to find local shard %s", shardName), failure)), self());
                 } else {
                     sender.tell(new Status.Failure(new RuntimeException(
                             String.format("Failed to find local shard %s", shardName), failure)), self());
                 } else {
-                    if(response instanceof LocalShardFound) {
-                        getSelf().tell((RunnableMessage) () -> onLocalShardFound.accept((LocalShardFound) response), sender);
-                    } else if(response instanceof LocalShardNotFound) {
+                    if (response instanceof LocalShardFound) {
+                        getSelf().tell((RunnableMessage) () -> onLocalShardFound.accept((LocalShardFound) response),
+                                sender);
+                    } else if (response instanceof LocalShardNotFound) {
                         String msg = String.format("Local shard %s does not exist", shardName);
                         String msg = String.format("Local shard %s does not exist", shardName);
-                        LOG.debug ("{}: {}", persistenceId, msg);
+                        LOG.debug("{}: {}", persistenceId, msg);
                         sender.tell(new Status.Failure(new IllegalArgumentException(msg)), self());
                     } else {
                         String msg = String.format("Failed to find local shard %s: received response: %s",
                                 shardName, response);
                         sender.tell(new Status.Failure(new IllegalArgumentException(msg)), self());
                     } else {
                         String msg = String.format("Failed to find local shard %s: received response: %s",
                                 shardName, response);
-                        LOG.debug ("{}: {}", persistenceId, msg);
+                        LOG.debug("{}: {}", persistenceId, msg);
                         sender.tell(new Status.Failure(response instanceof Throwable ? (Throwable) response :
                                 new RuntimeException(msg)), self());
                     }
                         sender.tell(new Status.Failure(response instanceof Throwable ? (Throwable) response :
                                 new RuntimeException(msg)), self());
                     }
@@ -1389,7 +1415,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
     private void changeShardMembersVotingStatus(ChangeServersVotingStatus changeServersVotingStatus,
             final String shardName, final ActorRef shardActorRef, final ActorRef sender) {
 
     private void changeShardMembersVotingStatus(ChangeServersVotingStatus changeServersVotingStatus,
             final String shardName, final ActorRef shardActorRef, final ActorRef sender) {
-        if(isShardReplicaOperationInProgress(shardName, sender)) {
+        if (isShardReplicaOperationInProgress(shardName, sender)) {
             return;
         }
 
             return;
         }
 
@@ -1411,21 +1437,21 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 if (failure != null) {
                     String msg = String.format("ChangeServersVotingStatus request to local shard %s failed",
                             shardActorRef.path());
                 if (failure != null) {
                     String msg = String.format("ChangeServersVotingStatus request to local shard %s failed",
                             shardActorRef.path());
-                    LOG.debug ("{}: {}", persistenceId(), msg, failure);
+                    LOG.debug("{}: {}", persistenceId(), msg, failure);
                     sender.tell(new Status.Failure(new RuntimeException(msg, failure)), self());
                 } else {
                     sender.tell(new Status.Failure(new RuntimeException(msg, failure)), self());
                 } else {
-                    LOG.debug ("{}: Received {} from local shard {}", persistenceId(), response, shardActorRef.path());
+                    LOG.debug("{}: Received {} from local shard {}", persistenceId(), response, shardActorRef.path());
 
                     ServerChangeReply replyMsg = (ServerChangeReply) response;
 
                     ServerChangeReply replyMsg = (ServerChangeReply) response;
-                    if(replyMsg.getStatus() == ServerChangeStatus.OK) {
-                        LOG.debug ("{}: ChangeServersVotingStatus succeeded for shard {}", persistenceId(), shardName);
+                    if (replyMsg.getStatus() == ServerChangeStatus.OK) {
+                        LOG.debug("{}: ChangeServersVotingStatus succeeded for shard {}", persistenceId(), shardName);
                         sender.tell(new Status.Success(null), getSelf());
                         sender.tell(new Status.Success(null), getSelf());
-                    } else if(replyMsg.getStatus() == ServerChangeStatus.INVALID_REQUEST) {
+                    } else if (replyMsg.getStatus() == ServerChangeStatus.INVALID_REQUEST) {
                         sender.tell(new Status.Failure(new IllegalArgumentException(String.format(
                         sender.tell(new Status.Failure(new IllegalArgumentException(String.format(
-                                "The requested voting state change for shard %s is invalid. At least one member must be voting",
-                                shardId.getShardName()))), getSelf());
+                                "The requested voting state change for shard %s is invalid. At least one member "
+                                + "must be voting", shardId.getShardName()))), getSelf());
                     } else {
                     } else {
-                        LOG.warn ("{}: ChangeServersVotingStatus failed for shard {} with status {}",
+                        LOG.warn("{}: ChangeServersVotingStatus failed for shard {} with status {}",
                                 persistenceId(), shardName, replyMsg.getStatus());
 
                         Exception error = getServerChangeException(ChangeServersVotingStatus.class,
                                 persistenceId(), shardName, replyMsg.getStatus());
 
                         Exception error = getServerChangeException(ChangeServersVotingStatus.class,
@@ -1494,83 +1520,63 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         }
     }
 
         }
     }
 
-    private void findPrimary(final String shardName, final FindPrimaryResponseHandler handler) {
-        Timeout findPrimaryTimeout = new Timeout(datastoreContextFactory.getBaseDatastoreContext().
-                getShardInitializationTimeout().duration().$times(2));
-
-
-        Future<Object> futureObj = ask(getSelf(), new FindPrimary(shardName, true), findPrimaryTimeout);
-        futureObj.onComplete(new OnComplete<Object>() {
-            @Override
-            public void onComplete(Throwable failure, Object response) {
-                if (failure != null) {
-                    handler.onFailure(failure);
-                } else {
-                    if(response instanceof RemotePrimaryShardFound) {
-                        handler.onRemotePrimaryShardFound((RemotePrimaryShardFound) response);
-                    } else if(response instanceof LocalPrimaryShardFound) {
-                        handler.onLocalPrimaryFound((LocalPrimaryShardFound) response);
-                    } else {
-                        handler.onUnknownResponse(response);
-                    }
-                }
-            }
-        }, new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client));
-    }
-
     private interface RunnableMessage extends Runnable {
     }
 
     /**
      * The FindPrimaryResponseHandler provides specific callback methods which are invoked when a response to the
     private interface RunnableMessage extends Runnable {
     }
 
     /**
      * The FindPrimaryResponseHandler provides specific callback methods which are invoked when a response to the
-     * a remote or local find primary message is processed
+     * a remote or local find primary message is processed.
      */
     private interface FindPrimaryResponseHandler {
         /**
      */
     private interface FindPrimaryResponseHandler {
         /**
-         * Invoked when a Failure message is received as a response
+         * Invoked when a Failure message is received as a response.
          *
          *
-         * @param failure
+         * @param failure the failure exception
          */
         void onFailure(Throwable failure);
 
         /**
          */
         void onFailure(Throwable failure);
 
         /**
-         * Invoked when a RemotePrimaryShardFound response is received
+         * Invoked when a RemotePrimaryShardFound response is received.
          *
          *
-         * @param response
+         * @param response the response
          */
         void onRemotePrimaryShardFound(RemotePrimaryShardFound response);
 
         /**
          */
         void onRemotePrimaryShardFound(RemotePrimaryShardFound response);
 
         /**
-         * Invoked when a LocalPrimaryShardFound response is received
-         * @param response
+         * Invoked when a LocalPrimaryShardFound response is received.
+         *
+         * @param response the response
          */
         void onLocalPrimaryFound(LocalPrimaryShardFound response);
 
         /**
          * Invoked when an unknown response is received. This is another type of failure.
          *
          */
         void onLocalPrimaryFound(LocalPrimaryShardFound response);
 
         /**
          * Invoked when an unknown response is received. This is another type of failure.
          *
-         * @param response
+         * @param response the response
          */
         void onUnknownResponse(Object response);
     }
 
     /**
      * The AutoFindPrimaryFailureResponseHandler automatically processes Failure responses when finding a primary
          */
         void onUnknownResponse(Object response);
     }
 
     /**
      * The AutoFindPrimaryFailureResponseHandler automatically processes Failure responses when finding a primary
-     * replica and sends a wrapped Failure response to some targetActor
+     * replica and sends a wrapped Failure response to some targetActor.
      */
      */
-    private static abstract class AutoFindPrimaryFailureResponseHandler implements FindPrimaryResponseHandler {
+    private abstract static class AutoFindPrimaryFailureResponseHandler implements FindPrimaryResponseHandler {
         private final ActorRef targetActor;
         private final String shardName;
         private final String persistenceId;
         private final ActorRef shardManagerActor;
 
         /**
         private final ActorRef targetActor;
         private final String shardName;
         private final String persistenceId;
         private final ActorRef shardManagerActor;
 
         /**
+         * Constructs an instance.
+         *
          * @param targetActor The actor to whom the Failure response should be sent when a FindPrimary failure occurs
          * @param shardName The name of the shard for which the primary replica had to be found
          * @param persistenceId The persistenceId for the ShardManager
          * @param shardManagerActor The ShardManager actor which triggered the call to FindPrimary
          */
          * @param targetActor The actor to whom the Failure response should be sent when a FindPrimary failure occurs
          * @param shardName The name of the shard for which the primary replica had to be found
          * @param persistenceId The persistenceId for the ShardManager
          * @param shardManagerActor The ShardManager actor which triggered the call to FindPrimary
          */
-        protected AutoFindPrimaryFailureResponseHandler(ActorRef targetActor, String shardName, String persistenceId, ActorRef shardManagerActor){
+        protected AutoFindPrimaryFailureResponseHandler(ActorRef targetActor, String shardName, String persistenceId,
+                ActorRef shardManagerActor) {
             this.targetActor = Preconditions.checkNotNull(targetActor);
             this.shardName = Preconditions.checkNotNull(shardName);
             this.persistenceId = Preconditions.checkNotNull(persistenceId);
             this.targetActor = Preconditions.checkNotNull(targetActor);
             this.shardName = Preconditions.checkNotNull(shardName);
             this.persistenceId = Preconditions.checkNotNull(persistenceId);
@@ -1587,7 +1593,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         @Override
         public void onFailure(Throwable failure) {
 
         @Override
         public void onFailure(Throwable failure) {
-            LOG.debug ("{}: Received failure from FindPrimary for shard {}", persistenceId, shardName, failure);
+            LOG.debug("{}: Received failure from FindPrimary for shard {}", persistenceId, shardName, failure);
             targetActor.tell(new Status.Failure(new RuntimeException(
                     String.format("Failed to find leader for shard %s", shardName), failure)), shardManagerActor);
         }
             targetActor.tell(new Status.Failure(new RuntimeException(
                     String.format("Failed to find leader for shard %s", shardName), failure)), shardManagerActor);
         }
@@ -1596,7 +1602,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         public void onUnknownResponse(Object response) {
             String msg = String.format("Failed to find leader for shard %s: received response: %s",
                     shardName, response);
         public void onUnknownResponse(Object response) {
             String msg = String.format("Failed to find leader for shard %s: received response: %s",
                     shardName, response);
-            LOG.debug ("{}: {}", persistenceId, msg);
+            LOG.debug("{}: {}", persistenceId, msg);
             targetActor.tell(new Status.Failure(response instanceof Throwable ? (Throwable) response :
                     new RuntimeException(msg)), shardManagerActor);
         }
             targetActor.tell(new Status.Failure(response instanceof Throwable ? (Throwable) response :
                     new RuntimeException(msg)), shardManagerActor);
         }
index e4e71a492c928a770dec540c07627d4ffdeebc02..bc06c32fa754978fe697cfbfc8be2e49856cd907 100644 (file)
@@ -51,18 +51,18 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor {
 
     @Override
     public void onReceive(Object message) {
 
     @Override
     public void onReceive(Object message) {
-        if(message instanceof GetSnapshotReply) {
+        if (message instanceof GetSnapshotReply) {
             onGetSnapshotReply((GetSnapshotReply)message);
             onGetSnapshotReply((GetSnapshotReply)message);
-        } else if(message instanceof Failure) {
+        } else if (message instanceof Failure) {
             LOG.debug("{}: Received {}", params.id, message);
 
             params.replyToActor.tell(message, getSelf());
             getSelf().tell(PoisonPill.getInstance(), getSelf());
         } else if (message instanceof ReceiveTimeout) {
             String msg = String.format(
             LOG.debug("{}: Received {}", params.id, message);
 
             params.replyToActor.tell(message, getSelf());
             getSelf().tell(PoisonPill.getInstance(), getSelf());
         } else if (message instanceof ReceiveTimeout) {
             String msg = String.format(
-                    "Timed out after %s ms while waiting for snapshot replies from %d shard(s). %d shard(s) %s did not respond.",
-                        params.receiveTimeout.toMillis(), params.shardNames.size(), remainingShardNames.size(),
-                        remainingShardNames);
+                    "Timed out after %s ms while waiting for snapshot replies from %d shard(s). %d shard(s) %s "
+                    + "did not respond.", params.receiveTimeout.toMillis(), params.shardNames.size(),
+                    remainingShardNames.size(), remainingShardNames);
             LOG.warn("{}: {}", params.id, msg);
             params.replyToActor.tell(new Failure(new TimeoutException(msg)), getSelf());
             getSelf().tell(PoisonPill.getInstance(), getSelf());
             LOG.warn("{}: {}", params.id, msg);
             params.replyToActor.tell(new Failure(new TimeoutException(msg)), getSelf());
             getSelf().tell(PoisonPill.getInstance(), getSelf());
@@ -76,11 +76,11 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor {
         shardSnapshots.add(new ShardSnapshot(shardId.getShardName(), getSnapshotReply.getSnapshot()));
 
         remainingShardNames.remove(shardId.getShardName());
         shardSnapshots.add(new ShardSnapshot(shardId.getShardName(), getSnapshotReply.getSnapshot()));
 
         remainingShardNames.remove(shardId.getShardName());
-        if(remainingShardNames.isEmpty()) {
+        if (remainingShardNames.isEmpty()) {
             LOG.debug("{}: All shard snapshots received", params.id);
 
             LOG.debug("{}: All shard snapshots received", params.id);
 
-            DatastoreSnapshot datastoreSnapshot = new DatastoreSnapshot(params.datastoreType, params.shardManagerSnapshot,
-                    shardSnapshots);
+            DatastoreSnapshot datastoreSnapshot = new DatastoreSnapshot(params.datastoreType,
+                    params.shardManagerSnapshot, shardSnapshots);
             params.replyToActor.tell(datastoreSnapshot, getSelf());
             getSelf().tell(PoisonPill.getInstance(), getSelf());
         }
             params.replyToActor.tell(datastoreSnapshot, getSelf());
             getSelf().tell(PoisonPill.getInstance(), getSelf());
         }
index 41a2afe19313964aedf75832d5e56ac8b0164e1b..d7b4932d5dd6f8304aee3701509001ff0ded5ff7 100644 (file)
@@ -42,7 +42,7 @@ final class ShardManagerInfo extends AbstractMXBean implements ShardManagerInfoM
         this.memberName = Preconditions.checkNotNull(memberName);
     }
 
         this.memberName = Preconditions.checkNotNull(memberName);
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
     @Override
     public List<String> getLocalShards() {
         try {
     @Override
     public List<String> getLocalShards() {
         try {
@@ -67,6 +67,7 @@ final class ShardManagerInfo extends AbstractMXBean implements ShardManagerInfoM
         return memberName.getName();
     }
 
         return memberName.getName();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void requestSwitchShardState(final ShardIdentifier shardId, final String newState, final long term) {
         // Validates strings argument
         final RaftState state = RaftState.valueOf(newState);
     private void requestSwitchShardState(final ShardIdentifier shardId, final String newState, final long term) {
         // Validates strings argument
         final RaftState state = RaftState.valueOf(newState);
index 5f34578031a6a677089b1b2893f1a2a87e699170..01204ce979b7ebc5262d92d667e31c57c0f3ad97 100644 (file)
@@ -12,44 +12,48 @@ import java.util.List;
 
 public interface ShardManagerInfoMBean {
     /**
 
 public interface ShardManagerInfoMBean {
     /**
+     * Returns the list of all the local shard names.
      *
      * @return a list of all the local shard names
      */
     List<String> getLocalShards();
 
     /**
      *
      * @return a list of all the local shard names
      */
     List<String> getLocalShards();
 
     /**
+     * Returns the overall sync status for all shards.
      *
      * @return true if all local shards are in sync with their corresponding leaders
      */
     boolean getSyncStatus();
 
     /**
      *
      * @return true if all local shards are in sync with their corresponding leaders
      */
     boolean getSyncStatus();
 
     /**
-     * Get the name of of the current member
+     * Returns the name of the local member.
      *
      *
-     * @return
+     * @return the local member name
      */
     String getMemberName();
 
     /**
      */
     String getMemberName();
 
     /**
-     * Switch the Raft Behavior of all the local shards to the newBehavior
+     * Switches the raft behavior of all the local shards to the newBehavior.
      *
      * @param newBehavior should be either Leader/Follower only
      *
      * @param newBehavior should be either Leader/Follower only
-     * @param term when switching to the Leader specifies for which term the Shard would be the Leader. Any modifications
-     *             made to state will be written with this term. This term will then be used by the Raft replication
-     *             implementation to decide which modifications should stay and which ones should be removed. Ideally
-     *             the term provided when switching to a new Leader should always be higher than the previous term.
+     * @param term when switching to the Leader specifies for which term the Shard would be the Leader. Any
+     *             modifications made to state will be written with this term. This term will then be used by the Raft
+     *             replication implementation to decide which modifications should stay and which ones should be
+     *             removed. Ideally the term provided when switching to a new Leader should always be higher than the
+     *             previous term.
      */
     void switchAllLocalShardsState(String newBehavior, long term);
 
     /**
      */
     void switchAllLocalShardsState(String newBehavior, long term);
 
     /**
-     * Switch the Raft Behavior of the shard specified by shardName to the newBehavior
+     * Switches the raft behavior of the shard specified by shardName to the newBehavior.
      *
      * @param shardName a shard that is local to this shard manager
      * @param newBehavior should be either Leader/Follower only
      *
      * @param shardName a shard that is local to this shard manager
      * @param newBehavior should be either Leader/Follower only
-     * @param term when switching to the Leader specifies for which term the Shard would be the Leader. Any modifications
-     *             made to state will be written with this term. This term will then be used by the Raft replication
-     *             implementation to decide which modifications should stay and which ones should be removed. Ideally
-     *             the term provided when switching to a new Leader should always be higher than the previous term.
+     * @param term when switching to the Leader specifies for which term the Shard would be the Leader. Any
+     *             modifications made to state will be written with this term. This term will then be used by the Raft
+     *             replication implementation to decide which modifications should stay and which ones should be
+     *             removed. Ideally the term provided when switching to a new Leader should always be higher than the
+     *             previous term.
      */
     void switchShardState(String shardName, String newBehavior, long term);
 }
      */
     void switchShardState(String shardName, String newBehavior, long term);
 }
index b6fe842692beba2c8e9319dc43cc30c1cd441946..78dc1c28306fe29fc54fdcc8b247c0bee4987a4b 100644 (file)
@@ -14,7 +14,7 @@ import java.util.List;
 import javax.annotation.Nonnull;
 
 /**
 import javax.annotation.Nonnull;
 
 /**
- * Persisted data of the ShardManager
+ * Persisted data of the ShardManager.
  */
 // FIXME: make this package-protected once forShardList is removed.
 public final class ShardManagerSnapshot implements Serializable {
  */
 // FIXME: make this package-protected once forShardList is removed.
 public final class ShardManagerSnapshot implements Serializable {
@@ -30,6 +30,8 @@ public final class ShardManagerSnapshot implements Serializable {
     }
 
     /**
     }
 
     /**
+     * Creates a ShardManagerSnapshot.
+     *
      * @deprecated This method is for migration only and should me removed once
      *             org.opendaylight.controller.cluster.datastore.ShardManagerSnapshot is removed.
      */
      * @deprecated This method is for migration only and should me removed once
      *             org.opendaylight.controller.cluster.datastore.ShardManagerSnapshot is removed.
      */
index 62b8e93fb545de80ef4faa9ed765238c0f1bfe8f..a05548b1a4209f10bc3b4387009c24c52d34a4dc 100644 (file)
@@ -33,7 +33,7 @@ class ShardPeerAddressResolver implements PeerAddressResolver {
     private final String shardManagerType;
     private final MemberName localMemberName;
 
     private final String shardManagerType;
     private final MemberName localMemberName;
 
-    public ShardPeerAddressResolver(String shardManagerType, MemberName localMemberName) {
+    ShardPeerAddressResolver(String shardManagerType, MemberName localMemberName) {
         this.shardManagerIdentifier = ShardManagerIdentifier.builder().type(shardManagerType).build().toString();
         this.shardManagerType = shardManagerType;
         this.localMemberName = Preconditions.checkNotNull(localMemberName);
         this.shardManagerIdentifier = ShardManagerIdentifier.builder().type(shardManagerType).build().toString();
         this.shardManagerType = shardManagerType;
         this.localMemberName = Preconditions.checkNotNull(localMemberName);
@@ -53,8 +53,8 @@ class ShardPeerAddressResolver implements PeerAddressResolver {
 
     Collection<String> getShardManagerPeerActorAddresses() {
         Collection<String> peerAddresses = new ArrayList<>();
 
     Collection<String> getShardManagerPeerActorAddresses() {
         Collection<String> peerAddresses = new ArrayList<>();
-        for(Map.Entry<MemberName, Address> entry: memberNameToAddress.entrySet()) {
-            if(!localMemberName.equals(entry.getKey())) {
+        for (Map.Entry<MemberName, Address> entry: memberNameToAddress.entrySet()) {
+            if (!localMemberName.equals(entry.getKey())) {
                 peerAddresses.add(getShardManagerActorPathBuilder(entry.getValue()).toString());
             }
         }
                 peerAddresses.add(getShardManagerActorPathBuilder(entry.getValue()).toString());
             }
         }
@@ -68,7 +68,7 @@ class ShardPeerAddressResolver implements PeerAddressResolver {
 
     String getShardActorAddress(String shardName, MemberName memberName) {
         Address memberAddress = memberNameToAddress.get(memberName);
 
     String getShardActorAddress(String shardName, MemberName memberName) {
         Address memberAddress = memberNameToAddress.get(memberName);
-        if(memberAddress != null) {
+        if (memberAddress != null) {
             return getShardManagerActorPathBuilder(memberAddress).append("/").append(
                     getShardIdentifier(memberName, shardName)).toString();
         }
             return getShardManagerActorPathBuilder(memberAddress).append("/").append(
                     getShardIdentifier(memberName, shardName)).toString();
         }
index 6a3de4256b0b968345b8c01764f15146923e0f9a..a0712b67146cca8d79ef27e9463bb0eb15c3fb47 100644 (file)
@@ -11,10 +11,8 @@ package org.opendaylight.controller.cluster.datastore.shardstrategy;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
- * The DefaultShardStrategy basically puts all data into the default Shard
- * <p>
- *   The default shard stores data for all modules for which a specific set of shards has not been configured
- * </p>
+ * The DefaultShardStrategy basically puts all data into the default shard. The default shard stores data for all
+ * modules for which a specific set of shards has not been configured. This is only intended for testing.
  */
 public final class DefaultShardStrategy implements ShardStrategy {
     public static final String NAME = "default";
  */
 public final class DefaultShardStrategy implements ShardStrategy {
     public static final String NAME = "default";
index 26cbc053f696192e61d895b9937d9b9066c09632..c90baf2760c00a07fd08812ec3869cfc59727f10 100644 (file)
@@ -18,7 +18,7 @@ public class ModuleShardStrategy implements ShardStrategy {
     private final String moduleName;
     private final Configuration configuration;
 
     private final String moduleName;
     private final Configuration configuration;
 
-    public ModuleShardStrategy(String moduleName, Configuration configuration){
+    public ModuleShardStrategy(String moduleName, Configuration configuration) {
         this.moduleName = moduleName;
         this.configuration = configuration;
     }
         this.moduleName = moduleName;
         this.configuration = configuration;
     }
index 9a05c381ea556aeccf10013952aab453282c3dba..0440b7f023c0a264d2ab3e77716303e03a21406f 100644 (file)
@@ -11,17 +11,17 @@ package org.opendaylight.controller.cluster.datastore.shardstrategy;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
- * The role of ShardStrategy is to figure out which Shards a given piece of data belongs to
+ * The role of ShardStrategy is to figure out which shards a given piece of data belongs to.
  */
 public interface ShardStrategy {
  */
 public interface ShardStrategy {
-  /**
-   * Find the name of the shard in which the data pointed to by the specified path belongs in
-   * <p>
-   * Should return the name of the default shard DefaultShardStrategy.DEFAULT_SHARD
-   * if no matching shard was found
-   *
-   * @param path The location of the data in the logical tree
-   * @return
-   */
-  String findShard(YangInstanceIdentifier path);
+    /**
+     * Find the name of the shard in which the data pointed to by the specified path belongs in.
+     * <p/>
+     * Should return the name of the default shard DefaultShardStrategy.DEFAULT_SHARD
+     * if no matching shard was found
+     *
+     * @param path the location of the data in the logical tree
+     * @return the corresponding shard name.
+     */
+    String findShard(YangInstanceIdentifier path);
 }
 }
index 8ca615003872116f84138bba22ddca177da4e28c..a26dc56a750067c026d6cacff45f2663525b72f4 100644 (file)
@@ -36,7 +36,7 @@ public class ShardStrategyFactory {
 
     public static ShardStrategy newShardStrategyInstance(String moduleName, String strategyName,
             Configuration configuration) {
 
     public static ShardStrategy newShardStrategyInstance(String moduleName, String strategyName,
             Configuration configuration) {
-        if(ModuleShardStrategy.NAME.equals(strategyName)){
+        if (ModuleShardStrategy.NAME.equals(strategyName)) {
             return new ModuleShardStrategy(moduleName, configuration);
         }
 
             return new ModuleShardStrategy(moduleName, configuration);
         }
 
index ee0a4796cac87e8cb79b004a36ad3748f8f52c68..f1a1f145b370720c80e0a9fd1cb619b44cc4c52a 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.cluster.datastore.utils;
 
 import static akka.pattern.Patterns.ask;
 package org.opendaylight.controller.cluster.datastore.utils;
 
 import static akka.pattern.Patterns.ask;
+
 import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
@@ -74,11 +75,11 @@ public class ActorContext {
         @Override
         public Throwable apply(Throwable failure) {
             Throwable actualFailure = failure;
         @Override
         public Throwable apply(Throwable failure) {
             Throwable actualFailure = failure;
-            if(failure instanceof AskTimeoutException) {
+            if (failure instanceof AskTimeoutException) {
                 // A timeout exception most likely means the shard isn't initialized.
                 actualFailure = new NotInitializedException(
                 // A timeout exception most likely means the shard isn't initialized.
                 actualFailure = new NotInitializedException(
-                        "Timed out trying to find the primary shard. Most likely cause is the " +
-                        "shard is not initialized yet.");
+                        "Timed out trying to find the primary shard. Most likely cause is the "
+                        "shard is not initialized yet.");
             }
 
             return actualFailure;
             }
 
             return actualFailure;
@@ -101,8 +102,13 @@ public class ActorContext {
     private final Dispatchers dispatchers;
 
     private volatile SchemaContext schemaContext;
     private final Dispatchers dispatchers;
 
     private volatile SchemaContext schemaContext;
+
+    // Used as a write memory barrier.
+    @SuppressWarnings("unused")
     private volatile boolean updated;
     private volatile boolean updated;
-    private final MetricRegistry metricRegistry = MetricsReporter.getInstance(DatastoreContext.METRICS_DOMAIN).getMetricsRegistry();
+
+    private final MetricRegistry metricRegistry = MetricsReporter.getInstance(DatastoreContext.METRICS_DOMAIN)
+            .getMetricsRegistry();
 
     private final PrimaryShardInfoFutureCache primaryShardInfoCache;
     private final ShardStrategyFactory shardStrategyFactory;
 
     private final PrimaryShardInfoFutureCache primaryShardInfoCache;
     private final ShardStrategyFactory shardStrategyFactory;
@@ -171,7 +177,7 @@ public class ActorContext {
     public void setSchemaContext(SchemaContext schemaContext) {
         this.schemaContext = schemaContext;
 
     public void setSchemaContext(SchemaContext schemaContext) {
         this.schemaContext = schemaContext;
 
-        if(shardManager != null) {
+        if (shardManager != null) {
             shardManager.tell(new UpdateSchemaContext(schemaContext), ActorRef.noSender());
         }
     }
             shardManager.tell(new UpdateSchemaContext(schemaContext), ActorRef.noSender());
         }
     }
@@ -189,7 +195,7 @@ public class ActorContext {
 
         updated = true;
 
 
         updated = true;
 
-        if(shardManager != null) {
+        if (shardManager != null) {
             shardManager.tell(contextFactory, ActorRef.noSender());
         }
     }
             shardManager.tell(contextFactory, ActorRef.noSender());
         }
     }
@@ -200,7 +206,7 @@ public class ActorContext {
 
     public Future<PrimaryShardInfo> findPrimaryShardAsync(final String shardName) {
         Future<PrimaryShardInfo> ret = primaryShardInfoCache.getIfPresent(shardName);
 
     public Future<PrimaryShardInfo> findPrimaryShardAsync(final String shardName) {
         Future<PrimaryShardInfo> ret = primaryShardInfoCache.getIfPresent(shardName);
-        if(ret != null){
+        if (ret != null) {
             return ret;
         }
         Future<Object> future = executeOperationAsync(shardManager,
             return ret;
         }
         Future<Object> future = executeOperationAsync(shardManager,
@@ -209,20 +215,20 @@ public class ActorContext {
         return future.transform(new Mapper<Object, PrimaryShardInfo>() {
             @Override
             public PrimaryShardInfo checkedApply(Object response) throws UnknownMessageException {
         return future.transform(new Mapper<Object, PrimaryShardInfo>() {
             @Override
             public PrimaryShardInfo checkedApply(Object response) throws UnknownMessageException {
-                if(response instanceof RemotePrimaryShardFound) {
+                if (response instanceof RemotePrimaryShardFound) {
                     LOG.debug("findPrimaryShardAsync received: {}", response);
                     RemotePrimaryShardFound found = (RemotePrimaryShardFound)response;
                     return onPrimaryShardFound(shardName, found.getPrimaryPath(), found.getPrimaryVersion(), null);
                     LOG.debug("findPrimaryShardAsync received: {}", response);
                     RemotePrimaryShardFound found = (RemotePrimaryShardFound)response;
                     return onPrimaryShardFound(shardName, found.getPrimaryPath(), found.getPrimaryVersion(), null);
-                } else if(response instanceof LocalPrimaryShardFound) {
+                } else if (response instanceof LocalPrimaryShardFound) {
                     LOG.debug("findPrimaryShardAsync received: {}", response);
                     LocalPrimaryShardFound found = (LocalPrimaryShardFound)response;
                     return onPrimaryShardFound(shardName, found.getPrimaryPath(), DataStoreVersions.CURRENT_VERSION,
                             found.getLocalShardDataTree());
                     LOG.debug("findPrimaryShardAsync received: {}", response);
                     LocalPrimaryShardFound found = (LocalPrimaryShardFound)response;
                     return onPrimaryShardFound(shardName, found.getPrimaryPath(), DataStoreVersions.CURRENT_VERSION,
                             found.getLocalShardDataTree());
-                } else if(response instanceof NotInitializedException) {
+                } else if (response instanceof NotInitializedException) {
                     throw (NotInitializedException)response;
                     throw (NotInitializedException)response;
-                } else if(response instanceof PrimaryNotFoundException) {
+                } else if (response instanceof PrimaryNotFoundException) {
                     throw (PrimaryNotFoundException)response;
                     throw (PrimaryNotFoundException)response;
-                } else if(response instanceof NoShardLeaderException) {
+                } else if (response instanceof NoShardLeaderException) {
                     throw (NoShardLeaderException)response;
                 }
 
                     throw (NoShardLeaderException)response;
                 }
 
@@ -242,7 +248,7 @@ public class ActorContext {
     }
 
     /**
     }
 
     /**
-     * Finds a local shard given its shard name and return it's ActorRef
+     * Finds a local shard given its shard name and return it's ActorRef.
      *
      * @param shardName the name of the local shard that needs to be found
      * @return a reference to a local shard actor which represents the shard
      *
      * @param shardName the name of the local shard that needs to be found
      * @return a reference to a local shard actor which represents the shard
@@ -273,13 +279,13 @@ public class ActorContext {
         return future.map(new Mapper<Object, ActorRef>() {
             @Override
             public ActorRef checkedApply(Object response) throws Throwable {
         return future.map(new Mapper<Object, ActorRef>() {
             @Override
             public ActorRef checkedApply(Object response) throws Throwable {
-                if(response instanceof LocalShardFound) {
+                if (response instanceof LocalShardFound) {
                     LocalShardFound found = (LocalShardFound)response;
                     LOG.debug("Local shard found {}", found.getPath());
                     return found.getPath();
                     LocalShardFound found = (LocalShardFound)response;
                     LOG.debug("Local shard found {}", found.getPath());
                     return found.getPath();
-                } else if(response instanceof NotInitializedException) {
+                } else if (response instanceof NotInitializedException) {
                     throw (NotInitializedException)response;
                     throw (NotInitializedException)response;
-                } else if(response instanceof LocalShardNotFound) {
+                } else if (response instanceof LocalShardNotFound) {
                     throw new LocalShardNotFoundException(
                             String.format("Local shard for %s does not exist.", shardName));
                 }
                     throw new LocalShardNotFoundException(
                             String.format("Local shard for %s does not exist.", shardName));
                 }
@@ -291,49 +297,51 @@ public class ActorContext {
     }
 
     /**
     }
 
     /**
-     * Executes an operation on a local actor and wait for it's response
+     * Executes an operation on a local actor and wait for it's response.
      *
      *
-     * @param actor
-     * @param message
+     * @param actor the actor
+     * @param message the message to send
      * @return The response of the operation
      */
      * @return The response of the operation
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public Object executeOperation(ActorRef actor, Object message) {
         Future<Object> future = executeOperationAsync(actor, message, operationTimeout);
 
         try {
             return Await.result(future, operationDuration);
         } catch (Exception e) {
     public Object executeOperation(ActorRef actor, Object message) {
         Future<Object> future = executeOperationAsync(actor, message, operationTimeout);
 
         try {
             return Await.result(future, operationDuration);
         } catch (Exception e) {
-            throw new TimeoutException("Sending message " + message.getClass().toString() +
-                    " to actor " + actor.toString() + " failed. Try again later.", e);
+            throw new TimeoutException("Sending message " + message.getClass().toString()
+                    " to actor " + actor.toString() + " failed. Try again later.", e);
         }
     }
 
         }
     }
 
-    public Future<Object> executeOperationAsync(ActorRef actor, Object message, Timeout timeout) {
-        Preconditions.checkArgument(actor != null, "actor must not be null");
-        Preconditions.checkArgument(message != null, "message must not be null");
-
-        LOG.debug("Sending message {} to {}", message.getClass(), actor);
-        return doAsk(actor, message, timeout);
-    }
-
     /**
     /**
-     * Execute an operation on a remote actor and wait for it's response
+     * Execute an operation on a remote actor and wait for it's response.
      *
      *
-     * @param actor
-     * @param message
-     * @return
+     * @param actor the actor
+     * @param message the message
+     * @return the response message
      */
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public Object executeOperation(ActorSelection actor, Object message) {
         Future<Object> future = executeOperationAsync(actor, message);
 
         try {
             return Await.result(future, operationDuration);
         } catch (Exception e) {
     public Object executeOperation(ActorSelection actor, Object message) {
         Future<Object> future = executeOperationAsync(actor, message);
 
         try {
             return Await.result(future, operationDuration);
         } catch (Exception e) {
-            throw new TimeoutException("Sending message " + message.getClass().toString() +
-                    " to actor " + actor.toString() + " failed. Try again later.", e);
+            throw new TimeoutException("Sending message " + message.getClass().toString()
+                    " to actor " + actor.toString() + " failed. Try again later.", e);
         }
     }
 
         }
     }
 
+    public Future<Object> executeOperationAsync(ActorRef actor, Object message, Timeout timeout) {
+        Preconditions.checkArgument(actor != null, "actor must not be null");
+        Preconditions.checkArgument(message != null, "message must not be null");
+
+        LOG.debug("Sending message {} to {}", message.getClass(), actor);
+        return doAsk(actor, message, timeout);
+    }
+
     /**
      * Execute an operation on a remote actor asynchronously.
      *
     /**
      * Execute an operation on a remote actor asynchronously.
      *
@@ -379,11 +387,12 @@ public class ActorContext {
         actor.tell(message, ActorRef.noSender());
     }
 
         actor.tell(message, ActorRef.noSender());
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void shutdown() {
         FiniteDuration duration = datastoreContext.getShardRaftConfig().getElectionTimeOutInterval().$times(3);
         try {
             Await.ready(Patterns.gracefulStop(shardManager, duration, Shutdown.INSTANCE), duration);
     public void shutdown() {
         FiniteDuration duration = datastoreContext.getShardRaftConfig().getElectionTimeOutInterval().$times(3);
         try {
             Await.ready(Patterns.gracefulStop(shardManager, duration, Shutdown.INSTANCE), duration);
-        } catch(Exception e) {
+        } catch (Exception e) {
             LOG.warn("ShardManager for {} data store did not shutdown gracefully", getDataStoreName(), e);
         }
     }
             LOG.warn("ShardManager for {} data store did not shutdown gracefully", getDataStoreName(), e);
         }
     }
@@ -392,21 +401,21 @@ public class ActorContext {
         return clusterWrapper;
     }
 
         return clusterWrapper;
     }
 
-    public MemberName getCurrentMemberName(){
+    public MemberName getCurrentMemberName() {
         return clusterWrapper.getCurrentMemberName();
     }
 
     /**
         return clusterWrapper.getCurrentMemberName();
     }
 
     /**
-     * Send the message to each and every shard
+     * Send the message to each and every shard.
      */
      */
-    public void broadcast(final Function<Short, Object> messageSupplier, Class<?> messageClass){
-        for(final String shardName : configuration.getAllShardNames()){
+    public void broadcast(final Function<Short, Object> messageSupplier, Class<?> messageClass) {
+        for (final String shardName : configuration.getAllShardNames()) {
 
             Future<PrimaryShardInfo> primaryFuture = findPrimaryShardAsync(shardName);
             primaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
                 @Override
                 public void onComplete(Throwable failure, PrimaryShardInfo primaryShardInfo) {
 
             Future<PrimaryShardInfo> primaryFuture = findPrimaryShardAsync(shardName);
             primaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
                 @Override
                 public void onComplete(Throwable failure, PrimaryShardInfo primaryShardInfo) {
-                    if(failure != null) {
+                    if (failure != null) {
                         LOG.warn("broadcast failed to send message {} to shard {}:  {}",
                             messageClass.getSimpleName(), shardName, failure);
                     } else {
                         LOG.warn("broadcast failed to send message {} to shard {}:  {}",
                             messageClass.getSimpleName(), shardName, failure);
                     } else {
@@ -457,61 +466,64 @@ public class ActorContext {
      * This is a utility method that lets us get a Timer object for any operation. This is a little open-ended to allow
      * us to create a timer for pretty much anything.
      *
      * This is a utility method that lets us get a Timer object for any operation. This is a little open-ended to allow
      * us to create a timer for pretty much anything.
      *
-     * @param operationName
-     * @return
+     * @param operationName the name of the operation
+     * @return the Timer instance
      */
      */
-    public Timer getOperationTimer(String operationName){
+    public Timer getOperationTimer(String operationName) {
         return getOperationTimer(datastoreContext.getDataStoreName(), operationName);
     }
 
         return getOperationTimer(datastoreContext.getDataStoreName(), operationName);
     }
 
-    public Timer getOperationTimer(String dataStoreType, String operationName){
+    public Timer getOperationTimer(String dataStoreType, String operationName) {
         final String rate = MetricRegistry.name(DISTRIBUTED_DATA_STORE_METRIC_REGISTRY, dataStoreType,
                 operationName, METRIC_RATE);
         return metricRegistry.timer(rate);
     }
 
     /**
         final String rate = MetricRegistry.name(DISTRIBUTED_DATA_STORE_METRIC_REGISTRY, dataStoreType,
                 operationName, METRIC_RATE);
         return metricRegistry.timer(rate);
     }
 
     /**
-     * Get the name of the data store to which this ActorContext belongs
+     * Get the name of the data store to which this ActorContext belongs.
      *
      *
-     * @return
+     * @return the data store name
      */
     public String getDataStoreName() {
         return datastoreContext.getDataStoreName();
     }
 
     /**
      */
     public String getDataStoreName() {
         return datastoreContext.getDataStoreName();
     }
 
     /**
-     * Get the current transaction creation rate limit
-     * @return
+     * Get the current transaction creation rate limit.
+     *
+     * @return the rate limit
      */
      */
-    public double getTxCreationLimit(){
+    public double getTxCreationLimit() {
         return txRateLimiter.getTxCreationLimit();
     }
 
     /**
      * Try to acquire a transaction creation permit. Will block if no permits are available.
      */
         return txRateLimiter.getTxCreationLimit();
     }
 
     /**
      * Try to acquire a transaction creation permit. Will block if no permits are available.
      */
-    public void acquireTxCreationPermit(){
+    public void acquireTxCreationPermit() {
         txRateLimiter.acquire();
     }
 
     /**
         txRateLimiter.acquire();
     }
 
     /**
-     * Return the operation timeout to be used when committing transactions
-     * @return
+     * Returns the operation timeout to be used when committing transactions.
+     *
+     * @return the operation timeout
      */
      */
-    public Timeout getTransactionCommitOperationTimeout(){
+    public Timeout getTransactionCommitOperationTimeout() {
         return transactionCommitOperationTimeout;
     }
 
     /**
      * An akka dispatcher that is meant to be used when processing ask Futures which were triggered by client
         return transactionCommitOperationTimeout;
     }
 
     /**
      * An akka dispatcher that is meant to be used when processing ask Futures which were triggered by client
-     * code on the datastore
-     * @return
+     * code on the datastore.
+     *
+     * @return the dispatcher
      */
     public ExecutionContext getClientDispatcher() {
         return this.dispatchers.getDispatcher(Dispatchers.DispatcherType.Client);
     }
 
      */
     public ExecutionContext getClientDispatcher() {
         return this.dispatchers.getDispatcher(Dispatchers.DispatcherType.Client);
     }
 
-    public String getNotificationDispatcherPath(){
+    public String getNotificationDispatcherPath() {
         return this.dispatchers.getDispatcherPath(Dispatchers.DispatcherType.Notification);
     }
 
         return this.dispatchers.getDispatcherPath(Dispatchers.DispatcherType.Notification);
     }
 
@@ -523,11 +535,11 @@ public class ActorContext {
         return shardStrategyFactory;
     }
 
         return shardStrategyFactory;
     }
 
-    protected Future<Object> doAsk(ActorRef actorRef, Object message, Timeout timeout){
+    protected Future<Object> doAsk(ActorRef actorRef, Object message, Timeout timeout) {
         return ask(actorRef, message, timeout);
     }
 
         return ask(actorRef, message, timeout);
     }
 
-    protected Future<Object> doAsk(ActorSelection actorRef, Object message, Timeout timeout){
+    protected Future<Object> doAsk(ActorSelection actorRef, Object message, Timeout timeout) {
         return ask(actorRef, message, timeout);
     }
 
         return ask(actorRef, message, timeout);
     }
 
index 8e19441be73d836f245e8e858ccb2974846d609d..84717e188f9d64ad4e28c7446b668da641a23a96 100644 (file)
@@ -31,10 +31,11 @@ public final class DataTreeModificationOutput {
     private DataTreeModificationOutput() {
     }
 
     private DataTreeModificationOutput() {
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public static void toFile(File file, DataTreeModification modification) {
     public static void toFile(File file, DataTreeModification modification) {
-        try(FileOutputStream outStream = new FileOutputStream(file)) {
+        try (FileOutputStream outStream = new FileOutputStream(file)) {
             modification.applyToCursor(new DataTreeModificationOutputCursor(new DataOutputStream(outStream)));
             modification.applyToCursor(new DataTreeModificationOutputCursor(new DataOutputStream(outStream)));
-        } catch(Exception e) {
+        } catch (Exception e) {
             LOG.error("Error writing DataTreeModification to file {}", file, e);
         }
     }
             LOG.error("Error writing DataTreeModification to file {}", file, e);
         }
     }
@@ -52,7 +53,7 @@ public final class DataTreeModificationOutput {
                 output.write("\nDELETE -> ".getBytes());
                 output.write(current().node(child).toString().getBytes());
                 output.writeByte('\n');
                 output.write("\nDELETE -> ".getBytes());
                 output.write(current().node(child).toString().getBytes());
                 output.writeByte('\n');
-            } catch(IOException e) {
+            } catch (IOException e) {
                 Throwables.propagate(e);
             }
         }
                 Throwables.propagate(e);
             }
         }
@@ -76,7 +77,7 @@ public final class DataTreeModificationOutput {
                 output.write(": \n".getBytes());
                 NormalizedNodeXMLOutput.toStream(output, data);
                 output.writeByte('\n');
                 output.write(": \n".getBytes());
                 NormalizedNodeXMLOutput.toStream(output, data);
                 output.writeByte('\n');
-            } catch(IOException | XMLStreamException e) {
+            } catch (IOException | XMLStreamException e) {
                 Throwables.propagate(e);
             }
         }
                 Throwables.propagate(e);
             }
         }
index 15f49c3cbc7db5c8a6fdf764b1172383f6d12fc4..980289fcf9762d8e2167d107060c4f122aad3172 100644 (file)
@@ -27,34 +27,35 @@ public class Dispatchers {
         Notification(NOTIFICATION_DISPATCHER_PATH);
 
         private final String path;
         Notification(NOTIFICATION_DISPATCHER_PATH);
 
         private final String path;
-        DispatcherType(String path){
+        DispatcherType(String path) {
             this.path = path;
         }
             this.path = path;
         }
-        private String path(akka.dispatch.Dispatchers dispatchers){
-            if(dispatchers.hasDispatcher(path)){
+
+        private String path(akka.dispatch.Dispatchers dispatchers) {
+            if (dispatchers.hasDispatcher(path)) {
                 return path;
             }
             return DEFAULT_DISPATCHER_PATH;
         }
 
                 return path;
             }
             return DEFAULT_DISPATCHER_PATH;
         }
 
-        private ExecutionContext dispatcher(akka.dispatch.Dispatchers dispatchers){
-            if(dispatchers.hasDispatcher(path)){
+        private ExecutionContext dispatcher(akka.dispatch.Dispatchers dispatchers) {
+            if (dispatchers.hasDispatcher(path)) {
                 return dispatchers.lookup(path);
             }
             return dispatchers.defaultGlobalDispatcher();
         }
     }
 
                 return dispatchers.lookup(path);
             }
             return dispatchers.defaultGlobalDispatcher();
         }
     }
 
-    public Dispatchers(akka.dispatch.Dispatchers dispatchers){
+    public Dispatchers(akka.dispatch.Dispatchers dispatchers) {
         Preconditions.checkNotNull(dispatchers, "dispatchers should not be null");
         this.dispatchers = dispatchers;
     }
 
         Preconditions.checkNotNull(dispatchers, "dispatchers should not be null");
         this.dispatchers = dispatchers;
     }
 
-    public ExecutionContext getDispatcher(DispatcherType dispatcherType){
+    public ExecutionContext getDispatcher(DispatcherType dispatcherType) {
         return dispatcherType.dispatcher(this.dispatchers);
     }
 
         return dispatcherType.dispatcher(this.dispatchers);
     }
 
-    public String getDispatcherPath(DispatcherType dispatcherType){
+    public String getDispatcherPath(DispatcherType dispatcherType) {
         return dispatcherType.path(this.dispatchers);
     }
 }
         return dispatcherType.path(this.dispatchers);
     }
 }
index c0965675e0cf8675f9b5a13157d2ba47bd6f9c99..cdbad0b29df657e3871b93de8be18b19978ea702 100644 (file)
@@ -25,8 +25,9 @@ public class NormalizedNodeAggregator {
     private final List<Optional<NormalizedNode<?, ?>>> nodes;
     private final DataTree dataTree;
 
     private final List<Optional<NormalizedNode<?, ?>>> nodes;
     private final DataTree dataTree;
 
-    private NormalizedNodeAggregator(final YangInstanceIdentifier rootIdentifier, final List<Optional<NormalizedNode<?, ?>>> nodes,
-                             final SchemaContext schemaContext, LogicalDatastoreType logicalDatastoreType) {
+    private NormalizedNodeAggregator(final YangInstanceIdentifier rootIdentifier,
+            final List<Optional<NormalizedNode<?, ?>>> nodes, final SchemaContext schemaContext,
+            LogicalDatastoreType logicalDatastoreType) {
         this.rootIdentifier = rootIdentifier;
         this.nodes = nodes;
         this.dataTree = InMemoryDataTreeFactory.getInstance().create(
         this.rootIdentifier = rootIdentifier;
         this.nodes = nodes;
         this.dataTree = InMemoryDataTreeFactory.getInstance().create(
@@ -36,18 +37,11 @@ public class NormalizedNodeAggregator {
     }
 
     /**
     }
 
     /**
-     * Combine data from all the nodes in the list into a tree with root as rootIdentifier
-     *
-     * @param nodes
-     * @param schemaContext
-     * @param logicalDatastoreType
-     * @return
-     * @throws DataValidationFailedException
+     * Combine data from all the nodes in the list into a tree with root as rootIdentifier.
      */
     public static Optional<NormalizedNode<?,?>> aggregate(final YangInstanceIdentifier rootIdentifier,
      */
     public static Optional<NormalizedNode<?,?>> aggregate(final YangInstanceIdentifier rootIdentifier,
-                                                          final List<Optional<NormalizedNode<?, ?>>> nodes,
-                                                          final SchemaContext schemaContext,
-                                                          LogicalDatastoreType logicalDatastoreType) throws DataValidationFailedException {
+            final List<Optional<NormalizedNode<?, ?>>> nodes, final SchemaContext schemaContext,
+            LogicalDatastoreType logicalDatastoreType) throws DataValidationFailedException {
         return new NormalizedNodeAggregator(rootIdentifier, nodes, schemaContext, logicalDatastoreType).aggregate();
     }
 
         return new NormalizedNodeAggregator(rootIdentifier, nodes, schemaContext, logicalDatastoreType).aggregate();
     }
 
index ffcc00e557868f8a6726b0cebaf13ce87f060792..dc8c77b4328792e52417a1e3b706f1c9572049ee 100644 (file)
@@ -11,6 +11,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import javanet.staxutils.IndentingXMLStreamWriter;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
@@ -20,7 +21,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWrit
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import javanet.staxutils.IndentingXMLStreamWriter;
 
 /**
  * Utility class to output NormalizedNodes as XML.
 
 /**
  * Utility class to output NormalizedNodes as XML.
@@ -40,7 +40,7 @@ public final class NormalizedNodeXMLOutput {
         XMLStreamWriter xmlWriter = xmlFactory.createXMLStreamWriter(outStream);
 
         IndentingXMLStreamWriter indenting = new IndentingXMLStreamWriter(xmlWriter);
         XMLStreamWriter xmlWriter = xmlFactory.createXMLStreamWriter(outStream);
 
         IndentingXMLStreamWriter indenting = new IndentingXMLStreamWriter(xmlWriter);
-        try(NormalizedNodeStreamWriter streamWriter = XMLStreamNormalizedNodeStreamWriter.createSchemaless(
+        try (NormalizedNodeStreamWriter streamWriter = XMLStreamNormalizedNodeStreamWriter.createSchemaless(
                 indenting)) {
             NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(streamWriter);
             nodeWriter.write(node);
                 indenting)) {
             NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(streamWriter);
             nodeWriter.write(node);
@@ -49,9 +49,9 @@ public final class NormalizedNodeXMLOutput {
     }
 
     public static void toFile(File file, NormalizedNode<?, ?> node) {
     }
 
     public static void toFile(File file, NormalizedNode<?, ?> node) {
-        try(FileOutputStream outStream = new FileOutputStream(file)) {
+        try (FileOutputStream outStream = new FileOutputStream(file)) {
             toStream(outStream, node);
             toStream(outStream, node);
-        } catch(IOException | XMLStreamException e) {
+        } catch (IOException | XMLStreamException e) {
             LOG.error("Error writing NormalizedNode to file {}", file, e);
         }
     }
             LOG.error("Error writing NormalizedNode to file {}", file, e);
         }
     }
index 697b0c516a4000ae89e1ebbc9567d62a9a82b127..0e97cd958804ce632d1b45af74f7f6b4192f36c7 100644 (file)
@@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The PruningDataTreeModification first removes all entries from the data which do not belong in the schemaContext
 
 /**
  * The PruningDataTreeModification first removes all entries from the data which do not belong in the schemaContext
- * before delegating it to the actual DataTreeModification
+ * before delegating it to the actual DataTreeModification.
  */
 public class PruningDataTreeModification extends ForwardingObject implements DataTreeModification {
 
  */
 public class PruningDataTreeModification extends ForwardingObject implements DataTreeModification {
 
@@ -53,7 +53,7 @@ public class PruningDataTreeModification extends ForwardingObject implements Dat
     public void delete(YangInstanceIdentifier yangInstanceIdentifier) {
         try {
             delegate.delete(yangInstanceIdentifier);
     public void delete(YangInstanceIdentifier yangInstanceIdentifier) {
         try {
             delegate.delete(yangInstanceIdentifier);
-        } catch(SchemaValidationFailedException e){
+        } catch (SchemaValidationFailedException e) {
             LOG.warn("Node at path : {} does not exist ignoring delete", yangInstanceIdentifier);
         }
     }
             LOG.warn("Node at path : {} does not exist ignoring delete", yangInstanceIdentifier);
         }
     }
@@ -61,12 +61,12 @@ public class PruningDataTreeModification extends ForwardingObject implements Dat
     @Override
     public void merge(YangInstanceIdentifier yangInstanceIdentifier, NormalizedNode<?, ?> normalizedNode) {
         try {
     @Override
     public void merge(YangInstanceIdentifier yangInstanceIdentifier, NormalizedNode<?, ?> normalizedNode) {
         try {
-            if(YangInstanceIdentifier.EMPTY.equals(yangInstanceIdentifier)){
+            if (YangInstanceIdentifier.EMPTY.equals(yangInstanceIdentifier)) {
                 pruneAndMergeNode(yangInstanceIdentifier, normalizedNode);
             } else {
                 delegate.merge(yangInstanceIdentifier, normalizedNode);
             }
                 pruneAndMergeNode(yangInstanceIdentifier, normalizedNode);
             } else {
                 delegate.merge(yangInstanceIdentifier, normalizedNode);
             }
-        } catch (SchemaValidationFailedException e){
+        } catch (SchemaValidationFailedException e) {
             LOG.warn("Node at path {} was pruned during merge due to validation error: {}",
                     yangInstanceIdentifier, e.getMessage());
 
             LOG.warn("Node at path {} was pruned during merge due to validation error: {}",
                     yangInstanceIdentifier, e.getMessage());
 
@@ -78,7 +78,7 @@ public class PruningDataTreeModification extends ForwardingObject implements Dat
     private void pruneAndMergeNode(YangInstanceIdentifier yangInstanceIdentifier, NormalizedNode<?, ?> normalizedNode) {
         NormalizedNode<?,?> pruned = pruneNormalizedNode(yangInstanceIdentifier, normalizedNode);
 
     private void pruneAndMergeNode(YangInstanceIdentifier yangInstanceIdentifier, NormalizedNode<?, ?> normalizedNode) {
         NormalizedNode<?,?> pruned = pruneNormalizedNode(yangInstanceIdentifier, normalizedNode);
 
-        if(pruned != null) {
+        if (pruned != null) {
             delegate.merge(yangInstanceIdentifier, pruned);
         }
     }
             delegate.merge(yangInstanceIdentifier, pruned);
         }
     }
@@ -86,12 +86,12 @@ public class PruningDataTreeModification extends ForwardingObject implements Dat
     @Override
     public void write(YangInstanceIdentifier yangInstanceIdentifier, NormalizedNode<?, ?> normalizedNode) {
         try {
     @Override
     public void write(YangInstanceIdentifier yangInstanceIdentifier, NormalizedNode<?, ?> normalizedNode) {
         try {
-            if(YangInstanceIdentifier.EMPTY.equals(yangInstanceIdentifier)){
+            if (YangInstanceIdentifier.EMPTY.equals(yangInstanceIdentifier)) {
                 pruneAndWriteNode(yangInstanceIdentifier, normalizedNode);
             } else {
                 delegate.write(yangInstanceIdentifier, normalizedNode);
             }
                 pruneAndWriteNode(yangInstanceIdentifier, normalizedNode);
             } else {
                 delegate.write(yangInstanceIdentifier, normalizedNode);
             }
-        } catch (SchemaValidationFailedException e){
+        } catch (SchemaValidationFailedException e) {
             LOG.warn("Node at path : {} was pruned during write due to validation error: {}",
                     yangInstanceIdentifier, e.getMessage());
 
             LOG.warn("Node at path : {} was pruned during write due to validation error: {}",
                     yangInstanceIdentifier, e.getMessage());
 
@@ -102,7 +102,7 @@ public class PruningDataTreeModification extends ForwardingObject implements Dat
     private void pruneAndWriteNode(YangInstanceIdentifier yangInstanceIdentifier, NormalizedNode<?, ?> normalizedNode) {
         NormalizedNode<?,?> pruned = pruneNormalizedNode(yangInstanceIdentifier, normalizedNode);
 
     private void pruneAndWriteNode(YangInstanceIdentifier yangInstanceIdentifier, NormalizedNode<?, ?> normalizedNode) {
         NormalizedNode<?,?> pruned = pruneNormalizedNode(yangInstanceIdentifier, normalizedNode);
 
-        if(pruned != null) {
+        if (pruned != null) {
             delegate.write(yangInstanceIdentifier, pruned);
         }
     }
             delegate.write(yangInstanceIdentifier, pruned);
         }
     }
@@ -161,7 +161,7 @@ public class PruningDataTreeModification extends ForwardingObject implements Dat
         public void write(PathArgument child, NormalizedNode<?, ?> data) {
             YangInstanceIdentifier path = current().node(child);
             NormalizedNode<?, ?> prunedNode = pruningModification.pruneNormalizedNode(path, data);
         public void write(PathArgument child, NormalizedNode<?, ?> data) {
             YangInstanceIdentifier path = current().node(child);
             NormalizedNode<?, ?> prunedNode = pruningModification.pruneNormalizedNode(path, data);
-            if(prunedNode != null) {
+            if (prunedNode != null) {
                 toModification.write(path, prunedNode);
             }
         }
                 toModification.write(path, prunedNode);
             }
         }
@@ -170,7 +170,7 @@ public class PruningDataTreeModification extends ForwardingObject implements Dat
         public void merge(PathArgument child, NormalizedNode<?, ?> data) {
             YangInstanceIdentifier path = current().node(child);
             NormalizedNode<?, ?> prunedNode = pruningModification.pruneNormalizedNode(path, data);
         public void merge(PathArgument child, NormalizedNode<?, ?> data) {
             YangInstanceIdentifier path = current().node(child);
             NormalizedNode<?, ?> prunedNode = pruningModification.pruneNormalizedNode(path, data);
-            if(prunedNode != null) {
+            if (prunedNode != null) {
                 toModification.merge(path, prunedNode);
             }
         }
                 toModification.merge(path, prunedNode);
             }
         }
@@ -179,7 +179,7 @@ public class PruningDataTreeModification extends ForwardingObject implements Dat
         public void delete(PathArgument child) {
             try {
                 toModification.delete(current().node(child));
         public void delete(PathArgument child) {
             try {
                 toModification.delete(current().node(child));
-            } catch(SchemaValidationFailedException e) {
+            } catch (SchemaValidationFailedException e) {
                 // Ignoring since we would've already logged this in the call to the original modification.
             }
         }
                 // Ignoring since we would've already logged this in the call to the original modification.
             }
         }
index 97e3383490d5bb058d3999c454464c435d16ee0c..5ab07599152460171dcf8213a2e0b38d27dd6ee8 100644 (file)
@@ -41,7 +41,7 @@ public final class SerializationUtils {
 
     private static NormalizedNodeDataOutput streamWriter(DataOutput out) throws IOException {
         NormalizedNodeDataOutput streamWriter = REUSABLE_WRITER_TL.get();
 
     private static NormalizedNodeDataOutput streamWriter(DataOutput out) throws IOException {
         NormalizedNodeDataOutput streamWriter = REUSABLE_WRITER_TL.get();
-        if(streamWriter == null) {
+        if (streamWriter == null) {
             streamWriter = NormalizedNodeInputOutput.newDataOutput(out);
         }
 
             streamWriter = NormalizedNodeInputOutput.newDataOutput(out);
         }
 
@@ -50,7 +50,7 @@ public final class SerializationUtils {
 
     private static NormalizedNodeDataInput streamReader(DataInput in) throws IOException {
         NormalizedNodeDataInput streamReader = REUSABLE_READER_TL.get();
 
     private static NormalizedNodeDataInput streamReader(DataInput in) throws IOException {
         NormalizedNodeDataInput streamReader = REUSABLE_READER_TL.get();
-        if(streamReader == null) {
+        if (streamReader == null) {
             streamReader = new NormalizedNodeInputStreamReader(in);
         }
 
             streamReader = new NormalizedNodeInputStreamReader(in);
         }
 
@@ -82,17 +82,14 @@ public final class SerializationUtils {
         }
     }
 
         }
     }
 
-    public static void serializeNormalizedNode(NormalizedNode<?, ?> node, DataOutput out) {
-        try {
-            out.writeBoolean(node != null);
-            if(node != null) {
-                NormalizedNodeDataOutput streamWriter = streamWriter(out);
-                streamWriter.writeNormalizedNode(node);
-            }
-        } catch (IOException e) {
-            throw new IllegalArgumentException(String.format("Error serializing NormalizedNode %s",
-                    node), e);
+    private static NormalizedNode<?, ?> tryDeserializeNormalizedNode(DataInput in) throws IOException {
+        boolean present = in.readBoolean();
+        if (present) {
+            NormalizedNodeDataInput streamReader = streamReader(in);
+            return streamReader.readNormalizedNode();
         }
         }
+
+        return null;
     }
 
     public static NormalizedNode<?, ?> deserializeNormalizedNode(DataInput in) {
     }
 
     public static NormalizedNode<?, ?> deserializeNormalizedNode(DataInput in) {
@@ -103,20 +100,10 @@ public final class SerializationUtils {
         }
     }
 
         }
     }
 
-    private static NormalizedNode<?, ?> tryDeserializeNormalizedNode(DataInput in) throws IOException {
-        boolean present = in.readBoolean();
-        if(present) {
-            NormalizedNodeDataInput streamReader = streamReader(in);
-            return streamReader.readNormalizedNode();
-        }
-
-        return null;
-    }
-
     public static NormalizedNode<?, ?> deserializeNormalizedNode(byte [] bytes) {
         try {
             return tryDeserializeNormalizedNode(new DataInputStream(new ByteArrayInputStream(bytes)));
     public static NormalizedNode<?, ?> deserializeNormalizedNode(byte [] bytes) {
         try {
             return tryDeserializeNormalizedNode(new DataInputStream(new ByteArrayInputStream(bytes)));
-        } catch(InvalidNormalizedNodeStreamException e) {
+        } catch (InvalidNormalizedNodeStreamException e) {
             // Probably from legacy protobuf serialization - try that.
             try {
                 NormalizedNodeMessages.Node serializedNode = NormalizedNodeMessages.Node.parseFrom(bytes);
             // Probably from legacy protobuf serialization - try that.
             try {
                 NormalizedNodeMessages.Node serializedNode = NormalizedNodeMessages.Node.parseFrom(bytes);
@@ -129,6 +116,19 @@ public final class SerializationUtils {
         }
     }
 
         }
     }
 
+    public static void serializeNormalizedNode(NormalizedNode<?, ?> node, DataOutput out) {
+        try {
+            out.writeBoolean(node != null);
+            if (node != null) {
+                NormalizedNodeDataOutput streamWriter = streamWriter(out);
+                streamWriter.writeNormalizedNode(node);
+            }
+        } catch (IOException e) {
+            throw new IllegalArgumentException(String.format("Error serializing NormalizedNode %s",
+                    node), e);
+        }
+    }
+
     public static byte [] serializeNormalizedNode(NormalizedNode<?, ?> node) {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         serializeNormalizedNode(node, new DataOutputStream(bos));
     public static byte [] serializeNormalizedNode(NormalizedNode<?, ?> node) {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         serializeNormalizedNode(node, new DataOutputStream(bos));
index 58c1bd6c257af0482676421906be8d813424a9f5..32faf3a00b02d24cf8fe4c446666cae867fceee4 100644 (file)
@@ -29,21 +29,22 @@ public class TransactionRateLimiter {
 
     private volatile long pollOnCount = 1;
 
 
     private volatile long pollOnCount = 1;
 
-    public TransactionRateLimiter(ActorContext actorContext){
+    public TransactionRateLimiter(ActorContext actorContext) {
         this.actorContext = actorContext;
         this.commitTimeoutInSeconds = actorContext.getDatastoreContext().getShardTransactionCommitTimeoutInSeconds();
         this.dataStoreName = actorContext.getDataStoreName();
         this.actorContext = actorContext;
         this.commitTimeoutInSeconds = actorContext.getDatastoreContext().getShardTransactionCommitTimeoutInSeconds();
         this.dataStoreName = actorContext.getDataStoreName();
-        this.txRateLimiter = RateLimiter.create(actorContext.getDatastoreContext().getTransactionCreationInitialRateLimit());
+        this.txRateLimiter = RateLimiter.create(actorContext.getDatastoreContext()
+                .getTransactionCreationInitialRateLimit());
     }
 
     }
 
-    public void acquire(){
+    public void acquire() {
         adjustRateLimit();
         txRateLimiter.acquire();
     }
 
     private void adjustRateLimit() {
         final long count = acquireCount.incrementAndGet();
         adjustRateLimit();
         txRateLimiter.acquire();
     }
 
     private void adjustRateLimit() {
         final long count = acquireCount.incrementAndGet();
-        if(count >= pollOnCount) {
+        if (count >= pollOnCount) {
             final Timer commitTimer = actorContext.getOperationTimer(ActorContext.COMMIT);
             double newRateLimit = calculateNewRateLimit(commitTimer, commitTimeoutInSeconds);
 
             final Timer commitTimer = actorContext.getOperationTimer(ActorContext.COMMIT);
             double newRateLimit = calculateNewRateLimit(commitTimer, commitTimeoutInSeconds);
 
@@ -53,26 +54,26 @@ public class TransactionRateLimiter {
 
             if (newRateLimit >= 1.0) {
                 txRateLimiter.setRate(newRateLimit);
 
             if (newRateLimit >= 1.0) {
                 txRateLimiter.setRate(newRateLimit);
-                pollOnCount = count + ((long) newRateLimit/2);
+                pollOnCount = count + (long) newRateLimit / 2;
             }
         }
     }
 
             }
         }
     }
 
-    public double getTxCreationLimit(){
+    public double getTxCreationLimit() {
         return txRateLimiter.getRate();
     }
 
         return txRateLimiter.getRate();
     }
 
-    private double getRateLimitFromOtherDataStores(){
+    private double getRateLimitFromOtherDataStores() {
         // Since we have no rate data for unused Tx's data store, adjust to the rate from another
         // data store that does have rate data.
         // Since we have no rate data for unused Tx's data store, adjust to the rate from another
         // data store that does have rate data.
-        for(String name: DatastoreContext.getGlobalDatastoreNames()) {
-            if(name.equals(this.dataStoreName)) {
+        for (String name: DatastoreContext.getGlobalDatastoreNames()) {
+            if (name.equals(this.dataStoreName)) {
                 continue;
             }
 
             double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(name, ActorContext.COMMIT),
                     this.commitTimeoutInSeconds);
                 continue;
             }
 
             double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(name, ActorContext.COMMIT),
                     this.commitTimeoutInSeconds);
-            if(newRateLimit > 0.0) {
+            if (newRateLimit > 0.0) {
                 LOG.debug("On unused Tx - data Store {} commit rateLimit adjusted to {}",
                         this.dataStoreName, newRateLimit);
 
                 LOG.debug("On unused Tx - data Store {} commit rateLimit adjusted to {}",
                         this.dataStoreName, newRateLimit);
 
@@ -84,7 +85,7 @@ public class TransactionRateLimiter {
     }
 
     private static double calculateNewRateLimit(Timer commitTimer, long commitTimeoutInSeconds) {
     }
 
     private static double calculateNewRateLimit(Timer commitTimer, long commitTimeoutInSeconds) {
-        if(commitTimer == null) {
+        if (commitTimer == null) {
             // This can happen in unit tests.
             return 0;
         }
             // This can happen in unit tests.
             return 0;
         }
@@ -96,13 +97,13 @@ public class TransactionRateLimiter {
 
         // Find the time that it takes for transactions to get executed in every 10th percentile
         // Compute the rate limit for that percentile and sum it up
 
         // Find the time that it takes for transactions to get executed in every 10th percentile
         // Compute the rate limit for that percentile and sum it up
-        for(int i=1;i<=10;i++){
+        for (int i = 1; i <= 10; i++) {
             // Get the amount of time transactions take in the i*10th percentile
             double percentileTimeInNanos = timerSnapshot.getValue(i * 0.1D);
 
             // Get the amount of time transactions take in the i*10th percentile
             double percentileTimeInNanos = timerSnapshot.getValue(i * 0.1D);
 
-            if(percentileTimeInNanos > 0) {
+            if (percentileTimeInNanos > 0) {
                 // Figure out the rate limit for the i*10th percentile in nanos
                 // Figure out the rate limit for the i*10th percentile in nanos
-                double percentileRateLimit = (commitTimeoutInNanos / percentileTimeInNanos);
+                double percentileRateLimit = commitTimeoutInNanos / percentileTimeInNanos;
 
                 // Add the percentileRateLimit to the total rate limit
                 newRateLimit += percentileRateLimit;
 
                 // Add the percentileRateLimit to the total rate limit
                 newRateLimit += percentileRateLimit;
@@ -110,7 +111,7 @@ public class TransactionRateLimiter {
         }
 
         // Compute the rate limit per second
         }
 
         // Compute the rate limit per second
-        return newRateLimit/(commitTimeoutInSeconds*10);
+        return newRateLimit / (commitTimeoutInSeconds * 10);
     }
 
     @VisibleForTesting
     }
 
     @VisibleForTesting
@@ -119,13 +120,12 @@ public class TransactionRateLimiter {
     }
 
     @VisibleForTesting
     }
 
     @VisibleForTesting
-    void setPollOnCount(long value){
+    void setPollOnCount(long value) {
         pollOnCount = value;
     }
 
     @VisibleForTesting
         pollOnCount = value;
     }
 
     @VisibleForTesting
-    void setAcquireCount(long value){
+    void setAcquireCount(long value) {
         acquireCount.set(value);
     }
         acquireCount.set(value);
     }
-
 }
 }
index 1ab67384f17112d0ac527dc00099ed851676be54..585218f121e0edcbb25a6509989985fb15ea3e2b 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.config.yang.config.actor_system_provider.imp
 
 import akka.actor.ActorSystem;
 import akka.actor.Props;
 
 import akka.actor.ActorSystem;
 import akka.actor.Props;
-import akka.japi.Effect;
 import akka.osgi.BundleDelegatingClassLoader;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import akka.osgi.BundleDelegatingClassLoader;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
@@ -51,15 +50,11 @@ public class ActorSystemProviderImpl implements ActorSystemProvider, AutoCloseab
 
         actorSystem.actorOf(Props.create(TerminationMonitor.class), TerminationMonitor.ADDRESS);
 
 
         actorSystem.actorOf(Props.create(TerminationMonitor.class), TerminationMonitor.ADDRESS);
 
-        actorSystem.actorOf(QuarantinedMonitorActor.props(new Effect() {
-
-            @Override
-            public void apply() throws Exception {
-                // restart the entire karaf container
-                LOG.warn("Restarting karaf container");
-                System.setProperty("karaf.restart", "true");
-                bundleContext.getBundle(0).stop();
-            }
+        actorSystem.actorOf(QuarantinedMonitorActor.props(() -> {
+            // restart the entire karaf container
+            LOG.warn("Restarting karaf container");
+            System.setProperty("karaf.restart", "true");
+            bundleContext.getBundle(0).stop();
         }), QuarantinedMonitorActor.ADDRESS);
 
     }
         }), QuarantinedMonitorActor.ADDRESS);
 
     }
@@ -76,6 +71,7 @@ public class ActorSystemProviderImpl implements ActorSystemProvider, AutoCloseab
     }
 
     @Override
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         LOG.info("Shutting down ActorSystem");
 
     public void close() {
         LOG.info("Shutting down ActorSystem");
 
index 511f5dfdee7067f989c9d4077873794368f10f75..1981c203e55b41bfd6164c00fa50174623944092 100644 (file)
@@ -12,6 +12,8 @@ import akka.actor.ActorSystem;
 import com.google.common.collect.ForwardingObject;
 import org.opendaylight.controller.cluster.ActorSystemProvider;
 import org.opendaylight.controller.cluster.ActorSystemProviderListener;
 import com.google.common.collect.ForwardingObject;
 import org.opendaylight.controller.cluster.ActorSystemProvider;
 import org.opendaylight.controller.cluster.ActorSystemProviderListener;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.osgi.framework.BundleContext;
 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.osgi.framework.BundleContext;
@@ -19,11 +21,12 @@ import org.osgi.framework.BundleContext;
 public class ActorSystemProviderModule extends AbstractActorSystemProviderModule {
     private BundleContext bundleContext;
 
 public class ActorSystemProviderModule extends AbstractActorSystemProviderModule {
     private BundleContext bundleContext;
 
-    public ActorSystemProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public ActorSystemProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
         super(identifier, dependencyResolver);
     }
 
-    public ActorSystemProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, ActorSystemProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+    public ActorSystemProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver,
+            ActorSystemProviderModule oldModule, AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
index cfc623d5a583f1b3ab0c8772dfdd3929693790d6..9e150850551f50d101c3647f52370b594828a1d1 100644 (file)
@@ -24,8 +24,10 @@ import org.osgi.framework.BundleContext;
 
 public class ActorSystemProviderModuleFactory extends AbstractActorSystemProviderModuleFactory {
     @Override
 
 public class ActorSystemProviderModuleFactory extends AbstractActorSystemProviderModuleFactory {
     @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
-        ActorSystemProviderModule module = (ActorSystemProviderModule)super.createModule(instanceName,dependencyResolver,bundleContext);
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
+        ActorSystemProviderModule module = (ActorSystemProviderModule)super.createModule(instanceName,
+                dependencyResolver,bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
         module.setBundleContext(bundleContext);
         return module;
     }
@@ -33,7 +35,8 @@ public class ActorSystemProviderModuleFactory extends AbstractActorSystemProvide
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
             DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
             DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
-        ActorSystemProviderModule module = (ActorSystemProviderModule)super.createModule(instanceName, dependencyResolver,
+        ActorSystemProviderModule module = (ActorSystemProviderModule)super.createModule(instanceName,
+                dependencyResolver,
                 old, bundleContext);
         module.setBundleContext(bundleContext);
         return module;
                 old, bundleContext);
         module.setBundleContext(bundleContext);
         return module;
index 596229360ae14a849a41b12844edfb1379840b08..6723d2b4f645d5f5bfe888da11448393893b9dfc 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.config.yang.config.concurrent_data_broker;
 
 import org.opendaylight.controller.config.api.DependencyResolver;
 package org.opendaylight.controller.config.yang.config.concurrent_data_broker;
 
 import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.spi.ForwardingDOMDataBroker;
 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.spi.ForwardingDOMDataBroker;
@@ -16,11 +17,14 @@ import org.osgi.framework.BundleContext;
 public class DomConcurrentDataBrokerModule extends AbstractDomConcurrentDataBrokerModule {
     private BundleContext bundleContext;
 
 public class DomConcurrentDataBrokerModule extends AbstractDomConcurrentDataBrokerModule {
     private BundleContext bundleContext;
 
-    public DomConcurrentDataBrokerModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
+    public DomConcurrentDataBrokerModule(final ModuleIdentifier identifier,
+            final DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
         super(identifier, dependencyResolver);
     }
 
-    public DomConcurrentDataBrokerModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final DependencyResolver dependencyResolver, final DomConcurrentDataBrokerModule oldModule, final AutoCloseable oldInstance) {
+    public DomConcurrentDataBrokerModule(final ModuleIdentifier identifier,
+            final DependencyResolver dependencyResolver, final DomConcurrentDataBrokerModule oldModule,
+            final AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
index c6f5a9e70c8076b7a10e5bd251a8fe3a24116923..b44abc90607ac9151dfa0244e9332d2ad69e3e3b 100644 (file)
@@ -14,7 +14,8 @@ import org.osgi.framework.BundleContext;
 
 public class DomConcurrentDataBrokerModuleFactory extends AbstractDomConcurrentDataBrokerModuleFactory {
     @Override
 
 public class DomConcurrentDataBrokerModuleFactory extends AbstractDomConcurrentDataBrokerModuleFactory {
     @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
         DomConcurrentDataBrokerModule module = (DomConcurrentDataBrokerModule)super.createModule(instanceName,
                 dependencyResolver, bundleContext);
         module.setBundleContext(bundleContext);
         DomConcurrentDataBrokerModule module = (DomConcurrentDataBrokerModule)super.createModule(instanceName,
                 dependencyResolver, bundleContext);
         module.setBundleContext(bundleContext);
index 30763234500ee023528d6088722874cbaff846d1..e30b324a46aaaf0759e80ba12fb2abb7e48eb157 100644 (file)
@@ -10,12 +10,13 @@ package org.opendaylight.controller.config.yang.config.distributed_datastore_pro
 
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
 
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.osgi.framework.BundleContext;
 
 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.osgi.framework.BundleContext;
 
-public class DistributedConfigDataStoreProviderModule extends
-    org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedConfigDataStoreProviderModule {
+public class DistributedConfigDataStoreProviderModule extends AbstractDistributedConfigDataStoreProviderModule {
     private BundleContext bundleContext;
 
     public DistributedConfigDataStoreProviderModule(
     private BundleContext bundleContext;
 
     public DistributedConfigDataStoreProviderModule(
@@ -24,11 +25,8 @@ public class DistributedConfigDataStoreProviderModule extends
         super(identifier, dependencyResolver);
     }
 
         super(identifier, dependencyResolver);
     }
 
-    public DistributedConfigDataStoreProviderModule(
-        org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-        org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-        org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedConfigDataStoreProviderModule oldModule,
-        java.lang.AutoCloseable oldInstance) {
+    public DistributedConfigDataStoreProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver,
+            DistributedConfigDataStoreProviderModule oldModule, AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
@@ -58,22 +56,25 @@ public class DistributedConfigDataStoreProviderModule extends
 
     private static DatastoreContext newDatastoreContext(ConfigProperties inProps) {
         ConfigProperties props = inProps;
 
     private static DatastoreContext newDatastoreContext(ConfigProperties inProps) {
         ConfigProperties props = inProps;
-        if(props == null) {
+        if (props == null) {
             props = new ConfigProperties();
         }
 
         return DatastoreContext.newBuilder()
                 .logicalStoreType(LogicalDatastoreType.CONFIGURATION)
                 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
             props = new ConfigProperties();
         }
 
         return DatastoreContext.newBuilder()
                 .logicalStoreType(LogicalDatastoreType.CONFIGURATION)
                 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
-                .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue())
-                .maxShardDataChangeListenerQueueSize(props.getMaxShardDataChangeListenerQueueSize().getValue().intValue())
+                .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize()
+                        .getValue().intValue())
+                .maxShardDataChangeListenerQueueSize(props.getMaxShardDataChangeListenerQueueSize()
+                        .getValue().intValue())
                 .maxShardDataStoreExecutorQueueSize(props.getMaxShardDataStoreExecutorQueueSize().getValue().intValue())
                 .shardTransactionIdleTimeoutInMinutes(props.getShardTransactionIdleTimeoutInMinutes().getValue())
                 .operationTimeoutInSeconds(props.getOperationTimeoutInSeconds().getValue())
                 .maxShardDataStoreExecutorQueueSize(props.getMaxShardDataStoreExecutorQueueSize().getValue().intValue())
                 .shardTransactionIdleTimeoutInMinutes(props.getShardTransactionIdleTimeoutInMinutes().getValue())
                 .operationTimeoutInSeconds(props.getOperationTimeoutInSeconds().getValue())
-                .shardJournalRecoveryLogBatchSize(props.getShardJournalRecoveryLogBatchSize().
-                        getValue().intValue())
+                .shardJournalRecoveryLogBatchSize(props.getShardJournalRecoveryLogBatchSize()
+                        .getValue().intValue())
                 .shardSnapshotBatchCount(props.getShardSnapshotBatchCount().getValue().intValue())
                 .shardSnapshotBatchCount(props.getShardSnapshotBatchCount().getValue().intValue())
-                .shardSnapshotDataThresholdPercentage(props.getShardSnapshotDataThresholdPercentage().getValue().intValue())
+                .shardSnapshotDataThresholdPercentage(props.getShardSnapshotDataThresholdPercentage()
+                        .getValue().intValue())
                 .shardHeartbeatIntervalInMillis(props.getShardHeartbeatIntervalInMillis().getValue())
                 .shardInitializationTimeoutInSeconds(props.getShardInitializationTimeoutInSeconds().getValue())
                 .shardLeaderElectionTimeoutInSeconds(props.getShardLeaderElectionTimeoutInSeconds().getValue())
                 .shardHeartbeatIntervalInMillis(props.getShardHeartbeatIntervalInMillis().getValue())
                 .shardInitializationTimeoutInSeconds(props.getShardInitializationTimeoutInSeconds().getValue())
                 .shardLeaderElectionTimeoutInSeconds(props.getShardLeaderElectionTimeoutInSeconds().getValue())
index 50930abc7fa69550886a2a028414b32ce7efc709..fe12ce2e127608bfe52d6613c3e3a7c783ea918d 100644 (file)
@@ -5,16 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: distributed-datastore-provider yang module local name: distributed-config-datastore-provider
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Jun 24 17:14:50 PDT 2014
-*
-* Do not modify this file unless it is present under src/main directory
-*/
 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
 
 import org.opendaylight.controller.config.api.DependencyResolver;
 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
 
 import org.opendaylight.controller.config.api.DependencyResolver;
@@ -22,11 +12,14 @@ import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
 import org.opendaylight.controller.config.spi.Module;
 import org.osgi.framework.BundleContext;
 
 import org.opendaylight.controller.config.spi.Module;
 import org.osgi.framework.BundleContext;
 
-public class DistributedConfigDataStoreProviderModuleFactory extends org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedConfigDataStoreProviderModuleFactory {
+public class DistributedConfigDataStoreProviderModuleFactory
+        extends AbstractDistributedConfigDataStoreProviderModuleFactory {
 
     @Override
 
     @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
-        DistributedConfigDataStoreProviderModule module = (DistributedConfigDataStoreProviderModule)super.createModule(instanceName,dependencyResolver,bundleContext);
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
+        DistributedConfigDataStoreProviderModule module = (DistributedConfigDataStoreProviderModule)super.createModule(
+                instanceName,dependencyResolver,bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
         module.setBundleContext(bundleContext);
         return module;
     }
@@ -34,8 +27,8 @@ public class DistributedConfigDataStoreProviderModuleFactory extends org.openday
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
         DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
         DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
-        DistributedConfigDataStoreProviderModule module = (DistributedConfigDataStoreProviderModule)super.createModule(instanceName, dependencyResolver,
-            old, bundleContext);
+        DistributedConfigDataStoreProviderModule module = (DistributedConfigDataStoreProviderModule)super.createModule(
+                instanceName, dependencyResolver, old, bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
         module.setBundleContext(bundleContext);
         return module;
     }
index e7589e0d3621547bce0ee8fda1dd4e1280b18dcf..0597aba5e2101485b363a24a4539241551dc7a21 100644 (file)
@@ -10,25 +10,24 @@ package org.opendaylight.controller.config.yang.config.distributed_datastore_pro
 
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
 
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.osgi.framework.BundleContext;
 
 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.osgi.framework.BundleContext;
 
-public class DistributedOperationalDataStoreProviderModule extends
-    org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedOperationalDataStoreProviderModule {
+public class DistributedOperationalDataStoreProviderModule
+        extends AbstractDistributedOperationalDataStoreProviderModule {
     private BundleContext bundleContext;
 
     private BundleContext bundleContext;
 
-    public DistributedOperationalDataStoreProviderModule(
-        org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-        org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public DistributedOperationalDataStoreProviderModule(ModuleIdentifier identifier,
+            DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
         super(identifier, dependencyResolver);
     }
 
-    public DistributedOperationalDataStoreProviderModule(
-        org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-        org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-        org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedOperationalDataStoreProviderModule oldModule,
-        java.lang.AutoCloseable oldInstance) {
+    public DistributedOperationalDataStoreProviderModule(ModuleIdentifier identifier,
+            DependencyResolver dependencyResolver,DistributedOperationalDataStoreProviderModule oldModule,
+            AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
@@ -58,22 +57,25 @@ public class DistributedOperationalDataStoreProviderModule extends
 
     private static DatastoreContext newDatastoreContext(OperationalProperties inProps) {
         OperationalProperties props = inProps;
 
     private static DatastoreContext newDatastoreContext(OperationalProperties inProps) {
         OperationalProperties props = inProps;
-        if(props == null) {
+        if (props == null) {
             props = new OperationalProperties();
         }
 
         return DatastoreContext.newBuilder()
                 .logicalStoreType(LogicalDatastoreType.OPERATIONAL)
                 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
             props = new OperationalProperties();
         }
 
         return DatastoreContext.newBuilder()
                 .logicalStoreType(LogicalDatastoreType.OPERATIONAL)
                 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
-                .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue())
-                .maxShardDataChangeListenerQueueSize(props.getMaxShardDataChangeListenerQueueSize().getValue().intValue())
+                .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize()
+                        .getValue().intValue())
+                .maxShardDataChangeListenerQueueSize(props.getMaxShardDataChangeListenerQueueSize()
+                        .getValue().intValue())
                 .maxShardDataStoreExecutorQueueSize(props.getMaxShardDataStoreExecutorQueueSize().getValue().intValue())
                 .shardTransactionIdleTimeoutInMinutes(props.getShardTransactionIdleTimeoutInMinutes().getValue())
                 .operationTimeoutInSeconds(props.getOperationTimeoutInSeconds().getValue())
                 .maxShardDataStoreExecutorQueueSize(props.getMaxShardDataStoreExecutorQueueSize().getValue().intValue())
                 .shardTransactionIdleTimeoutInMinutes(props.getShardTransactionIdleTimeoutInMinutes().getValue())
                 .operationTimeoutInSeconds(props.getOperationTimeoutInSeconds().getValue())
-                .shardJournalRecoveryLogBatchSize(props.getShardJournalRecoveryLogBatchSize().
-                        getValue().intValue())
+                .shardJournalRecoveryLogBatchSize(props.getShardJournalRecoveryLogBatchSize()
+                        .getValue().intValue())
                 .shardSnapshotBatchCount(props.getShardSnapshotBatchCount().getValue().intValue())
                 .shardSnapshotBatchCount(props.getShardSnapshotBatchCount().getValue().intValue())
-                .shardSnapshotDataThresholdPercentage(props.getShardSnapshotDataThresholdPercentage().getValue().intValue())
+                .shardSnapshotDataThresholdPercentage(props.getShardSnapshotDataThresholdPercentage()
+                        .getValue().intValue())
                 .shardHeartbeatIntervalInMillis(props.getShardHeartbeatIntervalInMillis().getValue())
                 .shardInitializationTimeoutInSeconds(props.getShardInitializationTimeoutInSeconds().getValue())
                 .shardLeaderElectionTimeoutInSeconds(props.getShardLeaderElectionTimeoutInSeconds().getValue())
                 .shardHeartbeatIntervalInMillis(props.getShardHeartbeatIntervalInMillis().getValue())
                 .shardInitializationTimeoutInSeconds(props.getShardInitializationTimeoutInSeconds().getValue())
                 .shardLeaderElectionTimeoutInSeconds(props.getShardLeaderElectionTimeoutInSeconds().getValue())
index 2c76d2c1ae5339f1aefd6a3afaad43e6bf92151f..b9df9669a12a39785b816d4fb2b61ac465340622 100644 (file)
@@ -5,16 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: distributed-datastore-provider yang module local name: distributed-operational-datastore-provider
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Jun 24 17:14:50 PDT 2014
-*
-* Do not modify this file unless it is present under src/main directory
-*/
 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
 
 import org.opendaylight.controller.config.api.DependencyResolver;
 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
 
 import org.opendaylight.controller.config.api.DependencyResolver;
@@ -22,10 +12,13 @@ import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
 import org.opendaylight.controller.config.spi.Module;
 import org.osgi.framework.BundleContext;
 
 import org.opendaylight.controller.config.spi.Module;
 import org.osgi.framework.BundleContext;
 
-public class DistributedOperationalDataStoreProviderModuleFactory extends org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedOperationalDataStoreProviderModuleFactory {
+public class DistributedOperationalDataStoreProviderModuleFactory
+        extends AbstractDistributedOperationalDataStoreProviderModuleFactory {
     @Override
     @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
-        DistributedOperationalDataStoreProviderModule module = (DistributedOperationalDataStoreProviderModule)super.createModule(instanceName,dependencyResolver,bundleContext);
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
+        DistributedOperationalDataStoreProviderModule module = (DistributedOperationalDataStoreProviderModule)
+                super.createModule(instanceName,dependencyResolver,bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
         module.setBundleContext(bundleContext);
         return module;
     }
@@ -33,7 +26,8 @@ public class DistributedOperationalDataStoreProviderModuleFactory extends org.op
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
         DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
         DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
-        DistributedOperationalDataStoreProviderModule module = (DistributedOperationalDataStoreProviderModule)super.createModule(instanceName, dependencyResolver,
+        DistributedOperationalDataStoreProviderModule module = (DistributedOperationalDataStoreProviderModule)
+                super.createModule(instanceName, dependencyResolver,
             old, bundleContext);
         module.setBundleContext(bundleContext);
         return module;
             old, bundleContext);
         module.setBundleContext(bundleContext);
         return module;
index b04bf1bf81d8635c63ef0fa43ee99a6346495681..de74726d70113837990aae9a88510cf633088c38 100644 (file)
@@ -50,8 +50,8 @@ class ForwardingDistributedDataStore extends ForwardingObject implements Distrib
     }
 
     @Override
     }
 
     @Override
-    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
-            YangInstanceIdentifier path, L listener, DataChangeScope scope) {
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L>
+            registerChangeListener(YangInstanceIdentifier path, L listener, DataChangeScope scope) {
         return delegate().registerChangeListener(path, listener, scope);
     }
 
         return delegate().registerChangeListener(path, listener, scope);
     }