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 5283718..45b82dd 100644 (file)
@@ -9,6 +9,7 @@
 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;
@@ -53,13 +54,15 @@ abstract class AbstractDOMBroker extends AbstractDOMTransactionFactory<DOMStore>
         }
 
         if (treeChange) {
-            extensions = ImmutableMap.<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension>of(DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
+            extensions = ImmutableMap.of(DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
                 @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.");
 
-                    return ((DOMStoreTreeChangePublisher) publisher).registerTreeChangeListener(treeId.getRootIdentifier(), listener);
+                    return ((DOMStoreTreeChangePublisher) publisher).registerTreeChangeListener(
+                            treeId.getRootIdentifier(), listener);
                 }
             });
         } else {
@@ -72,6 +75,7 @@ abstract class AbstractDOMBroker extends AbstractDOMTransactionFactory<DOMStore>
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         super.close();
 
@@ -91,8 +95,8 @@ abstract class AbstractDOMBroker extends AbstractDOMTransactionFactory<DOMStore>
 
     @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);
@@ -107,7 +111,8 @@ abstract class AbstractDOMBroker extends AbstractDOMTransactionFactory<DOMStore>
     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());
         }
index 0570e72..d033785 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<?, ?>> {
 
-    private EnumMap<LogicalDatastoreType, T> backingTxs;
+    private final EnumMap<LogicalDatastoreType, T> backingTxs;
     private final Object identifier;
     private final Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories;
 
     /**
-     *
      * 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.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.
      *
-     * @param key
-     * @return
+     * @param key the data store type key
+     * @return the subtransaction
      * @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);
-        if(ret == null){
+        if (ret == null) {
             ret = createTransaction(key);
             backingTxs.put(key, ret);
         }
@@ -76,6 +76,7 @@ public abstract class AbstractDOMBrokerTransaction<T extends DOMStoreTransaction
         return identifier;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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);
     }
 }
index f0eebe3..54f4e82 100644 (file)
@@ -36,11 +36,13 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
         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 =
-            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();
 
@@ -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)}.
-     *
+     * <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
@@ -64,13 +66,15 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
     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
-    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);
@@ -80,7 +84,7 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
             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);
     }
 
@@ -91,7 +95,8 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
     }
 
     @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);
index c251095..43db918 100644 (file)
@@ -35,24 +35,26 @@ public abstract class AbstractDOMTransactionFactory<T extends DOMStoreTransactio
 
     /**
      * Implementations must return unique identifier for each and every call of
-     * this method;
+     * this method.
      *
      * @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();
@@ -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();
@@ -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();
index bdaa6db..2eeb955 100644 (file)
@@ -59,12 +59,13 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
      */
     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());
     }
 
-    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);
@@ -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());
 
-        if(cohorts.isEmpty()){
+        if (cohorts.isEmpty()) {
             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 {
-                    if(!cohortIterator.hasNext()) {
+                    if (!cohortIterator.hasNext()) {
                         // 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
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable failure) {
                 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) {
-                if(!cohortIterator.hasNext()) {
+                if (!cohortIterator.hasNext()) {
                     // 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
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable failure) {
                 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) {
-                if(!cohortIterator.hasNext()) {
+                if (!cohortIterator.hasNext()) {
                     // All cohorts completed successfully - we're done.
                     commitStatsTracker.addDuration(System.nanoTime() - startTime);
 
@@ -186,9 +187,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable throwable) {
                 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 Throwable t) {
+            final Throwable throwable) {
 
         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;
-        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 {
-            e = new RuntimeException("Unexpected error occurred", t);
+            e = new RuntimeException("Unexpected error occurred", throwable);
         }
 
         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()];
-        int i = 0;
+        int index = 0;
         for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
-            canCommitFutures[i++] = cohort.abort();
+            canCommitFutures[index++] = cohort.abort();
         }
 
         ListenableFuture<List<Void>> combinedFuture = Futures.allAsList(canCommitFutures);
@@ -237,8 +238,8 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @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.
@@ -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}.
-     *
      * FIXME: This class should probably be moved to yangtools common utils for re-usability and
      * unified with AsyncNotifyingListenableFutureTask.
      */
index 64d79cb..3575731 100644 (file)
@@ -27,7 +27,8 @@ public class DOMBrokerReadOnlyTransaction
      *
      * @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);
     }
 
index 58dcedc..a2693a6 100644 (file)
@@ -21,13 +21,16 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 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);
     }
 
@@ -48,6 +51,4 @@ public class DOMBrokerReadWriteTransaction
     protected DOMStoreReadWriteTransaction createTransaction(LogicalDatastoreType key) {
         return getTxFactory(key).newReadWriteTransaction();
     }
-
-
 }
index aef9f0d..4bc22e4 100644 (file)
@@ -50,6 +50,7 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
     private volatile int counter = 0;
 
     /**
+     * Constructs an instance.
      *
      * @param chainId
      *            ID of transaction chain
@@ -60,9 +61,8 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
      * @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);
@@ -94,8 +94,8 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
             }
 
             @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);
     }
-}
\ No newline at end of file
+}
index 7ad68f2..65f11c2 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> {
+
     /**
-     * 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,
index cadb61a..1badccb 100644 (file)
@@ -33,7 +33,8 @@ class ShardedDOMStoreReadTransaction extends AbstractShardedTransaction implemen
     }
 
     @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);
     }
 
index 7172770..55139d3 100644 (file)
@@ -19,8 +19,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  *
  * @author Robert Varga
  */
-final class ShardedDOMStoreReadWriteTransaction extends ShardedDOMStoreReadTransaction implements DOMStoreReadWriteTransaction {
-
+final class ShardedDOMStoreReadWriteTransaction extends ShardedDOMStoreReadTransaction
+       implements DOMStoreReadWriteTransaction {
     ShardedDOMStoreReadWriteTransaction(final ClientTransaction tx) {
         super(tx);
     }
index a253b79..f23f956 100644 (file)
@@ -21,9 +21,9 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 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<>();
@@ -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);
-        for(ActorSelection dataChangeListener : actors) {
+        for (ActorSelection dataChangeListener : actors) {
             dataChangeListener.tell(msg, getSelf());
         }
 
-        if(hasLeader) {
-            for(D reg : delayedListenerOnAllRegistrations) {
+        if (hasLeader) {
+            for (D reg : delayedListenerOnAllRegistrations) {
                 reg.createDelegate(this);
             }
 
@@ -52,8 +52,8 @@ abstract class AbstractDataListenerSupport<L extends EventListener, R extends Li
             delayedListenerOnAllRegistrations.trimToSize();
         }
 
-        if(isLeader) {
-            for(D reg : delayedListenerRegistrations) {
+        if (isLeader) {
+            for (D reg : delayedListenerRegistrations) {
                 reg.createDelegate(this);
             }
 
@@ -63,18 +63,18 @@ abstract class AbstractDataListenerSupport<L extends EventListener, R extends Li
     }
 
     @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;
-        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);
-            if(message.isRegisterOnAllInstances()) {
+            if (message.isRegisterOnAllInstances()) {
                 delayedListenerOnAllRegistrations.add(delayedReg);
             } else {
                 delayedListenerRegistrations.add(delayedReg);
@@ -99,7 +99,7 @@ abstract class AbstractDataListenerSupport<L extends EventListener, R extends Li
         actors.add(actor);
     }
 
-    protected abstract D newDelayedListenerRegistration(R message);
+    protected abstract D newDelayedListenerRegistration(M message);
 
     protected abstract ActorRef newRegistrationActor(ListenerRegistration<L> registration);
 
index 61a22d4..b7356d2 100644 (file)
@@ -23,7 +23,8 @@ import org.slf4j.LoggerFactory;
  */
 @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;
@@ -50,14 +51,15 @@ abstract class AbstractShardDataTreeNotificationPublisherActorProxy implements S
     }
 
     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(
-                            org.opendaylight.controller.cluster.datastore.utils.ActorContext.BOUNDED_MAILBOX), actorName);
+                            org.opendaylight.controller.cluster.datastore.utils.ActorContext.BOUNDED_MAILBOX),
+                    actorName);
         }
 
         return notifierActor;
index 377af4d..f7f8af2 100644 (file)
@@ -57,7 +57,8 @@ abstract class AbstractShardDataTreeTransaction<T extends DataTreeSnapshot> {
 
     @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();
index b5afd59..69c69bb 100644 (file)
@@ -62,7 +62,9 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
         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(),
@@ -70,7 +72,7 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
 
             try {
                 return createLocalTransactionContext(local, parent);
-            } catch(Exception e) {
+            } catch (Exception e) {
                 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) {
-        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);
-            if(localContext != null) {
+            if (localContext != null) {
                 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());
-        if(findPrimaryFuture.isCompleted()) {
+        if (findPrimaryFuture.isCompleted()) {
             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);
@@ -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()) {
-            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);
             }
-        } else if(knownLocal.containsKey(shardName)) {
+        } else if (knownLocal.containsKey(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.
      *
-     * @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.
@@ -196,7 +197,8 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
      * 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.
@@ -208,7 +210,7 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
     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) {
@@ -248,8 +250,8 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
                         throw new UnsupportedOperationException();
                     }
                 };
-             default:
-                 throw new IllegalArgumentException("Invalid transaction type: " + parent.getType());
+            default:
+                throw new IllegalArgumentException("Invalid transaction type: " + parent.getType());
         }
     }
 }
index 401c15b..799dd6e 100644 (file)
@@ -24,7 +24,8 @@ final class ChainedCommitCohort extends ShardDataTreeCohort {
     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);
@@ -41,9 +42,9 @@ final class ChainedCommitCohort extends ShardDataTreeCohort {
             }
 
             @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();
     }
-}
\ No newline at end of file
+}
index 5622913..38d23f6 100644 (file)
@@ -21,24 +21,23 @@ public class ClusterWrapperImpl implements ClusterWrapper {
     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,
-            "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
-    public void subscribeToMemberEvents(ActorRef actorRef){
+    public void subscribeToMemberEvents(ActorRef actorRef) {
         Preconditions.checkNotNull(actorRef, "actorRef should not be null");
 
         cluster.subscribe(actorRef, ClusterEvent.initialStateAsEvents(),
index 767749a..f585bb6 100644 (file)
@@ -80,16 +80,17 @@ final class CohortEntry {
         return lastBatchedModificationsException;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     void applyModifications(final Iterable<Modification> modifications) {
         totalBatchedModificationsReceived++;
-        if(lastBatchedModificationsException == null) {
+        if (lastBatchedModificationsException == null) {
             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();
 
-        if(cohortDecorator != null) {
+        if (cohortDecorator != null) {
             // Call the hook for unit tests.
             cohort = cohortDecorator.decorate(transactionID, cohort);
         }
@@ -152,4 +153,4 @@ final class CohortEntry {
                 .append(doImmediateCommit).append("]");
         return builder.toString();
     }
-}
\ No newline at end of file
+}
index 8115473..05b9981 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.japi.Function;
 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;
 
 /**
- *
  * 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.
  *
@@ -73,13 +71,10 @@ class CompositeDataTreeCohort {
         COMMITED,
         /**
          * Some of cohorts responsed back with unsuccessful message.
-         *
          */
         FAILED,
         /**
-         *
          * Abort message was send to all cohorts which responded with success previously.
-         *
          */
         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.
-        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);
     }
@@ -145,18 +135,13 @@ class CompositeDataTreeCohort {
     }
 
     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());
index d572beb..b79f304 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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
+ * Actor for a DataChangeListener.
+ *
  * @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;
 
@@ -39,9 +37,9 @@ public class DataChangeListener extends AbstractUntypedActor {
 
     @Override
     public void handleReceive(Object message) {
-        if (message instanceof DataChanged){
+        if (message instanceof DataChanged) {
             dataChanged(message);
-        } else if (message instanceof EnableNotification){
+        } else if (message instanceof EnableNotification) {
             enableNotification((EnableNotification) message);
         } else {
             unknownMessage(message);
@@ -50,14 +48,15 @@ public class DataChangeListener extends AbstractUntypedActor {
 
     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);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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;
         }
@@ -73,7 +72,7 @@ public class DataChangeListener extends AbstractUntypedActor {
             LOG.error( String.format( "Error notifying listener %s", this.listener ), e );
         }
 
-        if(isValidSender(getSender())) {
+        if (isValidSender(getSender())) {
             getSender().tell(DataChangedReply.INSTANCE, getSelf());
         }
     }
index afec1a0..d70dcb2 100644 (file)
@@ -18,9 +18,9 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 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) {
index 29e4a1a..06ad83c 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();
 
-        if(isValidSender(getSender())) {
+        if (isValidSender(getSender())) {
             getSender().tell(CloseDataChangeListenerRegistrationReply.INSTANCE, getSelf());
         }
 
index 534beea..9eba41a 100644 (file)
@@ -49,8 +49,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
     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;
@@ -72,20 +71,20 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
     }
 
     private void setListenerRegistrationActor(ActorSelection listenerRegistrationActor) {
-        if(listenerRegistrationActor == null) {
+        if (listenerRegistrationActor == null) {
             return;
         }
 
         boolean sendCloseMessage = false;
-        synchronized(this) {
-            if(closed) {
+        synchronized (this) {
+            if (closed) {
                 sendCloseMessage = true;
             } else {
                 this.listenerRegistrationActor = listenerRegistrationActor;
             }
         }
 
-        if(sendCloseMessage) {
+        if (sendCloseMessage) {
             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) {
-                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);
                 }
@@ -120,10 +119,10 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
                     listener instanceof ClusteredDOMDataChangeListener),
                 actorContext.getDatastoreContext().getShardInitializationTimeout());
 
-        future.onComplete(new OnComplete<Object>(){
+        future.onComplete(new OnComplete<Object>() {
             @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 {
@@ -139,17 +138,17 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
     public void close() {
 
         boolean sendCloseMessage;
-        synchronized(this) {
+        synchronized (this) {
             sendCloseMessage = !closed && listenerRegistrationActor != null;
             closed = true;
         }
 
-        if(sendCloseMessage) {
+        if (sendCloseMessage) {
             listenerRegistrationActor.tell(CloseDataChangeListenerRegistration.INSTANCE, ActorRef.noSender());
             listenerRegistrationActor = null;
         }
 
-        if(dataChangeListenerActor != null) {
+        if (dataChangeListenerActor != null) {
             dataChangeListenerActor.tell(PoisonPill.getInstance(), ActorRef.noSender());
             dataChangeListenerActor = null;
         }
index f4b6bcc..26d8fa1 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
-        if(!message.isRegisterOnAllInstances()) {
+        if (!message.isRegisterOnAllInstances()) {
             addListenerActor(dataChangeListenerPath);
         }
 
index f40438b..d11ce38 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;
 
 /**
+ * Payload wrapper for a DataTreeCandidatePayload.
+ *
  * @deprecated Deprecated in Boron in favor of CommitTransactionPayload
  */
 @Deprecated
@@ -28,6 +30,9 @@ final class DataTreeCandidatePayload extends Payload implements Externalizable,
 
     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
     }
@@ -37,6 +42,8 @@ final class DataTreeCandidatePayload extends Payload implements Externalizable,
     }
 
     /**
+     * Creates a DataTreeCandidatePayload.
+     *
      * @deprecated Use CommitTransactionPayload instead
      */
     @Deprecated
index 03978f2..b3e0fb6 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.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 {
-    private static final Logger LOG = LoggerFactory.getLogger(DataTreeChangeListenerActor.class);
     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) {
@@ -67,7 +65,7 @@ final class DataTreeChangeListenerActor extends AbstractUntypedActor {
 
     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);
     }
 
index a45ae52..4776f2e 100644 (file)
@@ -41,11 +41,12 @@ final class DataTreeChangeListenerProxy<T extends DOMDataTreeChangeListener> ext
     @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(
-            DataTreeChangeListenerActor.props(getInstance()).withDispatcher(actorContext.getNotificationDispatcherPath()));
+                DataTreeChangeListenerActor.props(getInstance())
+                    .withDispatcher(actorContext.getNotificationDispatcherPath()));
     }
 
     @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) {
-                    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) {
-                    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);
                 }
@@ -100,7 +101,7 @@ final class DataTreeChangeListenerProxy<T extends DOMDataTreeChangeListener> ext
                         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) {
index 5994f30..79da59f 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();
-            if(isValidSender(getSender())) {
+            if (isValidSender(getSender())) {
                 getSender().tell(CloseDataTreeChangeListenerRegistrationReply.getInstance(), getSelf());
             }
 
@@ -46,7 +46,8 @@ public final class DataTreeChangeListenerRegistrationActor extends AbstractUntyp
         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;
 
index fa55523..f039ab7 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,
-        RegisterDataTreeChangeListener, DelayedDataTreeListenerRegistration, ListenerRegistration<DOMDataTreeChangeListener>> {
+        RegisterDataTreeChangeListener, DelayedDataTreeListenerRegistration,
+        ListenerRegistration<DOMDataTreeChangeListener>> {
     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
-        if(!message.isRegisterOnAllInstances()) {
+        if (!message.isRegisterOnAllInstances()) {
             addListenerActor(dataChangeListenerPath);
         }
 
@@ -54,7 +55,8 @@ final class DataTreeChangeListenerSupport extends AbstractDataListenerSupport<DO
     }
 
     @Override
-    protected DelayedDataTreeListenerRegistration newDelayedListenerRegistration(RegisterDataTreeChangeListener message) {
+    protected DelayedDataTreeListenerRegistration newDelayedListenerRegistration(
+            RegisterDataTreeChangeListener message) {
         return new DelayedDataTreeListenerRegistration(message);
     }
 
index 10ffe1f..0be8f09 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.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 {
-    private static final Logger LOG = LoggerFactory.getLogger(DataTreeCohortActor.class);
     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
      */
-    static abstract class CommitProtocolCommand<R extends CommitReply> {
+    abstract static class CommitProtocolCommand<R extends CommitReply> {
 
         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;
@@ -109,7 +106,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
 
     static final class Success extends CommitReply {
 
-        public Success(ActorRef cohortRef, TransactionIdentifier txId) {
+        Success(ActorRef cohortRef, TransactionIdentifier txId) {
             super(cohortRef, txId);
         }
 
@@ -117,26 +114,26 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
 
     static final class PreCommit extends CommitProtocolCommand<Success> {
 
-        public PreCommit(TransactionIdentifier txId) {
+        PreCommit(TransactionIdentifier txId) {
             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> {
 
-        public Commit(TransactionIdentifier txId) {
+        Commit(TransactionIdentifier txId) {
             super(txId);
         }
     }
 
-    private static abstract class CohortBehaviour<E> {
+    private abstract static class CohortBehaviour<E> {
 
         abstract Class<E> getHandledMessageType();
 
@@ -163,6 +160,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
         }
 
         @Override
+        @SuppressWarnings("checkstyle:IllegalCatch")
         CohortBehaviour<?> process(CanCommit message) {
             final PostCanCommitStep nextStep;
             try {
@@ -203,6 +201,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
         }
 
         @Override
+        @SuppressWarnings("checkstyle:IllegalCatch")
         final CohortBehaviour<?> abort() {
             try {
                 getStep().abort().get();
@@ -229,6 +228,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
         }
 
         @Override
+        @SuppressWarnings("checkstyle:IllegalCatch")
         CohortBehaviour<?> process(PreCommit message) {
             final PostPreCommitStep nextStep;
             try {
@@ -250,6 +250,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
         }
 
         @Override
+        @SuppressWarnings("checkstyle:IllegalCatch")
         CohortBehaviour<?> process(Commit message) {
             try {
                 getStep().commit().get();
index fb3743d..4364e22 100644 (file)
@@ -48,7 +48,7 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
 
     private final Map<ActorRef, RegistrationTreeNode<ActorRef>> cohortToNode = new HashMap<>();
 
-
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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;
 
@@ -137,7 +137,8 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
         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;
@@ -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;
@@ -189,9 +190,9 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
 
         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) {
-                final CanCommit message = new DataTreeCohortActor.CanCommit(txId, candidate, schema, reg);
+                final CanCommit message = new DataTreeCohortActor.CanCommit(txId, domCandidate, schema, reg);
                 messages.add(message);
             }
         }
index c269312..18146b7 100644 (file)
@@ -76,9 +76,9 @@ public class DataTreeCohortRegistrationProxy<C extends DOMDataTreeCommitCohort>
         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();
index cf14ebe..0536e4b 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_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);
@@ -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 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;
 
-    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;
@@ -76,7 +78,7 @@ public class DatastoreContext {
     private String shardManagerPersistenceId;
 
     public static Set<String> getGlobalDatastoreNames() {
-        return globalDatastoreNames;
+        return GLOBAL_DATASTORE_NAMES;
     }
 
     private DatastoreContext() {
@@ -172,11 +174,11 @@ public class DatastoreContext {
         return configurationReader;
     }
 
-    public long getShardElectionTimeoutFactor(){
+    public long getShardElectionTimeoutFactor() {
         return raftConfig.getElectionTimeoutFactor();
     }
 
-    public String getDataStoreName(){
+    public String getDataStoreName() {
         return dataStoreName;
     }
 
@@ -196,12 +198,12 @@ public class DatastoreContext {
         raftConfig.setPeerAddressResolver(resolver);
     }
 
-    private void setHeartbeatInterval(long shardHeartbeatIntervalInMillis){
+    private void setHeartbeatInterval(long shardHeartbeatIntervalInMillis) {
         raftConfig.setHeartBeatInterval(new FiniteDuration(shardHeartbeatIntervalInMillis,
                 TimeUnit.MILLISECONDS));
     }
 
-    private void setShardJournalRecoveryLogBatchSize(int shardJournalRecoveryLogBatchSize){
+    private void setShardJournalRecoveryLogBatchSize(int shardJournalRecoveryLogBatchSize) {
         raftConfig.setJournalRecoveryLogBatchSize(shardJournalRecoveryLogBatchSize);
     }
 
@@ -267,7 +269,7 @@ public class DatastoreContext {
         private Builder(DatastoreContext datastoreContext) {
             this.datastoreContext = datastoreContext;
 
-            if(datastoreContext.getDataStoreProperties() != null) {
+            if (datastoreContext.getDataStoreProperties() != null) {
                 maxShardDataChangeExecutorPoolSize =
                         datastoreContext.getDataStoreProperties().getMaxDataChangeExecutorPoolSize();
                 maxShardDataChangeExecutorQueueSize =
@@ -362,12 +364,12 @@ public class DatastoreContext {
             return shardLeaderElectionTimeout(timeout, TimeUnit.SECONDS);
         }
 
-        public Builder configurationReader(AkkaConfigurationReader configurationReader){
+        public Builder configurationReader(AkkaConfigurationReader configurationReader) {
             datastoreContext.configurationReader = configurationReader;
             return this;
         }
 
-        public Builder persistent(boolean persistent){
+        public Builder persistent(boolean persistent) {
             datastoreContext.persistent = persistent;
             return this;
         }
@@ -377,35 +379,35 @@ public class DatastoreContext {
             return this;
         }
 
-        public Builder shardElectionTimeoutFactor(long shardElectionTimeoutFactor){
+        public Builder shardElectionTimeoutFactor(long shardElectionTimeoutFactor) {
             datastoreContext.setElectionTimeoutFactor(shardElectionTimeoutFactor);
             return this;
         }
 
-        public Builder transactionCreationInitialRateLimit(long initialRateLimit){
+        public Builder transactionCreationInitialRateLimit(long initialRateLimit) {
             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) {
-            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;
         }
 
-        public Builder dataStoreName(String dataStoreName){
+        public Builder dataStoreName(String dataStoreName) {
             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);
 
-            if(datastoreContext.dataStoreName != null) {
-                globalDatastoreNames.add(datastoreContext.dataStoreName);
+            if (datastoreContext.dataStoreName != null) {
+                GLOBAL_DATASTORE_NAMES.add(datastoreContext.dataStoreName);
             }
 
             return datastoreContext;
index fcd72fa..abf07ec 100644 (file)
@@ -46,7 +46,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
 
         ServiceReference<ConfigurationAdmin> configAdminServiceReference =
                 bundleContext.getServiceReference(ConfigurationAdmin.class);
-        if(configAdminServiceReference == null) {
+        if (configAdminServiceReference == null) {
             LOG.warn("No ConfigurationAdmin service found");
         } else {
             overlaySettings(configAdminServiceReference);
@@ -60,18 +60,19 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
         this.listener = listener;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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);
 
-                if(introspector.update(properties)) {
-                    if(listener != null) {
+                if (introspector.update(properties)) {
+                    if (listener != null) {
                         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(IllegalStateException e) {
+        } catch (IllegalStateException e) {
             // Ignore - indicates the bundleContext has been closed.
         } finally {
             try {
@@ -95,7 +96,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
     public void close() {
         listener = null;
 
-        if(configListenerServiceRef != null) {
+        if (configListenerServiceRef != null) {
             configListenerServiceRef.unregister();
         }
     }
@@ -103,7 +104,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
     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());
             }
index 9d4a5c8..1f09118 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.Comparator;
 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);
 
-    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 {
@@ -66,11 +65,12 @@ public class DatastoreContextIntrospector {
      * 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();
-        for(Class<?> primitive: primitives) {
+        for (Class<?> primitive: primitives) {
             try {
                 processPropertyType(primitive);
             } catch (Exception e) {
@@ -86,9 +86,9 @@ public class DatastoreContextIntrospector {
      * 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);
-        for(PropertyDescriptor desc: beanInfo.getPropertyDescriptors()) {
+        for (PropertyDescriptor desc: beanInfo.getPropertyDescriptors()) {
             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.
-        for(MethodDescriptor desc: beanInfo.getMethodDescriptors()) {
+        for (MethodDescriptor desc: beanInfo.getMethodDescriptors()) {
             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);
             }
@@ -121,12 +121,14 @@ public class DatastoreContextIntrospector {
     /**
      * Processes a property defined on the DataStoreProperties interface.
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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);
-            dataStorePropTypes.put(name, propertyType);
+            DATA_STORE_PROP_TYPES.put(name, propertyType);
         } 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);
-        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.
-        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.
-            for(Constructor<?> ctor: propertyType.getConstructors()) {
+            for (Constructor<?> ctor: propertyType.getConstructors()) {
                 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]);
-                    constructors.put(propertyType, ctor);
+                    CONSTRUCTORS.put(propertyType, ctor);
                     break;
                 }
             }
@@ -170,9 +170,9 @@ public class DatastoreContextIntrospector {
      */
     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;
             }
         }
@@ -198,7 +198,7 @@ public class DatastoreContextIntrospector {
     }
 
     public synchronized DatastoreContext getShardDatastoreContext(String forShardName) {
-        if(currentProperties == null) {
+        if (currentProperties == null) {
             return context;
         }
 
@@ -208,13 +208,13 @@ public class DatastoreContextIntrospector {
 
         List<String> keys = getSortedKeysByDatastoreType(currentProperties.keySet(), dataStoreTypePrefix);
 
-        for(String key: keys) {
+        for (String key: keys) {
             Object value = currentProperties.get(key);
-            if(key.startsWith(dataStoreTypePrefix)) {
+            if (key.startsWith(dataStoreTypePrefix)) {
                 key = key.replaceFirst(dataStoreTypePrefix, "");
             }
 
-            if(key.startsWith(shardNamePrefix)) {
+            if (key.startsWith(shardNamePrefix)) {
                 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;
-        if(properties == null || properties.isEmpty()) {
+        if (properties == null || properties.isEmpty()) {
             return false;
         }
 
@@ -247,23 +247,23 @@ public class DatastoreContextIntrospector {
         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.
-            if(key.startsWith(dataStoreTypePrefix)) {
+            if (key.startsWith(dataStoreTypePrefix)) {
                 key = key.replaceFirst(dataStoreTypePrefix, "");
             }
 
-            if(convertValueAndInvokeSetter(key, value, builder)) {
+            if (convertValueAndInvokeSetter(key, value, builder)) {
                 updated = true;
             }
         }
 
         currentProperties = mapBuilder.build();
 
-        if(updated) {
+        if (updated) {
             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);
-        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;
     }
 
+    @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);
-            if(value == null) {
+            if (value == null) {
                 return false;
             }
 
@@ -299,7 +295,7 @@ public class DatastoreContextIntrospector {
                     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()));
 
@@ -313,7 +309,7 @@ public class DatastoreContextIntrospector {
 
     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);
@@ -323,8 +319,8 @@ public class DatastoreContextIntrospector {
     }
 
     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;
         }
@@ -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.
-        Method getter = yangTypeGetters.get(converted.getClass());
-        if(getter != null) {
+        Method getter = YANG_TYPE_GETTERS.get(converted.getClass());
+        if (getter != null) {
             converted = getter.invoke(converted);
         }
 
@@ -350,11 +346,11 @@ public class DatastoreContextIntrospector {
         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);
 
-        if(ctor == null) {
+        if (ctor == null) {
             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.
-        if(!ctor.getParameterTypes()[0].equals(String.class)) {
+        if (!ctor.getParameterTypes()[0].equals(String.class)) {
             value = constructorValueRecursively(ctor.getParameterTypes()[0], fromValue);
         }
 
index 52ab303..87c8817 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
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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;
         }
 
-        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;
         }
 
@@ -66,24 +68,25 @@ public class DatastoreSnapshotRestore {
 
         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());
 
-            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 {
-            if(!restoreFile.delete()) {
+            if (!restoreFile.delete()) {
                 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();
         }
     }
index e0b5c1f..1277854 100644 (file)
@@ -47,9 +47,9 @@ class DebugThreePhaseCommitCohort extends AbstractThreePhaseCommitCohort<Object>
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable failure) {
                 log.warn("Transaction {} failed with error \"{}\" - was allocated in the following context",
-                        transactionId, t, debugContext);
+                        transactionId, failure, debugContext);
             }
         });
 
index bf52aa1..a947734 100644 (file)
@@ -35,14 +35,16 @@ final class DefaultShardDataChangeListenerPublisher implements ShardDataChangeLi
     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
-    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);
 
@@ -57,8 +59,9 @@ final class DefaultShardDataChangeListenerPublisher implements ShardDataChangeLi
     }
 
     @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);
     }
 
index 8f18cb7..837242d 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;
 
-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;
 
-    protected DelayedListenerRegistration(R registrationMessage) {
+    protected DelayedListenerRegistration(M registrationMessage) {
         this.registrationMessage = registrationMessage;
     }
 
-    R getRegistrationMessage() {
+    M getRegistrationMessage() {
         return registrationMessage;
     }
 
@@ -33,10 +33,10 @@ abstract class DelayedListenerRegistration<L extends EventListener, R> implement
         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) {
-            final Entry<LR, Optional<DataTreeCandidate>> res = factory.createDelegate(registrationMessage);
+            final Entry<R, Optional<DataTreeCandidate>> res = factory.createDelegate(registrationMessage);
             this.delegate = res.getKey();
         }
     }
index 3b9b7ad..1542fd6 100644 (file)
@@ -12,9 +12,9 @@ import java.util.Map.Entry;
 /**
  * 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);
index e4d17ac..cb6d44d 100644 (file)
@@ -51,10 +51,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- *
+ * Implements a distributed DOMStore.
  */
 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);
 
@@ -76,6 +77,7 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
 
     private final TransactionContextFactory txContextFactory;
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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();
 
-        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,
-                shardManagerId), cluster, configuration, datastoreContextFactory.getBaseDatastoreContext(), primaryShardInfoCache);
+                shardManagerId), cluster, configuration, datastoreContextFactory.getBaseDatastoreContext(),
+                primaryShardInfoCache);
 
         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);
 
-        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);
 
@@ -125,8 +130,8 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
         datastoreConfigMXBean.setContext(datastoreContextFactory.getBaseDatastoreContext());
         datastoreConfigMXBean.registerMBean();
 
-        datastoreInfoMXBean = new DatastoreInfoMXBeanImpl(datastoreContextFactory.getBaseDatastoreContext().
-                getDataStoreMXBeanType(), actorContext);
+        datastoreInfoMXBean = new DatastoreInfoMXBeanImpl(datastoreContextFactory.getBaseDatastoreContext()
+                .getDataStoreMXBeanType(), actorContext);
         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.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) {
@@ -166,7 +171,8 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
     }
 
     @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");
 
@@ -205,7 +211,7 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
-       return new TransactionProxy(txContextFactory, TransactionType.READ_ONLY);
+        return new TransactionProxy(txContextFactory, TransactionType.READ_ONLY);
     }
 
     @Override
@@ -234,6 +240,7 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         LOG.info("Closing data store {}", identifier);
 
@@ -265,33 +272,35 @@ public class DistributedDataStore implements DistributedDataStoreInterface, Sche
         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.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);
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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);
-            } catch (Exception e){
+            } catch (Exception e) {
                 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 7ca21d4..12e4294 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
 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;
index d8d7bdd..6b901b4 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;
 
-final class FrontendHistoryMetadataBuilder implements Builder<FrontendHistoryMetadata>, Identifiable<LocalHistoryIdentifier> {
+final class FrontendHistoryMetadataBuilder implements Builder<FrontendHistoryMetadata>,
+        Identifiable<LocalHistoryIdentifier> {
     private final LocalHistoryIdentifier identifier;
 
     private long nextTransaction;
index 8ce2857..8e22d5f 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.
  *
- * <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;
index 1419a52..610212f 100644 (file)
@@ -40,7 +40,8 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort {
     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);
@@ -58,7 +59,7 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort {
     }
 
     private Future<Object> initiateCommit(final boolean immediate) {
-        if(operationError != null) {
+        if (operationError != null) {
             return Futures.failed(operationError);
         }
 
@@ -132,9 +133,9 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort {
         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 2e329dd..df57ede 100644 (file)
@@ -80,11 +80,11 @@ final class LocalTransactionChain extends AbstractSnapshotBackedTransactionChain
         return super.newWriteOnlyTransaction(identifier);
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
     @Override
     public LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
             @Nullable Exception operationError) {
-        if(operationError != null) {
+        if (operationError != null) {
             return new LocalChainThreePhaseCommitCohort((SnapshotBackedWriteTransaction<TransactionIdentifier>)tx,
                     operationError);
         }
index 0dbd2a2..76bafb7 100644 (file)
@@ -43,9 +43,10 @@ abstract class LocalTransactionContext extends AbstractTransactionContext {
     protected abstract DOMStoreReadTransaction getReadDelegate();
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void executeModification(AbstractModification modification) {
         incrementModificationCount();
-        if(operationError == null) {
+        if (operationError == null) {
             try {
                 modification.apply(getWriteDelegate());
             } catch (Exception e) {
@@ -63,8 +64,8 @@ abstract class LocalTransactionContext extends AbstractTransactionContext {
             }
 
             @Override
-            public void onFailure(final Throwable t) {
-                proxyFuture.setException(t);
+            public void onFailure(final Throwable failure) {
+                proxyFuture.setException(failure);
             }
         });
     }
index 7c05fef..935db99 100644 (file)
@@ -66,16 +66,16 @@ final class LocalTransactionFactoryImpl extends TransactionReadyPrototype<Transa
     }
 
     @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);
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
     @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);
         }
index 3f5a152..009c964 100644 (file)
@@ -24,7 +24,7 @@ final class NoOpTransactionContext extends AbstractTransactionContext {
 
     private final Throwable failure;
 
-    public NoOpTransactionContext(Throwable failure, TransactionIdentifier identifier) {
+    NoOpTransactionContext(Throwable failure, TransactionIdentifier identifier) {
         super(identifier);
         this.failure = failure;
     }
@@ -48,8 +48,8 @@ final class NoOpTransactionContext extends AbstractTransactionContext {
 
     @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
index c20b102..da0b62b 100644 (file)
@@ -36,14 +36,18 @@ interface OperationCallback {
     class Reference extends AtomicReference<OperationCallback> {
         private static final long serialVersionUID = 1L;
 
-        public Reference(OperationCallback initialValue) {
+        Reference(OperationCallback initialValue) {
             super(initialValue);
         }
     }
 
     void run();
+
     void pause();
+
     void resume();
+
     void success();
+
     void failure();
 }
index ad26d0a..c035790 100644 (file)
@@ -71,14 +71,14 @@ public class OperationLimiter extends OnComplete<Object> {
     }
 
     @VisibleForTesting
-    int availablePermits(){
+    int availablePermits() {
         return semaphore.availablePermits();
     }
 
     /**
-     * Release all the permits
+     * Release all the permits.
      */
     public void releaseAll() {
-        this.semaphore.release(maxPermits-availablePermits());
+        this.semaphore.release(maxPermits - availablePermits());
     }
 }
index 603fb20..6334bdc 100644 (file)
@@ -50,7 +50,7 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
         this.actorContext = actorContext;
     }
 
-    private Future<Object> completeOperation(Future<Object> operationFuture){
+    private Future<Object> completeOperation(Future<Object> operationFuture) {
         operationFuture.onComplete(limiter, actorContext.getClientDispatcher());
         return operationFuture;
     }
@@ -110,14 +110,14 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
 
     private void batchModification(Modification modification) {
         incrementModificationCount();
-        if(batchedModifications == null) {
+        if (batchedModifications == null) {
             batchedModifications = newBatchedModifications();
         }
 
         batchedModifications.addModification(modification);
 
-        if(batchedModifications.getModifications().size() >=
-                actorContext.getDatastoreContext().getShardBatchedModificationCount()) {
+        if (batchedModifications.getModifications().size()
+                >= actorContext.getDatastoreContext().getShardBatchedModificationCount()) {
             sendBatchedModifications();
         }
     }
@@ -128,22 +128,20 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
 
     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();
             }
 
-            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());
 
-            if(ready) {
+            if (ready) {
                 batchedModifications = null;
             } else {
                 batchedModifications = newBatchedModifications();
@@ -155,10 +153,8 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
 
     @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);
@@ -166,10 +162,8 @@ public class RemoteTransactionContext extends AbstractTransactionContext {
 
     @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.
@@ -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 {
-                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 {
-                    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);
                 }
             }
@@ -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.
      */
-    private final void acquireOperation() {
+    private void acquireOperation() {
         if (isOperationHandOffComplete()) {
             limiter.acquire();
         }
index 2924eaa..1e0d127 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.
- * <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
@@ -59,8 +59,8 @@ final class RemoteTransactionContextSupport {
 
     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;
@@ -100,8 +100,8 @@ final class RemoteTransactionContextSupport {
     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",
@@ -120,10 +120,8 @@ final class RemoteTransactionContextSupport {
       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();
@@ -146,15 +144,15 @@ final class RemoteTransactionContextSupport {
         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());
     }
 
-    private void onFindPrimaryShardComplete(final Throwable failure, final PrimaryShardInfo primaryShardInfo) {
+    private void onFindPrimaryShardComplete(final Throwable failure, final PrimaryShardInfo newPrimaryShardInfo) {
         if (failure == null) {
-            this.primaryShardInfo = primaryShardInfo;
+            this.primaryShardInfo = newPrimaryShardInfo;
             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.
-        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.
-            if(totalCreateTxTimeout > 0) {
+            if (totalCreateTxTimeout > 0) {
                 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).
@@ -188,13 +186,8 @@ final class RemoteTransactionContextSupport {
                         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;
             }
         }
@@ -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;
-        if(failure != null) {
+        if (failure != null) {
             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);
-            } 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);
             }
@@ -251,7 +244,7 @@ final class RemoteTransactionContextSupport {
         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);
         }
 
index a1e506f..d52d3a3 100644 (file)
@@ -71,10 +71,9 @@ import scala.concurrent.duration.Duration;
 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
- * </p>
  */
 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");
-        if(builder.getDataTree() != null) {
+        if (builder.getDataTree() != null) {
             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);
-            } 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());
-            } 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());
-            } 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);
@@ -302,7 +301,8 @@ public class Shard extends RaftActor {
     }
 
     @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);
     }
@@ -348,7 +348,7 @@ public class Shard extends RaftActor {
         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) {
@@ -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);
@@ -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.
-                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);
@@ -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(
-                    "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;
         }
@@ -426,6 +428,7 @@ public class Shard extends RaftActor {
         return getRaftState() == RaftState.IsolatedLeader;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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());
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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;
             }
 
@@ -621,9 +625,8 @@ public class Shard extends RaftActor {
                     }
                 }
             } 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 commitCoordinator.convertPendingTransactionsToMessages(datastoreContext.getShardBatchedModificationCount());
+        return commitCoordinator.convertPendingTransactionsToMessages(
+                datastoreContext.getShardBatchedModificationCount());
     }
 
     @Override
@@ -675,7 +679,7 @@ public class Shard extends RaftActor {
         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();
@@ -698,39 +702,39 @@ public class Shard extends RaftActor {
             return (T) this;
         }
 
-        public T id(final ShardIdentifier id) {
+        public T id(final ShardIdentifier newId) {
             checkSealed();
-            this.id = id;
+            this.id = newId;
             return self();
         }
 
-        public T peerAddresses(final Map<String, String> peerAddresses) {
+        public T peerAddresses(final Map<String, String> newPeerAddresses) {
             checkSealed();
-            this.peerAddresses = peerAddresses;
+            this.peerAddresses = newPeerAddresses;
             return self();
         }
 
-        public T datastoreContext(final DatastoreContext datastoreContext) {
+        public T datastoreContext(final DatastoreContext newDatastoreContext) {
             checkSealed();
-            this.datastoreContext = datastoreContext;
+            this.datastoreContext = newDatastoreContext;
             return self();
         }
 
-        public T schemaContext(final SchemaContext schemaContext) {
+        public T schemaContext(final SchemaContext newSchemaContext) {
             checkSealed();
-            this.schemaContext = schemaContext;
+            this.schemaContext = newSchemaContext;
             return self();
         }
 
-        public T restoreFromSnapshot(final DatastoreSnapshot.ShardSnapshot restoreFromSnapshot) {
+        public T restoreFromSnapshot(final DatastoreSnapshot.ShardSnapshot newRestoreFromSnapshot) {
             checkSealed();
-            this.restoreFromSnapshot = restoreFromSnapshot;
+            this.restoreFromSnapshot = newRestoreFromSnapshot;
             return self();
         }
 
-        public T dataTree(final TipProducingDataTree dataTree) {
+        public T dataTree(final TipProducingDataTree newDataTree) {
             checkSealed();
-            this.dataTree = dataTree;
+            this.dataTree = newDataTree;
             return self();
         }
 
@@ -760,13 +764,14 @@ public class Shard extends RaftActor {
 
         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() {
index b3feadc..7e3cd02 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 schema
      */
     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() {
-                if (newModifications.isEmpty() ||
-                        newModifications.getLast().getModifications().size() >= maxModificationsPerBatch) {
+                if (newModifications.isEmpty()
+                        || newModifications.getLast().getModifications().size() >= maxModificationsPerBatch) {
                     newModifications.add(new BatchedModifications(from.getTransactionID(), from.getVersion()));
                 }
 
@@ -249,12 +248,12 @@ final class ShardCommitCoordinator {
             }
 
             @Override
-            public void onFailure(final Throwable t) {
+            public void onFailure(final Throwable failure) {
                 log.debug("{}: An exception occurred during canCommit for {}: {}", name,
-                        cohortEntry.getTransactionID(), t);
+                        cohortEntry.getTransactionID(), failure);
 
                 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
-            public void onFailure(final Throwable t) {
+            public void onFailure(final Throwable failure) {
                 log.error("{} An exception occurred while preCommitting transaction {}", name,
-                        cohortEntry.getTransactionID(), t);
+                        cohortEntry.getTransactionID(), failure);
 
                 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
-            public void onFailure(final Throwable t) {
+            public void onFailure(final Throwable failure) {
                 log.error("{}, An exception occurred while committing transaction {}", persistenceId(),
-                        cohortEntry.getTransactionID(), t);
+                        cohortEntry.getTransactionID(), failure);
 
                 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);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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();
-            if(cohortEntry.isFailed()) {
+            if (cohortEntry.isFailed()) {
                 iter.remove();
             }
         }
index 0b898ed..e3c7183 100644 (file)
@@ -36,8 +36,9 @@ class ShardDataChangeListenerPublisherActorProxy extends AbstractShardDataTreeNo
     }
 
     @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);
     }
 
index bf3b200..5a7ce80 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.
- *
+ * <p/>
  * 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;
     }
 
-    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());
     }
 
-    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();
 
@@ -215,6 +215,17 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         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);
     }
@@ -237,18 +248,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         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);
@@ -280,7 +280,8 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
      */
     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) {
@@ -330,7 +331,8 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
          */
         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 {
@@ -437,22 +439,23 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
             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() {
-        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();
     }
 
-    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());
     }
@@ -488,6 +491,8 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     /**
+     * Commits a modification.
+     *
      * @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());
-        for(CommitEntry entry: pendingTransactions) {
+        for (CommitEntry entry: pendingTransactions) {
             ret.add(entry.cohort);
         }
 
@@ -510,13 +515,14 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         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();
 
-            if(cohort.getState() != State.CAN_COMMIT_PENDING) {
+            if (cohort.getState() != State.CAN_COMMIT_PENDING) {
                 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.
-                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);
@@ -568,6 +575,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         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);
@@ -599,6 +607,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         processNextTransaction();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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() {
-      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 2ac3ee8..7196f83 100644 (file)
@@ -23,7 +23,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 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);
index d10a44d..c0c3d6c 100644 (file)
@@ -31,6 +31,8 @@ abstract class ShardDataTreeMetadata<T extends ShardDataTreeSnapshotMetadata<T>>
 
     // Lifecycle events
     abstract void onTransactionCommitted(TransactionIdentifier txId);
+
     abstract void onHistoryClosed(LocalHistoryIdentifier historyId);
+
     abstract void onHistoryPurged(LocalHistoryIdentifier historyId);
 }
index 8102356..76c52c9 100644 (file)
@@ -29,7 +29,7 @@ public class ShardDataTreeNotificationPublisherActor extends AbstractUntypedActo
 
     @Override
     protected void handleReceive(Object message) {
-        if(message instanceof PublishNotifications) {
+        if (message instanceof PublishNotifications) {
             PublishNotifications publisher = (PublishNotifications)message;
             timer.start();
 
@@ -38,7 +38,7 @@ public class ShardDataTreeNotificationPublisherActor extends AbstractUntypedActo
             } 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 {
index eefebb6..004e305 100644 (file)
@@ -67,7 +67,8 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
     @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;
         }
@@ -75,7 +76,8 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
 
     @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
index 3eba622..3021080 100644 (file)
@@ -11,6 +11,8 @@ import java.io.Serializable;
 import java.util.Set;
 
 /**
+ * Manages shards.
+ *
  * @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;
 
-        public SchemaContextModules(Set<String> modules){
+        public SchemaContextModules(Set<String> modules) {
             this.modules = modules;
         }
 
index 3e7274c..eb8c139 100644 (file)
@@ -16,7 +16,7 @@ import java.util.List;
 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.
index 7986886..dfb0897 100644 (file)
@@ -15,8 +15,9 @@ import org.opendaylight.controller.cluster.datastore.messages.DataExists;
 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 
 /**
+ * Actor for a shard read transaction.
+ *
  * @author: syedbahm
- * Date: 8/6/14
  */
 public class ShardReadTransaction extends ShardTransaction {
     private final AbstractShardDataTreeTransaction<?> transaction;
index 46a5039..2978fc8 100644 (file)
@@ -14,8 +14,9 @@ import org.opendaylight.controller.cluster.datastore.messages.DataExists;
 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 
 /**
+ * Actor for a shard read/write transaction.
+ *
  * @author: syedbahm
- * Date: 8/6/14
  */
 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) {
-        if(ReadData.isSerializedType(message)) {
+        if (ReadData.isSerializedType(message)) {
             readData(ReadData.fromSerializable(message));
-        } else if(DataExists.isSerializedType(message)) {
+        } else if (DataExists.isSerializedType(message)) {
             dataExists((DataExists) message);
         } else {
             super.handleReceive(message);
index 5b7f289..5e0d340 100644 (file)
@@ -34,7 +34,8 @@ class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
 
     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);
@@ -49,6 +50,7 @@ class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     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
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void applyRecoverySnapshot(final byte[] snapshotBytes) {
         log.debug("{}: Applying recovered snapshot", shardName);
 
index adf60a0..6dc3f03 100644 (file)
@@ -62,6 +62,7 @@ class ShardSnapshotCohort implements RaftActorSnapshotCohort {
     }
 
     @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
index 2421cce..2b109b0 100644 (file)
@@ -29,16 +29,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 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;
@@ -52,8 +43,8 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         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));
     }
 
@@ -86,7 +77,7 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
     private void closeTransaction(boolean sendReply) {
         getDOMStoreTransaction().abort();
 
-        if(sendReply && returnCloseTransactionReply()) {
+        if (sendReply && returnCloseTransactionReply()) {
             getSender().tell(new CloseTransactionReply(), getSelf());
         }
 
@@ -97,7 +88,8 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         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;
     }
@@ -133,8 +125,8 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         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;
@@ -146,17 +138,19 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         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());
@@ -59,20 +59,20 @@ class ShardTransactionActorFactory {
     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)
index 291867c..eea201e 100644 (file)
@@ -48,14 +48,14 @@ class ShardTransactionMessageRetrySupport implements Closeable {
     }
 
     void retryMessages() {
-        if(messagesToRetry.isEmpty()) {
+        if (messagesToRetry.isEmpty()) {
             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);
         }
@@ -72,7 +72,7 @@ class ShardTransactionMessageRetrySupport implements Closeable {
 
     @Override
     public void close() {
-        for(MessageInfo info: messagesToRetry) {
+        for (MessageInfo info: messagesToRetry) {
             info.timedOut(shard);
         }
 
@@ -97,7 +97,8 @@ class ShardTransactionMessageRetrySupport implements Closeable {
         }
 
         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 3b175a9..ee61090 100644 (file)
@@ -21,8 +21,9 @@ import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 import org.opendaylight.controller.cluster.datastore.modification.Modification;
 
 /**
+ * Actor for a shard write-only transaction.
+ *
  * @author: syedbahm
- * Date: 8/6/14
  */
 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()) {
@@ -59,17 +61,17 @@ public class ShardWriteTransaction extends ShardTransaction {
         }
 
         try {
-            for(Modification modification: batched.getModifications()) {
+            for (Modification modification: batched.getModifications()) {
                 modification.apply(transaction.getSnapshot());
             }
 
             totalBatchedModificationsReceived++;
-            if(batched.isReady()) {
-                if(lastBatchedModificationsException != null) {
+            if (batched.isReady()) {
+                if (lastBatchedModificationsException != null) {
                     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()));
@@ -83,7 +85,7 @@ public class ShardWriteTransaction extends ShardTransaction {
             lastBatchedModificationsException = e;
             getSender().tell(new akka.actor.Status.Failure(e), getSelf());
 
-            if(batched.isReady()) {
+            if (batched.isReady()) {
                 getSelf().tell(PoisonPill.getInstance(), getSelf());
             }
         }
@@ -99,7 +101,8 @@ public class ShardWriteTransaction extends ShardTransaction {
 
     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;
index 5fac0ab..71eaf7d 100644 (file)
@@ -70,21 +70,21 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort implements Ide
     }
 
     @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);
-        this.callback = Preconditions.checkNotNull(callback);
+        this.callback = Preconditions.checkNotNull(newCallback);
         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);
-        this.callback = Preconditions.checkNotNull(callback);
+        this.callback = Preconditions.checkNotNull(newCallback);
         state = State.PRE_COMMIT_PENDING;
 
         if (nextFailure == null) {
@@ -125,9 +125,9 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort implements Ide
     }
 
     @Override
-    public void commit(final FutureCallback<UnsignedLong> callback) {
+    public void commit(final FutureCallback<UnsignedLong> newCallback) {
         checkState(State.PRE_COMMIT_COMPLETE);
-        this.callback = Preconditions.checkNotNull(callback);
+        this.callback = Preconditions.checkNotNull(newCallback);
         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.
      *
-     * @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
-    void userPreCommit(final DataTreeCandidate candidate) throws ExecutionException, TimeoutException {
-        userCohorts.canCommit(candidate);
+    void userPreCommit(final DataTreeCandidate dataTreeCandidate) throws ExecutionException, TimeoutException {
+        userCohorts.canCommit(dataTreeCandidate);
         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) {
index 505c959..033cbea 100644 (file)
@@ -53,7 +53,7 @@ class SingleCommitCohortProxy extends AbstractThreePhaseCommitCohort<Object> {
         cohortFuture.onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(Throwable failure, Object cohortResponse) {
-                if(failure != null) {
+                if (failure != null) {
                 &