Fix checkstyle reported by odlparent-3.0.0 93/65593/16
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 16 Nov 2017 02:34:13 +0000 (03:34 +0100)
committerMichael Vorburger <vorburger@redhat.com>
Wed, 13 Dec 2017 17:59:46 +0000 (17:59 +0000)
Change-Id: I08c548fbbbef8527ad7b037b0def33d3c1c09bf6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
150 files changed:
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/AbstractDependentComponentFactoryMetadata.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/ValidationException.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/jmx/constants/ConfigRegistryConstants.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/osgi/WaitingServiceTracker.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/spi/AbstractModule.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/IdentityAttributeRefTest.java
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/ValidationExceptionTest.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/ConfigSubsystemFacade.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/exception/ConfigHandlingException.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/AttributeIfcSwitchStatement.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/AbstractAttributeReadingStrategy.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ArrayAttributeResolvingStrategy.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/ObjectResolver.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/ObjectXmlWriter.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/toxml/SimpleAttributeWritingStrategy.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/InstanceConfig.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/osgi/YangStoreActivator.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/osgi/YangStoreSnapshot.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/DeleteEditConfigStrategy.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/MergeEditConfigStrategy.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/MissingInstanceHandlingStrategy.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/ReCreateEditConfigStrategy.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/transactions/TransactionProvider.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/DeadlockMonitor.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ServiceReferenceRegistryImpl.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverImpl.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverManager.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dynamicmbean/AbstractDynamicWrapper.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/jmx/JMXNotifierConfigRegistry.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/ModuleInfoBundleTracker.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/RefreshingSCPModuleInfoRegistry.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/util/LookupBeansUtil.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/util/OsgiRegistrationUtil.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTrackerTest.java
opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/DocumentedException.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/AbstractReadTransactionRequestProxyV1.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/AbstractEnvelopeProxy.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/AbstractResponseEnvelopeProxy.java
opendaylight/md-sal/cds-access-api/src/test/java/org/opendaylight/controller/cluster/access/concepts/AbstractEnvelopeTest.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ReconnectingClientConnection.java
opendaylight/md-sal/cds-access-client/src/test/java/org/opendaylight/controller/cluster/access/client/AccessClientUtil.java
opendaylight/md-sal/cds-access-client/src/test/java/org/opendaylight/controller/cluster/access/client/ActorBehaviorTest.java
opendaylight/md-sal/cds-access-client/src/test/java/org/opendaylight/controller/cluster/access/client/ConnectionEntryMatcher.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingBroker.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/GetSnapshotReplyActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ImmutableElectionTerm.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/NoopProcedure.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupport.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SnapshotComplete.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/GetOnDemandRaftState.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/EmptyState.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/Snapshot.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActor.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeaderElectionScenarioTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ByteState.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/InMemorySnapshotStore.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/Dispatchers.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/MessageAssembler.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/MessageSliceReply.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/MessageSlicer.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/SliceOptions.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/reporting/MetricsReporter.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/messaging/AbstractMessagingTest.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractShardBackendResolver.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ProxyHistory.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/DatastoreContext.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/DistributedDataStoreFactory.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/ShardDataChangePublisherActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeChangePublisherActor.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/config/ModuleConfig.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/EntityOwnerSelectionStrategyConfig.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/jmx/mbeans/shard/OnDemandShardStateCache.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/messages/DataChangedReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/GetShardDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/SuccessReply.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/persisted/AbstractIdentifiablePayload.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/ShardManagerGetSnapshotReplyActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ClusterUtils.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/sharding/DistributedShardChangePublisher.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/LookupTask.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/RoleChangeListenerActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/ShardedDataTreeActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/messages/InitConfigListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/factory/AkkaConfigFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/factory/osgi/BundleClassLoaderFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/actor_system_provider/impl/factory/osgi/QuarantinedMonitorActorPropsFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHandleTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehaviorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractProxyTransactionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientLocalHistoryTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalReadOnlyProxyTransactionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/TestUtils.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/TransactionTester.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextContextPropertiesUpdaterTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/MockIdentifiers.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ForwardingActor.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/PruningDataTreeModificationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontendTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CompositeModel.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SchemaContextHelper.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMRpcRoutingTableEntry.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMRpcRoutingTable.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/clustering/impl/LegacyEntityOwnershipServiceAdapter.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteDOMRpcFuture.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderFactory.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcManager.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ExecuteRpc.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/LocalBucket.java

index 81b374d..e823523 100644 (file)
@@ -80,6 +80,7 @@ abstract class AbstractDependentComponentFactoryMetadata implements DependentCom
         setFailure(failureMessage, null);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected void setFailure(final String failureMessage, final Throwable failureCause) {
         this.failureMessage = failureMessage;
         this.failureCause = failureCause;
index 83e83e9..760853e 100644 (file)
@@ -102,7 +102,7 @@ public class ValidationException extends Exception {
             this.message = message;
         }
 
-        public void setTrace(final String stackTrace) {
+        public void setStackTrace(final String stackTrace) {
             this.stackTrace = stackTrace;
         }
 
index 08e6d18..de4b582 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.config.api.jmx.constants;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
-public class ConfigRegistryConstants {
+public final class ConfigRegistryConstants {
 
     private ConfigRegistryConstants() {
     }
index 839612c..5cb99d3 100644 (file)
@@ -54,7 +54,7 @@ public final class WaitingServiceTracker<T> implements AutoCloseable {
             return service;
         } catch (final InterruptedException e) {
             throw new ServiceNotFoundException(
-                    String.format("Wait for OSGi service %s was interrrupted", serviceInterface));
+                    String.format("Wait for OSGi service %s was interrrupted", serviceInterface), e);
         }
     }
 
index 12287c0..29a8ce3 100644 (file)
@@ -126,23 +126,23 @@ public abstract class AbstractModule<M extends AbstractModule<M>>
     protected abstract AutoCloseable createInstance();
 
     @Override
-    public final boolean canReuse(final Module oldModule) {
+    public final boolean canReuse(final Module prevModule) {
         // Just cast into a specific instance
         // TODO unify this method with canReuseInstance (required Module interface to be
         // generic which requires quite a lot of changes)
-        return canReuseInstance && getClass().isInstance(oldModule) ? canReuseInstance((M) oldModule) : false;
+        return canReuseInstance && getClass().isInstance(prevModule) ? canReuseInstance((M) prevModule) : false;
     }
 
     /**
      * Users are welcome to override this method to provide custom logic for
      * advanced reusability detection.
      *
-     * @param oldModule
+     * @param prevModule
      *            old instance of a Module
      * @return true if the old instance is reusable false if a new one should be
      *         spawned
      */
-    protected abstract boolean canReuseInstance(M oldModule);
+    protected abstract boolean canReuseInstance(M prevModule);
 
     /**
      * By default the oldInstance is returned since this method is by default called
@@ -150,14 +150,14 @@ public abstract class AbstractModule<M extends AbstractModule<M>>
      * Users are welcome to override this method to provide custom logic for
      * advanced reusability.
      *
-     * @param oldInstance
+     * @param prevInstance
      *            old instance of a class wrapped by the module
      * @return reused instance
      */
-    protected AutoCloseable reuseInstance(final AutoCloseable oldInstance) {
+    protected AutoCloseable reuseInstance(final AutoCloseable prevInstance) {
         // implement if instance reuse should be supported. Override canReuseInstance to
         // change the criteria.
-        return oldInstance;
+        return prevInstance;
     }
 
     /**
index b3c2d74..559e066 100644 (file)
@@ -29,7 +29,7 @@ public class IdentityAttributeRefTest {
 
     @Test(expected = NullPointerException.class)
     public void testConstructor2() throws Exception {
-        IdentityAttributeRef attr = new IdentityAttributeRef(null);
+        new IdentityAttributeRef(null);
     }
 
     @Test
index 5f6db72..11b3f0b 100644 (file)
@@ -67,7 +67,7 @@ public class ValidationExceptionTest {
     public void testGetTrace() throws Exception {
         ValidationException.ExceptionMessageWithStackTrace exp =
                 new ValidationException.ExceptionMessageWithStackTrace();
-        exp.setTrace("trace");
+        exp.setStackTrace("trace");
         Assert.assertEquals(exp.getTrace(), "trace");
     }
 
index c535b21..0f9e6f3 100644 (file)
@@ -356,7 +356,7 @@ public class ConfigSubsystemFacade implements Closeable {
     }
 
     private Map<String, Map<String, ModuleRuntime>> createModuleRuntimes(
-            final ConfigRegistryClient configRegistryClient,
+            final ConfigRegistryClient client,
             final Map<String, Map<String, ModuleMXBeanEntry>> mbeanentries) {
         Map<String, Map<String, ModuleRuntime>> retVal = new HashMap<>();
 
@@ -371,7 +371,7 @@ public class ConfigSubsystemFacade implements Closeable {
                 Map<RuntimeBeanEntry, InstanceConfig> cache = new HashMap<>();
                 RuntimeBeanEntry root = null;
                 for (RuntimeBeanEntry rbe : mbe.getRuntimeBeans()) {
-                    cache.put(rbe, new InstanceConfig(configRegistryClient, rbe.getYangPropertiesToTypesMap(),
+                    cache.put(rbe, new InstanceConfig(client, rbe.getYangPropertiesToTypesMap(),
                             mbe.getNullableDummyContainerName()));
                     if (rbe.isRoot()) {
                         root = rbe;
index 2d8bcbb..50db588 100644 (file)
@@ -16,11 +16,21 @@ public class ConfigHandlingException extends DocumentedException {
 
     public ConfigHandlingException(final String message, final ErrorType errorType, final ErrorTag errorTag,
             final ErrorSeverity errorSeverity) {
-        this(message, errorType, errorTag, errorSeverity, Collections.<String, String>emptyMap());
+        this(message, null, errorType, errorTag, errorSeverity, Collections.emptyMap());
+    }
+
+    public ConfigHandlingException(final String message, final Exception cause, final ErrorType errorType,
+            final ErrorTag errorTag, final ErrorSeverity errorSeverity) {
+        this(message, cause, errorType, errorTag, errorSeverity, Collections.emptyMap());
     }
 
     public ConfigHandlingException(final String message, final ErrorType errorType, final ErrorTag errorTag,
             final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
-        super(message, errorType, errorTag, errorSeverity, errorInfo);
+        this(message, null, errorType, errorTag, errorSeverity, errorInfo);
+    }
+
+    public ConfigHandlingException(final String message, final Exception cause, final ErrorType errorType,
+            final ErrorTag errorTag, final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
+        super(message, cause, errorType, errorTag, errorSeverity, errorInfo);
     }
 }
index 4920cc5..6d19311 100644 (file)
@@ -34,6 +34,7 @@ public abstract class AbstractAttributeReadingStrategy implements AttributeReadi
 
     abstract AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws DocumentedException;
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected Object postprocessNullableDefault(final String nullableDefault) {
         return nullableDefault;
     }
index 1878808..4fa6796 100644 (file)
@@ -31,6 +31,7 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement<AttributeReadin
     private String key;
     private Map<String, Map<Date, IdentityMapping>> identityMap;
 
+    @SuppressWarnings("checkstyle:hiddenField")
     public Map<String, AttributeReadingStrategy> prepareReading(final Map<String, AttributeIfc> yangToAttrConfig,
             final Map<String, Map<Date, IdentityMapping>> identityMap) {
         Map<String, AttributeReadingStrategy> strategies = Maps.newHashMap();
@@ -43,8 +44,8 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement<AttributeReadin
         return strategies;
     }
 
-    private AttributeReadingStrategy prepareReadingStrategy(final String key, final AttributeIfc attributeIfc) {
-        this.key = key;
+    private AttributeReadingStrategy prepareReadingStrategy(final String attrKey, final AttributeIfc attributeIfc) {
+        this.key = attrKey;
         return switchAttribute(attributeIfc);
     }
 
index 0dc03bf..36fd085 100644 (file)
@@ -28,6 +28,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement<AttributeMappingSt
 
     private EnumResolver enumResolver;
 
+    @SuppressWarnings("checkstyle:hiddenField")
     public Map<String, AttributeMappingStrategy<?, ? extends OpenType<?>>> prepareMapping(
             final Map<String, AttributeIfc> configDefinition, final EnumResolver enumResolver) {
         this.enumResolver = Preconditions.checkNotNull(enumResolver);
index 7f08597..ec2b665 100644 (file)
@@ -107,7 +107,7 @@ public final class ArrayAttributeResolvingStrategy extends AbstractAttributeReso
         try {
             return (Class<?>) innerTypeClass.getField("TYPE").get(null);
         } catch (final IllegalAccessException | IllegalArgumentException | NoSuchFieldException e) {
-            throw new IllegalStateException("Unable to determine primitive type to " + innerTypeClass);
+            throw new IllegalStateException("Unable to determine primitive type to " + innerTypeClass, e);
         }
     }
 
index f1050b9..4fcdc12 100644 (file)
@@ -33,6 +33,7 @@ public class ObjectResolver extends AttributeIfcSwitchStatement<AttributeResolvi
         this.serviceTracker = serviceTracker;
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     public Map<String, AttributeResolvingStrategy<?, ? extends OpenType<?>>> prepareResolving(
             final Map<String, AttributeIfc> configDefinition, final EnumResolver enumResolver) {
         this.enumResolver = enumResolver;
index 9a42e93..12f48e3 100644 (file)
@@ -83,7 +83,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
             try {
                 return parseObject(type, value);
             } catch (final DocumentedException e) {
-                throw new DocumentedException("Unable to resolve attribute " + attrName + " from " + value,
+                throw new DocumentedException("Unable to resolve attribute " + attrName + " from " + value, e,
                         DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
                         DocumentedException.ErrorSeverity.ERROR);
             }
@@ -96,7 +96,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
                 return method.invoke(null, value);
             } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
                 LOG.trace("Error parsing object ", e);
-                throw new DocumentedException("Error parsing object.", DocumentedException.ErrorType.APPLICATION,
+                throw new DocumentedException("Error parsing object.", e, DocumentedException.ErrorType.APPLICATION,
                         DocumentedException.ErrorTag.OPERATION_FAILED, DocumentedException.ErrorSeverity.ERROR);
             }
         }
@@ -141,7 +141,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
                 return Util.readDate(value);
             } catch (final ParseException e) {
                 LOG.trace("Unable parse value {} due to ", value, e);
-                throw new DocumentedException("Unable to parse value " + value + " as date.",
+                throw new DocumentedException("Unable to parse value " + value + " as date.", e,
                         DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
                         DocumentedException.ErrorSeverity.ERROR);
             }
index a62b243..a3a8b7a 100644 (file)
@@ -28,6 +28,7 @@ public class ObjectXmlWriter extends AttributeIfcSwitchStatement<AttributeWritin
     private Document document;
     private String key;
 
+    @SuppressWarnings("checkstyle:hiddenField")
     public Map<String, AttributeWritingStrategy> prepareWriting(final Map<String, AttributeIfc> yangToAttrConfig,
             final Document document) {
 
@@ -43,6 +44,7 @@ public class ObjectXmlWriter extends AttributeIfcSwitchStatement<AttributeWritin
         return preparedWriting;
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     public AttributeWritingStrategy prepareWritingStrategy(final String key, final AttributeIfc expectedAttr,
             final Document document) {
         Preconditions.checkNotNull(expectedAttr, "Mbean attributes mismatch, unable to find expected attribute for %s",
index 9847dfb..00d8639 100644 (file)
@@ -32,6 +32,7 @@ public class SimpleAttributeWritingStrategy implements AttributeWritingStrategy
         parentElement.appendChild(innerNode);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected Element createElement(final Document document, final String key, final String value,
             final Optional<String> namespace) {
         Element typeElement = XmlUtil.createElement(document, key, namespace);
index b9e4bce..ff9a9f6 100644 (file)
@@ -171,7 +171,7 @@ public final class InstanceConfig {
                 } catch (final DocumentedException e) {
                     throw new DocumentedException("Error reading module " + typeElement.getTextContent() + " : "
                             + nameElement.getTextContent() + " - Expected child node with name "
-                            + nullableDummyContainerName + "." + e.getMessage());
+                            + nullableDummyContainerName + "." + e.getMessage(), e);
                 }
             } // else 2 elements, no need to descend
         }
@@ -189,7 +189,7 @@ public final class InstanceConfig {
         } catch (final DocumentedException e) {
             throw new DocumentedException(
                     "Error reading module " + typeElement.getTextContent() + " : " + nameElement.getTextContent()
-                            + " - " + e.getMessage(),
+                            + " - " + e.getMessage(), e,
                     e.getErrorType(), e.getErrorTag(), e.getErrorSeverity(), e.getErrorInfo());
         }
         // TODO: add check for conflicts between global and local edit strategy
index 0578b42..016c944 100644 (file)
@@ -43,6 +43,7 @@ public class YangStoreActivator implements BundleActivator {
     private ServiceRegistration<ConfigSubsystemFacadeFactory> osgiRegistrayion;
 
     @Override
+    @SuppressWarnings("checkstyle:hiddenField")
     public void start(final BundleContext context) throws Exception {
         LOG.debug("ConfigPersister starting");
         this.context = context;
@@ -125,6 +126,7 @@ public class YangStoreActivator implements BundleActivator {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:hiddenField")
     public void stop(final BundleContext context) throws Exception {
         if (this.configRegistryLookup != null) {
             this.configRegistryLookup.interrupt();
@@ -147,7 +149,7 @@ public class YangStoreActivator implements BundleActivator {
 
         private final YangStoreService yangStoreService;
 
-        private ConfigRegistryLookupThread(final YangStoreService yangStoreService) {
+        ConfigRegistryLookupThread(final YangStoreService yangStoreService) {
             super("config-registry-lookup");
             this.yangStoreService = yangStoreService;
         }
index c4ca3e7..ce34496 100644 (file)
@@ -72,7 +72,7 @@ public final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
                 }
             }
 
-            final Map<String, Map<String, ModuleMXBeanEntry>> moduleMXBeanEntryMap = Maps.newHashMap();
+            final Map<String, Map<String, ModuleMXBeanEntry>> moduleMXBeanEntries = Maps.newHashMap();
 
             final Map<QName, Map<String /* identity local name */,
                 ModuleMXBeanEntry>> qNamesToIdentitiesToModuleMXBeanEntries = new HashMap<>();
@@ -88,11 +88,11 @@ public final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
                 final Map<String /* MB identity local name */, ModuleMXBeanEntry> namesToMBEs =
                         Collections.unmodifiableMap(ModuleMXBeanEntry.create(module, qNamesToSIEs, schemaContext,
                                 typeProviderWrapper, packageName));
-                moduleMXBeanEntryMap.put(module.getNamespace().toString(), namesToMBEs);
+                moduleMXBeanEntries.put(module.getNamespace().toString(), namesToMBEs);
 
                 qNamesToIdentitiesToModuleMXBeanEntries.put(qName, namesToMBEs);
             }
-            this.moduleMXBeanEntryMap = Collections.unmodifiableMap(moduleMXBeanEntryMap);
+            this.moduleMXBeanEntryMap = Collections.unmodifiableMap(moduleMXBeanEntries);
             this.namesToIdentitiesToModuleMXBeanEntries =
                     Collections.unmodifiableMap(qNamesToIdentitiesToModuleMXBeanEntries);
         }
index 08d9d21..c1a1fd4 100644 (file)
@@ -24,8 +24,10 @@ public class DeleteEditConfigStrategy extends AbstractEditConfigStrategy {
     private static final Logger LOG = LoggerFactory.getLogger(DeleteEditConfigStrategy.class);
 
     @Override
-    void handleMissingInstance(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta,
-            String module, String instance, ServiceRegistryWrapper services) throws ConfigHandlingException {
+    void handleMissingInstance(final Map<String, AttributeConfigElement> configuration,
+            final ConfigTransactionClient ta, final String module, final String instance,
+            final ServiceRegistryWrapper services)
+                    throws ConfigHandlingException {
         throw new ConfigHandlingException(
                 String.format("Unable to delete %s : %s , ServiceInstance not found", module, instance),
                 DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
@@ -33,14 +35,14 @@ public class DeleteEditConfigStrategy extends AbstractEditConfigStrategy {
     }
 
     @Override
-    void executeStrategy(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta, ObjectName on,
-            ServiceRegistryWrapper services) throws ConfigHandlingException {
+    void executeStrategy(final Map<String, AttributeConfigElement> configuration, final ConfigTransactionClient ta,
+            final ObjectName on, final ServiceRegistryWrapper services) throws ConfigHandlingException {
         try {
             ta.destroyModule(on);
             LOG.debug("ServiceInstance {} deleted successfully", on);
         } catch (InstanceNotFoundException e) {
             throw new ConfigHandlingException(
-                    String.format("Unable to delete %s because of exception %s" + on, e.getMessage()),
+                    String.format("Unable to delete %s because of exception %s" + on, e.getMessage()), e,
                     DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
                     DocumentedException.ErrorSeverity.ERROR);
         }
index ebd98f8..02aa783 100644 (file)
@@ -69,7 +69,7 @@ public class MergeEditConfigStrategy extends AbstractEditConfigStrategy {
                                 + "Error with attribute %s : %s ",
                         on,
                         configAttributeEntry.getKey(),
-                        configAttributeEntry.getValue()),
+                        configAttributeEntry.getValue()), e,
                         DocumentedException.ErrorType.APPLICATION,
                         DocumentedException.ErrorTag.OPERATION_FAILED,
                         DocumentedException.ErrorSeverity.ERROR);
index 591595e..637e837 100644 (file)
@@ -31,8 +31,7 @@ public class MissingInstanceHandlingStrategy extends AbstractEditConfigStrategy
             LOG.trace("New instance for {} {} created under name {}", module, instance, on);
         } catch (InstanceAlreadyExistsException e1) {
             throw new ConfigHandlingException(String.format("Unable to create instance for %s : %s.", module, instance),
-                    DocumentedException.ErrorType.APPLICATION,
-                    DocumentedException.ErrorTag.OPERATION_FAILED,
+                    e1, DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
                     DocumentedException.ErrorSeverity.ERROR);
         }
     }
index 4000253..776abdc 100644 (file)
@@ -40,7 +40,7 @@ public class ReCreateEditConfigStrategy extends AbstractEditConfigStrategy {
             ta.reCreateModule(objectName);
         } catch (InstanceNotFoundException e) {
             throw new ConfigHandlingException(String.format("Unable to recreate instance for %s", objectName),
-                    DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
+                    e, DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
                     DocumentedException.ErrorSeverity.ERROR);
         }
     }
index a40bac9..e255757 100644 (file)
@@ -133,7 +133,7 @@ public class TransactionProvider implements AutoCloseable {
     /**
      * Commit and notification send must be atomic.
      */
-    public synchronized CommitStatus commitTransaction(final ConfigRegistryClient configRegistryClient)
+    public synchronized CommitStatus commitTransaction(final ConfigRegistryClient client)
             throws ValidationException, ConflictingVersionException {
         if (!getTransaction().isPresent()) {
             // making empty commit without prior opened transaction, just return commit
@@ -144,7 +144,7 @@ public class TransactionProvider implements AutoCloseable {
         final Optional<ObjectName> maybeTaON = getTransaction();
         ObjectName taON = maybeTaON.get();
         try {
-            CommitStatus status = configRegistryClient.commitConfig(taON);
+            CommitStatus status = client.commitConfig(taON);
             // clean up
             allOpenedTransactions.remove(candidateTx);
             candidateTx = null;
index cad98b3..6115326 100644 (file)
@@ -67,9 +67,9 @@ public class DeadlockMonitor implements AutoCloseable {
         return "DeadlockMonitor{" + transactionIdentifier + '}';
     }
 
-    private class DeadlockMonitorRunnable extends Thread {
+    private final class DeadlockMonitorRunnable extends Thread {
 
-        private DeadlockMonitorRunnable() {
+        DeadlockMonitorRunnable() {
             super(DeadlockMonitor.this.toString());
         }
 
@@ -108,23 +108,23 @@ public class DeadlockMonitor implements AutoCloseable {
         }
     }
 
-    private static class ModuleIdentifierWithNanos {
+    private static final class ModuleIdentifierWithNanos {
         private static ModuleIdentifierWithNanos empty = new ModuleIdentifierWithNanos();
         @Nullable
         private final ModuleIdentifier moduleIdentifier;
 
         private final long nanoTime;
 
-        private ModuleIdentifierWithNanos() {
+        ModuleIdentifierWithNanos() {
             this((ModuleIdentifier) null);
         }
 
-        private ModuleIdentifierWithNanos(final ModuleIdentifier moduleIdentifier) {
+        ModuleIdentifierWithNanos(final ModuleIdentifier moduleIdentifier) {
             this.moduleIdentifier = moduleIdentifier;
             nanoTime = System.nanoTime();
         }
 
-        private ModuleIdentifierWithNanos(final ModuleIdentifierWithNanos copy) {
+        ModuleIdentifierWithNanos(final ModuleIdentifierWithNanos copy) {
             moduleIdentifier = copy.moduleIdentifier;
             nanoTime = copy.nanoTime;
         }
index 51cef4d..b682766 100644 (file)
@@ -39,7 +39,7 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ServiceReferenceRegistryImpl
+public final class ServiceReferenceRegistryImpl
         implements CloseableServiceReferenceReadableRegistry, SearchableServiceReferenceWritableRegistry {
     private static final Logger LOG = LoggerFactory.getLogger(ServiceReferenceRegistryImpl.class);
 
index e69aa86..f46113f 100644 (file)
@@ -272,6 +272,7 @@ public final class DependencyResolverImpl implements DependencyResolver, Compara
     }
 
     @Override
+    @SuppressWarnings("checkstyle:hiddenField")
     public Object getAttribute(final ObjectName name, final String attribute)
             throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
         ObjectName newName = translateServiceRefIfPossible(name);
@@ -281,6 +282,7 @@ public final class DependencyResolverImpl implements DependencyResolver, Compara
     }
 
     @Override
+    @SuppressWarnings("checkstyle:hiddenField")
     public <T> T newMXBeanProxy(final ObjectName name, final Class<T> interfaceClass) {
         ObjectName newName = translateServiceRefIfPossible(name);
         // add transaction name
index ada8a17..1a2c6b7 100644 (file)
@@ -132,6 +132,7 @@ public class DependencyResolverManager implements DependencyResolverFactory, Aut
         }
 
         @Override
+        @SuppressWarnings("checkstyle:avoidHidingCauseException")
         protected Object handleInvocation(final Object proxy, final Method method, final Object[] args)
                 throws Throwable {
             boolean isGetInstance = "getInstance".equals(method.getName());
index e5bb549..54f7946 100644 (file)
@@ -110,17 +110,17 @@ public abstract class AbstractDynamicWrapper implements DynamicMBeanModuleWrappe
      * platform mbean server. Wait until this wrapper gets unregistered, in that
      * case unregister the module and remove listener.
      */
-    private NotificationListener registerActualModule(final ObjectName objectNameInternal,
+    private NotificationListener registerActualModule(final ObjectName internalObjectName,
             final MBeanServer configMBeanServer) {
         try {
-            internalServer.registerMBean(module, objectNameInternal);
+            internalServer.registerMBean(module, internalObjectName);
         } catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException
                 | IllegalStateException e) {
-            throw new IllegalStateException("Error occured during mbean registration with name " + objectNameInternal,
+            throw new IllegalStateException("Error occured during mbean registration with name " + internalObjectName,
                     e);
         }
 
-        NotificationListener listener = new ModuleNotificationListener(objectNameInternal, internalServer,
+        NotificationListener listener = new ModuleNotificationListener(internalObjectName, internalServer,
                 configMBeanServer);
         try {
             configMBeanServer.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, null, null);
@@ -156,7 +156,7 @@ public abstract class AbstractDynamicWrapper implements DynamicMBeanModuleWrappe
 
     // inspect all exported interfaces ending with MXBean, extract getters &
     // setters into attribute holder
-    private Map<String, AttributeHolder> buildMBeanInfo(final boolean writable, final ModuleIdentifier moduleIdentifier,
+    private Map<String, AttributeHolder> buildMBeanInfo(final boolean writable, final ModuleIdentifier modId,
             final Set<Class<?>> jmxInterfaces, final ObjectName internalObjectName) {
 
         // internal variables for describing MBean elements
@@ -187,7 +187,7 @@ public abstract class AbstractDynamicWrapper implements DynamicMBeanModuleWrappe
                 try {
                     setter = module.getClass().getMethod(method.getName(), method.getParameterTypes());
                 } catch (final NoSuchMethodException e) {
-                    throw new RuntimeException("No such method on " + moduleIdentifier, e);
+                    throw new RuntimeException("No such method on " + modId, e);
                 }
                 RequireInterface ifc = AttributeHolder.findRequireInterfaceAnnotation(setter, jmxInterfaces);
                 String description = null;
index a4fcdbb..50cccc7 100644 (file)
@@ -165,7 +165,7 @@ public class JMXNotifierConfigRegistry implements ConfigRegistryImplMXBean, Auto
             beanServer.unregisterMBean(ConfigJMXNotification.OBJECT_NAME);
         } catch (InstanceNotFoundException | MBeanRegistrationException e) {
             throw new IllegalStateException(
-                    "Notifier: " + ConfigJMXNotification.OBJECT_NAME + " not found in JMX when closing");
+                    "Notifier: " + ConfigJMXNotification.OBJECT_NAME + " not found in JMX when closing", e);
         }
     }
 
index 71fcd58..cfbd95a 100644 (file)
@@ -40,7 +40,7 @@ public final class ModuleInfoBundleTracker
 
     private final RefreshingSCPModuleInfoRegistry moduleInfoRegistry;
 
-    private BundleTracker<Collection<ObjectRegistration<YangModuleInfo>>> bundleTracker;
+    private BundleTracker<Collection<ObjectRegistration<YangModuleInfo>>> tracker;
     private boolean starting;
 
     public ModuleInfoBundleTracker(final RefreshingSCPModuleInfoRegistry moduleInfoRegistry) {
@@ -51,7 +51,7 @@ public final class ModuleInfoBundleTracker
         LOG.debug("ModuleInfoBundleTracker open starting with bundleTracker {}", bundleTracker);
 
         if (bundleTracker != null) {
-            this.bundleTracker = bundleTracker;
+            this.tracker = bundleTracker;
             starting = true;
             bundleTracker.open();
 
@@ -66,9 +66,9 @@ public final class ModuleInfoBundleTracker
 
     @Override
     public void close() {
-        if (bundleTracker != null) {
-            bundleTracker.close();
-            bundleTracker = null;
+        if (tracker != null) {
+            tracker.close();
+            tracker = null;
         }
     }
 
index 9871a04..97042f2 100644 (file)
@@ -79,7 +79,7 @@ public class RefreshingSCPModuleInfoRegistry implements ModuleInfoRegistry, Auto
     private class ObjectRegistrationWrapper implements ObjectRegistration<YangModuleInfo> {
         private final ObjectRegistration<YangModuleInfo> inner;
 
-        private ObjectRegistrationWrapper(final ObjectRegistration<YangModuleInfo> inner) {
+        ObjectRegistrationWrapper(final ObjectRegistration<YangModuleInfo> inner) {
             this.inner = inner;
         }
 
index fd1e37a..92184f4 100644 (file)
@@ -12,7 +12,7 @@ import javax.management.InstanceNotFoundException;
 import javax.management.ObjectName;
 import org.opendaylight.controller.config.api.LookupRegistry;
 
-public class LookupBeansUtil {
+public final class LookupBeansUtil {
 
     private LookupBeansUtil() {
     }
index 2642e56..816f9c6 100644 (file)
@@ -20,7 +20,7 @@ import org.osgi.util.tracker.ServiceTracker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class OsgiRegistrationUtil {
+public final class OsgiRegistrationUtil {
     private static final Logger LOG = LoggerFactory.getLogger(OsgiRegistrationUtil.class);
 
     private OsgiRegistrationUtil() {
index c03c226..628baee 100644 (file)
@@ -271,7 +271,7 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
      *            jmx proxy which will be wrapped and returned
      */
     protected <T> T rethrowCause(final T innerObject) {
-        @SuppressWarnings("unchecked")
+        @SuppressWarnings({ "unchecked", "checkstyle:avoidHidingCauseException" })
         final T proxy = (T) Proxy.newProxyInstance(innerObject.getClass().getClassLoader(),
                 innerObject.getClass().getInterfaces(), (proxy1, method, args) -> {
                 try {
index 7d48ad1..7f6253e 100644 (file)
@@ -154,7 +154,7 @@ public class ModuleFactoryBundleTrackerTest {
     static class NotExtendingTestingFactory {
     }
 
-    static class NoAccessConstructorTestingFactory extends TestingFactory {
+    static final class NoAccessConstructorTestingFactory extends TestingFactory {
         private NoAccessConstructorTestingFactory() {
         }
     }
index cf96e26..6554c6f 100644 (file)
@@ -188,6 +188,14 @@ public class DocumentedException extends Exception {
         );
     }
 
+    public DocumentedException(final String message, final Exception cause) {
+        this(message, cause,
+                DocumentedException.ErrorType.APPLICATION,
+                DocumentedException.ErrorTag.INVALID_VALUE,
+                DocumentedException.ErrorSeverity.ERROR
+        );
+    }
+
     public DocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
                                final ErrorSeverity errorSeverity) {
         this(message, errorType, errorTag, errorSeverity, Collections.<String, String> emptyMap());
index 49742d8..88820bd 100644 (file)
@@ -52,5 +52,6 @@ abstract class AbstractReadTransactionRequestProxyV1<T extends AbstractReadTrans
         return createReadRequest(target, sequence, replyTo, snapshotOnly);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     abstract T createReadRequest(TransactionIdentifier target, long sequence, ActorRef replyTo, boolean snapshotOnly);
 }
index 11ec595..71a731a 100644 (file)
@@ -45,6 +45,7 @@ abstract class AbstractEnvelopeProxy<T extends Message<?, ?>> implements Externa
         message = (T) in.readObject();
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     abstract Envelope<T> createEnvelope(T wrappedNessage, long sessionId, long txSequence);
 
     final Object readResolve() {
index 1dbb86b..1e873b4 100644 (file)
@@ -43,5 +43,6 @@ abstract class AbstractResponseEnvelopeProxy<T extends Response<?, ?>> extends A
         return createEnvelope(message, sessionId, txSequence, executionTimeNanos);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     abstract ResponseEnvelope<T> createEnvelope(T message, long sessionId, long txSequence, long executionTimeNanos);
 }
index 6a3ba27..acf876b 100644 (file)
@@ -36,6 +36,7 @@ public final class ReconnectingClientConnection<T extends BackendInfo> extends A
     }
 
     @Override
+    @SuppressWarnings("checkstyle:hiddenField")
     ClientActorBehavior<T> lockedReconnect(final ClientActorBehavior<T> current, final RequestException cause) {
         this.cause = Preconditions.checkNotNull(cause);
         LOG.warn("Skipping reconnect of already-reconnecting connection {}", this);
index e31fc55..92d310d 100644 (file)
@@ -22,7 +22,10 @@ import org.opendaylight.controller.cluster.access.concepts.ResponseEnvelope;
 /**
  * Util class to access package private members in cds-access-client for test purposes.
  */
-public class AccessClientUtil {
+public final class AccessClientUtil {
+    private AccessClientUtil() {
+        throw new UnsupportedOperationException();
+    }
 
     public static ClientActorContext createClientActorContext(final ActorSystem system, final ActorRef actor,
                                                               final ClientIdentifier id, final String persistenceId) {
index 513253e..598b598 100644 (file)
@@ -180,7 +180,7 @@ public class ActorBehaviorTest {
             return Props.create(MockedActor.class, () -> new MockedActor(frontendId, initialBehavior));
         }
 
-        private MockedActor(final FrontendIdentifier frontendId, final ClientActorBehavior<?> initialBehavior) {
+        MockedActor(final FrontendIdentifier frontendId, final ClientActorBehavior<?> initialBehavior) {
             super(frontendId);
             this.initialBehavior = initialBehavior;
         }
index 7f40dc1..9494876 100644 (file)
@@ -14,7 +14,7 @@ import org.opendaylight.controller.cluster.access.concepts.Request;
 /**
  * Matcher checks, whether matched {@link ConnectionEntry} tracks provided {@link Request}.
  */
-class ConnectionEntryMatcher extends BaseMatcher<ConnectionEntry> {
+final class ConnectionEntryMatcher extends BaseMatcher<ConnectionEntry> {
 
     private final Request<?, ?> request;
 
index 5f53dcc..d6b1039 100644 (file)
@@ -147,6 +147,7 @@ public class TracingBroker implements TracingDOMDataBroker {
             return child.startsWith(parent.substring(parentOffset), childOffset);
         }
 
+        @SuppressWarnings("checkstyle:hiddenField")
         public boolean subtreesOverlap(YangInstanceIdentifier iid, LogicalDatastoreType store,
                                                                 AsyncDataBroker.DataChangeScope scope) {
             if (this.store != null && !this.store.equals(store)) {
@@ -165,6 +166,7 @@ public class TracingBroker implements TracingDOMDataBroker {
             }
         }
 
+        @SuppressWarnings("checkstyle:hiddenField")
         public boolean eventIsOfInterest(YangInstanceIdentifier iid, LogicalDatastoreType store) {
             if (this.store != null && !this.store.equals(store)) {
                 return false;
index 8bd0cf3..2571088 100644 (file)
@@ -55,7 +55,7 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
      * @param matchIndex the initial match index.
      * @param context the RaftActorContext.
      */
-    public FollowerLogInformationImpl(PeerInfo peerInfo, long matchIndex, RaftActorContext context) {
+    public FollowerLogInformationImpl(final PeerInfo peerInfo, final long matchIndex, final RaftActorContext context) {
         this.nextIndex = context.getCommitIndex();
         this.matchIndex = matchIndex;
         this.context = context;
@@ -78,7 +78,8 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
     }
 
     @Override
-    public boolean setNextIndex(long nextIndex) {
+    @SuppressWarnings("checkstyle:hiddenField")
+    public boolean setNextIndex(final long nextIndex) {
         if (this.nextIndex != nextIndex) {
             this.nextIndex = nextIndex;
             return true;
@@ -93,7 +94,8 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
     }
 
     @Override
-    public boolean setMatchIndex(long matchIndex) {
+    @SuppressWarnings("checkstyle:hiddenField")
+    public boolean setMatchIndex(final long matchIndex) {
         // If the new match index is the index of the entry currently being sliced, then we know slicing is complete
         // and the follower received the entry and responded so clear the slicedLogEntryIndex
         if (isLogEntrySlicingInProgress() && slicedLogEntryIndex == matchIndex) {
@@ -184,7 +186,7 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
     }
 
     @Override
-    public void setPayloadVersion(short payloadVersion) {
+    public void setPayloadVersion(final short payloadVersion) {
         this.payloadVersion = payloadVersion;
     }
 
@@ -194,7 +196,7 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
     }
 
     @Override
-    public void setRaftVersion(short raftVersion) {
+    public void setRaftVersion(final short raftVersion) {
         this.raftVersion = raftVersion;
     }
 
@@ -205,7 +207,7 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
     }
 
     @Override
-    public void setLeaderInstallSnapshotState(@Nonnull LeaderInstallSnapshotState state) {
+    public void setLeaderInstallSnapshotState(@Nonnull final LeaderInstallSnapshotState state) {
         if (this.installSnapshotState == null) {
             this.installSnapshotState = Preconditions.checkNotNull(state);
         }
@@ -219,7 +221,7 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
     }
 
     @Override
-    public void setSlicedLogEntryIndex(long index) {
+    public void setSlicedLogEntryIndex(final long index) {
         slicedLogEntryIndex  = index;
     }
 
index 203a612..89b4544 100644 (file)
@@ -33,14 +33,14 @@ class GetSnapshotReplyActor extends UntypedActor {
 
     private final Params params;
 
-    private GetSnapshotReplyActor(Params params) {
+    GetSnapshotReplyActor(final Params params) {
         this.params = params;
 
         getContext().setReceiveTimeout(params.receiveTimeout);
     }
 
     @Override
-    public void onReceive(Object message) {
+    public void onReceive(final Object message) {
         if (message instanceof CaptureSnapshotReply) {
             Snapshot snapshot = Snapshot.create(
                     ((CaptureSnapshotReply)message).getSnapshotState(),
@@ -65,8 +65,9 @@ class GetSnapshotReplyActor extends UntypedActor {
         }
     }
 
-    public static Props props(CaptureSnapshot captureSnapshot, ElectionTerm electionTerm, ActorRef replyToActor,
-            Duration receiveTimeout, String id, ServerConfigurationPayload updatedPeerInfo) {
+    public static Props props(final CaptureSnapshot captureSnapshot, final ElectionTerm electionTerm,
+            final ActorRef replyToActor, final Duration receiveTimeout, final String id,
+            final ServerConfigurationPayload updatedPeerInfo) {
         return Props.create(GetSnapshotReplyActor.class, new Params(captureSnapshot, electionTerm, replyToActor,
                 receiveTimeout, id, updatedPeerInfo));
     }
@@ -79,8 +80,8 @@ class GetSnapshotReplyActor extends UntypedActor {
         final String id;
         final ServerConfigurationPayload peerInformation;
 
-        Params(CaptureSnapshot captureSnapshot, ElectionTerm electionTerm, ActorRef replyToActor,
-                Duration receiveTimeout, String id, ServerConfigurationPayload peerInfo) {
+        Params(final CaptureSnapshot captureSnapshot, final ElectionTerm electionTerm, final ActorRef replyToActor,
+                final Duration receiveTimeout, final String id, final ServerConfigurationPayload peerInfo) {
             this.captureSnapshot = Preconditions.checkNotNull(captureSnapshot);
             this.electionTerm = Preconditions.checkNotNull(electionTerm);
             this.replyToActor = Preconditions.checkNotNull(replyToActor);
index 56cda03..5f7d08c 100644 (file)
@@ -12,11 +12,11 @@ package org.opendaylight.controller.cluster.raft;
  *
  * @author Thomas Pantelis
  */
-public class ImmutableElectionTerm implements ElectionTerm {
+public final class ImmutableElectionTerm implements ElectionTerm {
     private final long currentTerm;
     private final String votedFor;
 
-    private ImmutableElectionTerm(long currentTerm, String votedFor) {
+    private ImmutableElectionTerm(final long currentTerm, final String votedFor) {
         this.currentTerm = currentTerm;
         this.votedFor = votedFor;
     }
@@ -32,12 +32,12 @@ public class ImmutableElectionTerm implements ElectionTerm {
     }
 
     @Override
-    public void update(long newTerm, String newVotedFor) {
+    public void update(final long newTerm, final String newVotedFor) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public void updateAndPersist(long newTerm, String newVotedFor) {
+    public void updateAndPersist(final long newTerm, final String newVotedFor) {
         throw new UnsupportedOperationException();
     }
 
@@ -46,7 +46,7 @@ public class ImmutableElectionTerm implements ElectionTerm {
         return "ImmutableElectionTerm [currentTerm=" + currentTerm + ", votedFor=" + votedFor + "]";
     }
 
-    public static ElectionTerm copyOf(ElectionTerm from) {
+    public static ElectionTerm copyOf(final ElectionTerm from) {
         return new ImmutableElectionTerm(from.getCurrentTerm(), from.getVotedFor());
     }
 }
index d494c88..64794ca 100644 (file)
@@ -16,7 +16,7 @@ import akka.japi.Procedure;
  *
  * @param <T> the Procedure type
  */
-public class NoopProcedure<T> implements Procedure<T> {
+public final class NoopProcedure<T> implements Procedure<T> {
 
     private static final NoopProcedure<Object> INSTANCE = new NoopProcedure<>();
 
@@ -29,7 +29,7 @@ public class NoopProcedure<T> implements Procedure<T> {
     }
 
     @Override
-    public void apply(Object notUsed) {
+    public void apply(final Object notUsed) {
         // nothing to do
     }
 }
index fd6eb17..be38c17 100644 (file)
@@ -123,8 +123,8 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
 
     private boolean shuttingDown;
 
-    protected RaftActor(String id, Map<String, String> peerAddresses,
-         Optional<ConfigParams> configParams, short payloadVersion) {
+    protected RaftActor(final String id, final Map<String, String> peerAddresses,
+         final Optional<ConfigParams> configParams, final short payloadVersion) {
 
         persistentProvider = new PersistentDataProvider(this);
         delegatingPersistenceProvider = new RaftActorDelegatingPersistentDataProvider(null, persistentProvider);
@@ -157,7 +157,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
     }
 
     @Override
-    protected void handleRecover(Object message) {
+    protected void handleRecover(final Object message) {
         if (raftRecovery == null) {
             raftRecovery = newRaftActorRecoverySupport();
         }
@@ -183,7 +183,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
 
     @VisibleForTesting
     @SuppressWarnings("checkstyle:IllegalCatch")
-    protected void changeCurrentBehavior(RaftActorBehavior newBehavior) {
+    protected void changeCurrentBehavior(final RaftActorBehavior newBehavior) {
         final RaftActorBehavior currentBehavior = getCurrentBehavior();
         if (currentBehavior != null) {
             try {
@@ -327,7 +327,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
     }
 
     private void initiateLeadershipTransfer(final RaftActorLeadershipTransferCohort.OnComplete onComplete,
-            @Nullable final String followerId, long newLeaderTimeoutInMillis) {
+            @Nullable final String followerId, final long newLeaderTimeoutInMillis) {
         LOG.debug("{}: Initiating leader transfer", persistenceId());
 
         RaftActorLeadershipTransferCohort leadershipTransferInProgress = context.getRaftActorLeadershipTransferCohort();
@@ -336,12 +336,12 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
             leadershipTransferInProgress.setNewLeaderTimeoutInMillis(newLeaderTimeoutInMillis);
             leadershipTransferInProgress.addOnComplete(new RaftActorLeadershipTransferCohort.OnComplete() {
                 @Override
-                public void onSuccess(ActorRef raftActorRef) {
+                public void onSuccess(final ActorRef raftActorRef) {
                     context.setRaftActorLeadershipTransferCohort(null);
                 }
 
                 @Override
-                public void onFailure(ActorRef raftActorRef) {
+                public void onFailure(final ActorRef raftActorRef) {
                     context.setRaftActorLeadershipTransferCohort(null);
                 }
             });
@@ -381,13 +381,13 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         if (context.hasFollowers()) {
             initiateLeadershipTransfer(new RaftActorLeadershipTransferCohort.OnComplete() {
                 @Override
-                public void onSuccess(ActorRef raftActorRef) {
+                public void onSuccess(final ActorRef raftActorRef) {
                     LOG.debug("{}: leader transfer succeeded - sending PoisonPill", persistenceId());
                     raftActorRef.tell(PoisonPill.getInstance(), raftActorRef);
                 }
 
                 @Override
-                public void onFailure(ActorRef raftActorRef) {
+                public void onFailure(final ActorRef raftActorRef) {
                     LOG.debug("{}: leader transfer failed - sending PoisonPill", persistenceId());
                     raftActorRef.tell(PoisonPill.getInstance(), raftActorRef);
                 }
@@ -417,7 +417,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         }
     }
 
-    private void switchBehavior(SwitchBehavior message) {
+    private void switchBehavior(final SwitchBehavior message) {
         if (!getRaftActorContext().getRaftPolicy().automaticElectionsEnabled()) {
             RaftState newState = message.getNewState();
             if (newState == RaftState.Leader || newState == RaftState.Follower) {
@@ -499,7 +499,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         return OnDemandRaftState.builder();
     }
 
-    private void handleBehaviorChange(BehaviorState oldBehaviorState, RaftActorBehavior currentBehavior) {
+    private void handleBehaviorChange(final BehaviorState oldBehaviorState, final RaftActorBehavior currentBehavior) {
         RaftActorBehavior oldBehavior = oldBehaviorState.getBehavior();
 
         if (oldBehavior != currentBehavior) {
@@ -537,7 +537,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         }
     }
 
-    private void handleApplyState(ApplyState applyState) {
+    private void handleApplyState(final ApplyState applyState) {
         long startTime = System.nanoTime();
 
         Payload payload = applyState.getReplicatedLogEntry().getData();
@@ -560,7 +560,8 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         self().tell(applyState, self());
     }
 
-    protected LeaderStateChanged newLeaderStateChanged(String memberId, String leaderId, short leaderPayloadVersion) {
+    protected LeaderStateChanged newLeaderStateChanged(final String memberId, final String leaderId,
+            final short leaderPayloadVersion) {
         return new LeaderStateChanged(memberId, leaderId, leaderPayloadVersion);
     }
 
@@ -637,7 +638,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
     }
 
     @VisibleForTesting
-    void setCurrentBehavior(RaftActorBehavior behavior) {
+    void setCurrentBehavior(final RaftActorBehavior behavior) {
         context.setCurrentBehavior(behavior);
     }
 
@@ -704,7 +705,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         return context;
     }
 
-    protected void updateConfigParams(ConfigParams configParams) {
+    protected void updateConfigParams(final ConfigParams configParams) {
 
         // obtain the RaftPolicy for oldConfigParams and the updated one.
         String oldRaftPolicy = context.getConfigParams().getCustomRaftPolicyImplementationClass();
@@ -736,11 +737,11 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         return delegatingPersistenceProvider.getDelegate();
     }
 
-    public void setPersistence(DataPersistenceProvider provider) {
+    public void setPersistence(final DataPersistenceProvider provider) {
         delegatingPersistenceProvider.setDelegate(provider);
     }
 
-    protected void setPersistence(boolean persistent) {
+    protected void setPersistence(final boolean persistent) {
         DataPersistenceProvider currentPersistence = persistence();
         if (persistent && (currentPersistence == null || !currentPersistence.isRecoveryApplicable())) {
             setPersistence(new PersistentDataProvider(this));
@@ -751,7 +752,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
             }
         } else if (!persistent && (currentPersistence == null || currentPersistence.isRecoveryApplicable())) {
             setPersistence(new NonPersistentDataProvider(this) {
-                /**
+                /*
                  * The way snapshotting works is,
                  * <ol>
                  * <li> RaftActor calls createSnapshot on the Shard
@@ -763,7 +764,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
                  * </ol>
                  */
                 @Override
-                public void saveSnapshot(Object object) {
+                public void saveSnapshot(final Object object) {
                     // Make saving Snapshot successful
                     // Committing the snapshot here would end up calling commit in the creating state which would
                     // be a state violation. That's why now we send a message to commit the snapshot.
@@ -786,7 +787,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
      * Note that if the peerId does not match the list of peers passed to
      * this actor during construction an IllegalStateException will be thrown.
      */
-    protected void setPeerAddress(String peerId, String peerAddress) {
+    protected void setPeerAddress(final String peerId, final String peerAddress) {
         context.setPeerAddress(peerId, peerAddress);
     }
 
@@ -852,7 +853,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
      *
      * @param operation the operation to run
      */
-    protected void pauseLeader(Runnable operation) {
+    protected void pauseLeader(final Runnable operation) {
         operation.run();
     }
 
@@ -867,7 +868,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
 
     }
 
-    protected void onLeaderChanged(String oldLeader, String newLeader) {
+    protected void onLeaderChanged(final String oldLeader, final String newLeader) {
     }
 
     private String getLeaderAddress() {
@@ -908,13 +909,13 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         if (isLeader()) {
             initiateLeadershipTransfer(new RaftActorLeadershipTransferCohort.OnComplete() {
                 @Override
-                public void onSuccess(ActorRef raftActorRef) {
+                public void onSuccess(final ActorRef raftActorRef) {
                     LOG.debug("{}: leader transfer succeeded after change to non-voting", persistenceId());
                     ensureFollowerState();
                 }
 
                 @Override
-                public void onFailure(ActorRef raftActorRef) {
+                public void onFailure(final ActorRef raftActorRef) {
                     LOG.debug("{}: leader transfer failed after change to non-voting", persistenceId());
                     ensureFollowerState();
                 }
index 2296eab..19d796c 100644 (file)
@@ -93,11 +93,11 @@ public class RaftActorContextImpl implements RaftActorContext {
 
     private RaftActorLeadershipTransferCohort leadershipTransferCohort;
 
-    public RaftActorContextImpl(ActorRef actor, ActorContext context, String id,
-            @Nonnull ElectionTerm termInformation, long commitIndex, long lastApplied,
-            @Nonnull Map<String, String> peerAddresses,
-            @Nonnull ConfigParams configParams, @Nonnull DataPersistenceProvider persistenceProvider,
-            @Nonnull Consumer<ApplyState> applyStateConsumer, @Nonnull Logger logger) {
+    public RaftActorContextImpl(final ActorRef actor, final ActorContext context, final String id,
+            @Nonnull final ElectionTerm termInformation, final long commitIndex, final long lastApplied,
+            @Nonnull final Map<String, String> peerAddresses,
+            @Nonnull final ConfigParams configParams, @Nonnull final DataPersistenceProvider persistenceProvider,
+            @Nonnull final Consumer<ApplyState> applyStateConsumer, @Nonnull final Logger logger) {
         this.actor = actor;
         this.context = context;
         this.id = id;
@@ -118,7 +118,7 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @VisibleForTesting
-    public void setPayloadVersion(short payloadVersion) {
+    public void setPayloadVersion(final short payloadVersion) {
         this.payloadVersion = payloadVersion;
     }
 
@@ -127,17 +127,17 @@ public class RaftActorContextImpl implements RaftActorContext {
         return payloadVersion;
     }
 
-    public void setConfigParams(ConfigParams configParams) {
+    public void setConfigParams(final ConfigParams configParams) {
         this.configParams = configParams;
     }
 
     @Override
-    public ActorRef actorOf(Props props) {
+    public ActorRef actorOf(final Props props) {
         return context.actorOf(props);
     }
 
     @Override
-    public ActorSelection actorSelection(String path) {
+    public ActorSelection actorSelection(final String path) {
         return context.actorSelection(path);
     }
 
@@ -177,7 +177,7 @@ public class RaftActorContextImpl implements RaftActorContext {
         return commitIndex;
     }
 
-    @Override public void setCommitIndex(long commitIndex) {
+    @Override public void setCommitIndex(final long commitIndex) {
         this.commitIndex = commitIndex;
     }
 
@@ -187,14 +187,14 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
-    public void setLastApplied(long lastApplied) {
+    public void setLastApplied(final long lastApplied) {
         final Throwable stackTrace = log.isTraceEnabled() ? new Throwable() : null;
         log.debug("{}: Moving last applied index from {} to {}", id, this.lastApplied, lastApplied, stackTrace);
         this.lastApplied = lastApplied;
     }
 
     @Override
-    public void setReplicatedLog(ReplicatedLog replicatedLog) {
+    public void setReplicatedLog(final ReplicatedLog replicatedLog) {
         this.replicatedLog = replicatedLog;
     }
 
@@ -224,12 +224,12 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
-    public PeerInfo getPeerInfo(String peerId) {
+    public PeerInfo getPeerInfo(final String peerId) {
         return peerInfoMap.get(peerId);
     }
 
     @Override
-    public String getPeerAddress(String peerId) {
+    public String getPeerAddress(final String peerId) {
         String peerAddress;
         PeerInfo peerInfo = peerInfoMap.get(peerId);
         if (peerInfo != null) {
@@ -246,7 +246,7 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
-    public void updatePeerIds(ServerConfigurationPayload serverConfig) {
+    public void updatePeerIds(final ServerConfigurationPayload serverConfig) {
         votingMember = true;
         boolean foundSelf = false;
         Set<String> currentPeers = new HashSet<>(this.getPeerIds());
@@ -285,13 +285,13 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
-    public void addToPeers(String peerId, String address, VotingState votingState) {
+    public void addToPeers(final String peerId, final String address, final VotingState votingState) {
         peerInfoMap.put(peerId, new PeerInfo(peerId, address, votingState));
         numVotingPeers = -1;
     }
 
     @Override
-    public void removePeer(String name) {
+    public void removePeer(final String name) {
         if (getId().equals(name)) {
             votingMember = false;
         } else {
@@ -300,7 +300,7 @@ public class RaftActorContextImpl implements RaftActorContext {
         }
     }
 
-    @Override public ActorSelection getPeerActorSelection(String peerId) {
+    @Override public ActorSelection getPeerActorSelection(final String peerId) {
         String peerAddress = getPeerAddress(peerId);
         if (peerAddress != null) {
             return actorSelection(peerAddress);
@@ -309,7 +309,7 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
-    public void setPeerAddress(String peerId, String peerAddress) {
+    public void setPeerAddress(final String peerId, final String peerAddress) {
         PeerInfo peerInfo = peerInfoMap.get(peerId);
         if (peerInfo != null) {
             log.info("Peer address for peer {} set to {}", peerId, peerAddress);
@@ -331,7 +331,7 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
-    public void setTotalMemoryRetriever(LongSupplier retriever) {
+    public void setTotalMemoryRetriever(final LongSupplier retriever) {
         totalMemoryRetriever = retriever == null ? JVM_MEMORY_RETRIEVER : retriever;
     }
 
@@ -362,7 +362,7 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
-    public ServerConfigurationPayload getPeerServerInfo(boolean includeSelf) {
+    public ServerConfigurationPayload getPeerServerInfo(final boolean includeSelf) {
         if (!isDynamicServerConfigurationInUse()) {
             return null;
         }
@@ -435,8 +435,9 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:hiddenField")
     public void setRaftActorLeadershipTransferCohort(
-            @Nullable RaftActorLeadershipTransferCohort leadershipTransferCohort) {
+            @Nullable final RaftActorLeadershipTransferCohort leadershipTransferCohort) {
         this.leadershipTransferCohort = leadershipTransferCohort;
     }
 }
index 0014a6f..3f030d0 100644 (file)
@@ -61,12 +61,12 @@ class RaftActorServerConfigurationSupport {
 
     private OperationState currentOperationState = IDLE;
 
-    RaftActorServerConfigurationSupport(RaftActor raftActor) {
+    RaftActorServerConfigurationSupport(final RaftActor raftActor) {
         this.raftActor = raftActor;
         this.raftContext = raftActor.getRaftActorContext();
     }
 
-    boolean handleMessage(Object message, ActorRef sender) {
+    boolean handleMessage(final Object message, final ActorRef sender) {
         if (message instanceof AddServer) {
             onAddServer((AddServer) message, sender);
             return true;
@@ -92,11 +92,11 @@ class RaftActorServerConfigurationSupport {
         }
     }
 
-    void onNewLeader(String leaderId) {
+    void onNewLeader(final String leaderId) {
         currentOperationState.onNewLeader(leaderId);
     }
 
-    private void onChangeServersVotingStatus(ChangeServersVotingStatus message, ActorRef sender) {
+    private void onChangeServersVotingStatus(final ChangeServersVotingStatus message, final ActorRef sender) {
         LOG.debug("{}: onChangeServersVotingStatus: {}, state: {}", raftContext.getId(), message,
                 currentOperationState);
 
@@ -122,7 +122,7 @@ class RaftActorServerConfigurationSupport {
         }
     }
 
-    private void onRemoveServer(RemoveServer removeServer, ActorRef sender) {
+    private void onRemoveServer(final RemoveServer removeServer, final ActorRef sender) {
         LOG.debug("{}: onRemoveServer: {}, state: {}", raftContext.getId(), removeServer, currentOperationState);
         boolean isSelf = removeServer.getServerId().equals(raftContext.getId());
         if (isSelf && !raftContext.hasFollowers()) {
@@ -138,7 +138,7 @@ class RaftActorServerConfigurationSupport {
         }
     }
 
-    private boolean onApplyState(ApplyState applyState) {
+    private boolean onApplyState(final ApplyState applyState) {
         Payload data = applyState.getReplicatedLogEntry().getData();
         if (data instanceof ServerConfigurationPayload) {
             currentOperationState.onApplyState(applyState);
@@ -149,7 +149,7 @@ class RaftActorServerConfigurationSupport {
     }
 
     /**
-     * The algorithm for AddServer is as follows:
+     * Add a server. The algorithm for AddServer is as follows:
      * <ul>
      * <li>Add the new server as a peer.</li>
      * <li>Add the new follower to the leader.</li>
@@ -169,13 +169,13 @@ class RaftActorServerConfigurationSupport {
      *     <li>Respond to caller with TIMEOUT.</li>
      * </ul>
      */
-    private void onAddServer(AddServer addServer, ActorRef sender) {
+    private void onAddServer(final AddServer addServer, final ActorRef sender) {
         LOG.debug("{}: onAddServer: {}, state: {}", raftContext.getId(), addServer, currentOperationState);
 
         onNewOperation(new AddServerContext(addServer, sender));
     }
 
-    private void onNewOperation(ServerOperationContext<?> operationContext) {
+    private void onNewOperation(final ServerOperationContext<?> operationContext) {
         if (raftActor.isLeader()) {
             currentOperationState.onNewOperation(operationContext);
         } else {
@@ -202,7 +202,7 @@ class RaftActorServerConfigurationSupport {
      * Abstract base class for a server operation FSM state. Handles common behavior for all states.
      */
     private abstract class OperationState {
-        void onNewOperation(ServerOperationContext<?> operationContext) {
+        void onNewOperation(final ServerOperationContext<?> operationContext) {
             // We're currently processing another operation so queue it to be processed later.
 
             LOG.debug("{}: Server operation already in progress - queueing {}", raftContext.getId(),
@@ -211,15 +211,15 @@ class RaftActorServerConfigurationSupport {
             pendingOperationsQueue.add(operationContext);
         }
 
-        void onServerOperationTimeout(ServerOperationTimeout timeout) {
+        void onServerOperationTimeout(final ServerOperationTimeout timeout) {
             LOG.debug("onServerOperationTimeout should not be called in state {}", this);
         }
 
-        void onUnInitializedFollowerSnapshotReply(UnInitializedFollowerSnapshotReply reply) {
+        void onUnInitializedFollowerSnapshotReply(final UnInitializedFollowerSnapshotReply reply) {
             LOG.debug("onUnInitializedFollowerSnapshotReply was called in state {}", this);
         }
 
-        void onApplyState(ApplyState applyState) {
+        void onApplyState(final ApplyState applyState) {
             LOG.debug("onApplyState was called in state {}", this);
         }
 
@@ -227,10 +227,10 @@ class RaftActorServerConfigurationSupport {
 
         }
 
-        void onNewLeader(String newLeader) {
+        void onNewLeader(final String newLeader) {
         }
 
-        protected void persistNewServerConfiguration(ServerOperationContext<?> operationContext) {
+        protected void persistNewServerConfiguration(final ServerOperationContext<?> operationContext) {
             raftContext.setDynamicServerConfigurationInUse();
 
             ServerConfigurationPayload payload = raftContext.getPeerServerInfo(
@@ -246,8 +246,8 @@ class RaftActorServerConfigurationSupport {
             sendReply(operationContext, ServerChangeStatus.OK);
         }
 
-        protected void operationComplete(ServerOperationContext<?> operationContext,
-                @Nullable ServerChangeStatus replyStatus) {
+        protected void operationComplete(final ServerOperationContext<?> operationContext,
+                @Nullable final ServerChangeStatus replyStatus) {
             if (replyStatus != null) {
                 sendReply(operationContext, replyStatus);
             }
@@ -266,7 +266,7 @@ class RaftActorServerConfigurationSupport {
             }
         }
 
-        protected void sendReply(ServerOperationContext<?> operationContext, ServerChangeStatus status) {
+        protected void sendReply(final ServerOperationContext<?> operationContext, final ServerChangeStatus status) {
             LOG.debug("{}: Returning {} for operation {}", raftContext.getId(), status,
                     operationContext.getOperation());
 
@@ -274,11 +274,11 @@ class RaftActorServerConfigurationSupport {
                     raftActor.self());
         }
 
-        Cancellable newTimer(Object message) {
+        Cancellable newTimer(final Object message) {
             return newTimer(raftContext.getConfigParams().getElectionTimeOutInterval().$times(2), message);
         }
 
-        Cancellable newTimer(FiniteDuration timeout, Object message) {
+        Cancellable newTimer(final FiniteDuration timeout, final Object message) {
             return raftContext.getActorSystem().scheduler().scheduleOnce(
                     timeout, raftContext.getActor(), message,
                             raftContext.getActorSystem().dispatcher(), raftContext.getActor());
@@ -295,12 +295,12 @@ class RaftActorServerConfigurationSupport {
      */
     private final class Idle extends OperationState {
         @Override
-        public void onNewOperation(ServerOperationContext<?> operationContext) {
+        public void onNewOperation(final ServerOperationContext<?> operationContext) {
             operationContext.newInitialOperationState(RaftActorServerConfigurationSupport.this).initiate();
         }
 
         @Override
-        public void onApplyState(ApplyState applyState) {
+        public void onApplyState(final ApplyState applyState) {
             // Noop - we override b/c ApplyState is called normally for followers in the idle state.
         }
     }
@@ -313,13 +313,13 @@ class RaftActorServerConfigurationSupport {
         private final Cancellable timer;
         private boolean timedOut = false;
 
-        Persisting(ServerOperationContext<?> operationContext, Cancellable timer) {
+        Persisting(final ServerOperationContext<?> operationContext, final Cancellable timer) {
             this.operationContext = operationContext;
             this.timer = timer;
         }
 
         @Override
-        public void onApplyState(ApplyState applyState) {
+        public void onApplyState(final ApplyState applyState) {
             // Sanity check - we could get an ApplyState from a previous operation that timed out so make
             // sure it's meant for us.
             if (operationContext.getContextId().equals(applyState.getIdentifier())) {
@@ -332,7 +332,7 @@ class RaftActorServerConfigurationSupport {
         }
 
         @Override
-        public void onServerOperationTimeout(ServerOperationTimeout timeout) {
+        public void onServerOperationTimeout(final ServerOperationTimeout timeout) {
             LOG.warn("{}: Timeout occured while replicating the new server configuration for {}", raftContext.getId(),
                     timeout.getLoggingContext());
 
@@ -347,7 +347,7 @@ class RaftActorServerConfigurationSupport {
         }
 
         @Override
-        public void onNewOperation(ServerOperationContext<?> newOperationContext) {
+        public void onNewOperation(final ServerOperationContext<?> newOperationContext) {
             if (timedOut) {
                 sendReply(newOperationContext, ServerChangeStatus.PRIOR_REQUEST_CONSENSUS_TIMEOUT);
             } else {
@@ -362,7 +362,7 @@ class RaftActorServerConfigurationSupport {
     private abstract class AddServerState extends OperationState {
         private final AddServerContext addServerContext;
 
-        AddServerState(AddServerContext addServerContext) {
+        AddServerState(final AddServerContext addServerContext) {
             this.addServerContext = addServerContext;
         }
 
@@ -374,7 +374,7 @@ class RaftActorServerConfigurationSupport {
             return newTimer(new ServerOperationTimeout(addServerContext.getOperation().getNewServerId()));
         }
 
-        void handleInstallSnapshotTimeout(ServerOperationTimeout timeout) {
+        void handleInstallSnapshotTimeout(final ServerOperationTimeout timeout) {
             String serverId = timeout.getLoggingContext();
 
             LOG.debug("{}: handleInstallSnapshotTimeout for new server {}", raftContext.getId(), serverId);
@@ -399,7 +399,7 @@ class RaftActorServerConfigurationSupport {
      * snapshot capture, if necessary.
      */
     private final class InitialAddServerState extends AddServerState implements InitialOperationState {
-        InitialAddServerState(AddServerContext addServerContext) {
+        InitialAddServerState(final AddServerContext addServerContext) {
             super(addServerContext);
         }
 
@@ -451,13 +451,13 @@ class RaftActorServerConfigurationSupport {
     private final class InstallingSnapshot extends AddServerState {
         private final Cancellable installSnapshotTimer;
 
-        InstallingSnapshot(AddServerContext addServerContext, Cancellable installSnapshotTimer) {
+        InstallingSnapshot(final AddServerContext addServerContext, final Cancellable installSnapshotTimer) {
             super(addServerContext);
             this.installSnapshotTimer = Preconditions.checkNotNull(installSnapshotTimer);
         }
 
         @Override
-        public void onServerOperationTimeout(ServerOperationTimeout timeout) {
+        public void onServerOperationTimeout(final ServerOperationTimeout timeout) {
             handleInstallSnapshotTimeout(timeout);
 
             LOG.warn("{}: Timeout occured for new server {} while installing snapshot", raftContext.getId(),
@@ -465,7 +465,7 @@ class RaftActorServerConfigurationSupport {
         }
 
         @Override
-        public void onUnInitializedFollowerSnapshotReply(UnInitializedFollowerSnapshotReply reply) {
+        public void onUnInitializedFollowerSnapshotReply(final UnInitializedFollowerSnapshotReply reply) {
             LOG.debug("{}: onUnInitializedFollowerSnapshotReply: {}", raftContext.getId(), reply);
 
             String followerId = reply.getFollowerId();
@@ -495,7 +495,7 @@ class RaftActorServerConfigurationSupport {
     private final class WaitingForPriorSnapshotComplete extends AddServerState {
         private final Cancellable snapshotTimer;
 
-        WaitingForPriorSnapshotComplete(AddServerContext addServerContext, Cancellable snapshotTimer) {
+        WaitingForPriorSnapshotComplete(final AddServerContext addServerContext, final Cancellable snapshotTimer) {
             super(addServerContext);
             this.snapshotTimer = Preconditions.checkNotNull(snapshotTimer);
         }
@@ -522,7 +522,7 @@ class RaftActorServerConfigurationSupport {
         }
 
         @Override
-        public void onServerOperationTimeout(ServerOperationTimeout timeout) {
+        public void onServerOperationTimeout(final ServerOperationTimeout timeout) {
             handleInstallSnapshotTimeout(timeout);
 
             LOG.warn("{}: Timeout occured for new server {} while waiting for prior snapshot to complete",
@@ -549,7 +549,7 @@ class RaftActorServerConfigurationSupport {
         private final ActorRef clientRequestor;
         private final Identifier contextId;
 
-        ServerOperationContext(T operation, ActorRef clientRequestor) {
+        ServerOperationContext(final T operation, final ActorRef clientRequestor) {
             this.operation = operation;
             this.clientRequestor = clientRequestor;
             contextId = new ServerOperationContextIdentifier();
@@ -567,10 +567,10 @@ class RaftActorServerConfigurationSupport {
             return clientRequestor;
         }
 
-        void operationComplete(RaftActor raftActor, boolean succeeded) {
+        void operationComplete(final RaftActor raftActor, final boolean succeeded) {
         }
 
-        boolean includeSelfInNewConfiguration(RaftActor raftActor) {
+        boolean includeSelfInNewConfiguration(final RaftActor raftActor) {
             return true;
         }
 
@@ -585,17 +585,17 @@ class RaftActorServerConfigurationSupport {
      * Stores context information for an AddServer operation.
      */
     private static class AddServerContext extends ServerOperationContext<AddServer> {
-        AddServerContext(AddServer addServer, ActorRef clientRequestor) {
+        AddServerContext(final AddServer addServer, final ActorRef clientRequestor) {
             super(addServer, clientRequestor);
         }
 
         @Override
-        Object newReply(ServerChangeStatus status, String leaderId) {
+        Object newReply(final ServerChangeStatus status, final String leaderId) {
             return new AddServerReply(status, leaderId);
         }
 
         @Override
-        InitialOperationState newInitialOperationState(RaftActorServerConfigurationSupport support) {
+        InitialOperationState newInitialOperationState(final RaftActorServerConfigurationSupport support) {
             return support.new InitialAddServerState(this);
         }
 
@@ -608,7 +608,7 @@ class RaftActorServerConfigurationSupport {
     private abstract class RemoveServerState extends OperationState {
         private final RemoveServerContext removeServerContext;
 
-        protected RemoveServerState(RemoveServerContext removeServerContext) {
+        protected RemoveServerState(final RemoveServerContext removeServerContext) {
             this.removeServerContext = Preconditions.checkNotNull(removeServerContext);
 
         }
@@ -620,7 +620,7 @@ class RaftActorServerConfigurationSupport {
 
     private final class InitialRemoveServerState extends RemoveServerState implements InitialOperationState {
 
-        protected InitialRemoveServerState(RemoveServerContext removeServerContext) {
+        protected InitialRemoveServerState(final RemoveServerContext removeServerContext) {
             super(removeServerContext);
         }
 
@@ -639,23 +639,23 @@ class RaftActorServerConfigurationSupport {
     private static class RemoveServerContext extends ServerOperationContext<RemoveServer> {
         private final String peerAddress;
 
-        RemoveServerContext(RemoveServer operation, String peerAddress, ActorRef clientRequestor) {
+        RemoveServerContext(final RemoveServer operation, final String peerAddress, final ActorRef clientRequestor) {
             super(operation, clientRequestor);
             this.peerAddress = peerAddress;
         }
 
         @Override
-        Object newReply(ServerChangeStatus status, String leaderId) {
+        Object newReply(final ServerChangeStatus status, final String leaderId) {
             return new RemoveServerReply(status, leaderId);
         }
 
         @Override
-        InitialOperationState newInitialOperationState(RaftActorServerConfigurationSupport support) {
+        InitialOperationState newInitialOperationState(final RaftActorServerConfigurationSupport support) {
             return support.new InitialRemoveServerState(this);
         }
 
         @Override
-        void operationComplete(RaftActor raftActor, boolean succeeded) {
+        void operationComplete(final RaftActor raftActor, final boolean succeeded) {
             if (peerAddress != null) {
                 raftActor.context().actorSelection(peerAddress).tell(
                         new ServerRemoved(getOperation().getServerId()), raftActor.getSelf());
@@ -663,7 +663,7 @@ class RaftActorServerConfigurationSupport {
         }
 
         @Override
-        boolean includeSelfInNewConfiguration(RaftActor raftActor) {
+        boolean includeSelfInNewConfiguration(final RaftActor raftActor) {
             return !getOperation().getServerId().equals(raftActor.getId());
         }
 
@@ -676,24 +676,24 @@ class RaftActorServerConfigurationSupport {
     private static class ChangeServersVotingStatusContext extends ServerOperationContext<ChangeServersVotingStatus> {
         private final boolean tryToElectLeader;
 
-        ChangeServersVotingStatusContext(ChangeServersVotingStatus convertMessage, ActorRef clientRequestor,
-                boolean tryToElectLeader) {
+        ChangeServersVotingStatusContext(final ChangeServersVotingStatus convertMessage, final ActorRef clientRequestor,
+                final boolean tryToElectLeader) {
             super(convertMessage, clientRequestor);
             this.tryToElectLeader = tryToElectLeader;
         }
 
         @Override
-        InitialOperationState newInitialOperationState(RaftActorServerConfigurationSupport support) {
+        InitialOperationState newInitialOperationState(final RaftActorServerConfigurationSupport support) {
             return support.new ChangeServersVotingStatusState(this, tryToElectLeader);
         }
 
         @Override
-        Object newReply(ServerChangeStatus status, String leaderId) {
+        Object newReply(final ServerChangeStatus status, final String leaderId) {
             return new ServerChangeReply(status, leaderId);
         }
 
         @Override
-        void operationComplete(final RaftActor raftActor, boolean succeeded) {
+        void operationComplete(final RaftActor raftActor, final boolean succeeded) {
             // If this leader changed to non-voting we need to step down as leader so we'll try to transfer
             // leadership.
             boolean localServerChangedToNonVoting = Boolean.FALSE.equals(getOperation()
@@ -714,8 +714,8 @@ class RaftActorServerConfigurationSupport {
         private final ChangeServersVotingStatusContext changeVotingStatusContext;
         private final boolean tryToElectLeader;
 
-        ChangeServersVotingStatusState(ChangeServersVotingStatusContext changeVotingStatusContext,
-                boolean tryToElectLeader) {
+        ChangeServersVotingStatusState(final ChangeServersVotingStatusContext changeVotingStatusContext,
+                final boolean tryToElectLeader) {
             this.changeVotingStatusContext = changeVotingStatusContext;
             this.tryToElectLeader = tryToElectLeader;
         }
@@ -792,8 +792,8 @@ class RaftActorServerConfigurationSupport {
         private final ChangeServersVotingStatusContext operationContext;
         private final Cancellable timer;
 
-        WaitingForLeaderElected(ChangeServersVotingStatusContext operationContext,
-                ServerConfigurationPayload previousServerConfig) {
+        WaitingForLeaderElected(final ChangeServersVotingStatusContext operationContext,
+                final ServerConfigurationPayload previousServerConfig) {
             this.operationContext = operationContext;
             this.previousServerConfig = previousServerConfig;
 
@@ -802,7 +802,7 @@ class RaftActorServerConfigurationSupport {
         }
 
         @Override
-        void onNewLeader(String newLeader) {
+        void onNewLeader(final String newLeader) {
             if (newLeader == null) {
                 return;
             }
@@ -826,7 +826,7 @@ class RaftActorServerConfigurationSupport {
         }
 
         @Override
-        void onServerOperationTimeout(ServerOperationTimeout timeout) {
+        void onServerOperationTimeout(final ServerOperationTimeout timeout) {
             LOG.warn("{}: Leader election timed out - cannot apply operation {}",
                     raftContext.getId(), timeout.getLoggingContext());
 
@@ -877,7 +877,7 @@ class RaftActorServerConfigurationSupport {
     static class ServerOperationTimeout {
         private final String loggingContext;
 
-        ServerOperationTimeout(String loggingContext) {
+        ServerOperationTimeout(final String loggingContext) {
             this.loggingContext = Preconditions.checkNotNull(loggingContext, "loggingContext should not be null");
         }
 
index 7196fc5..764bce1 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 /**
  * Implementation of ReplicatedLog used by the RaftActor.
  */
-class ReplicatedLogImpl extends AbstractReplicatedLogImpl {
+final class ReplicatedLogImpl extends AbstractReplicatedLogImpl {
     private static final int DATA_SIZE_DIVIDER = 5;
 
     private final RaftActorContext context;
@@ -54,7 +54,7 @@ class ReplicatedLogImpl extends AbstractReplicatedLogImpl {
     }
 
     @Override
-    public boolean shouldCaptureSnapshot(long logIndex) {
+    public boolean shouldCaptureSnapshot(final long logIndex) {
         final ConfigParams config = context.getConfigParams();
         final long journalSize = logIndex + 1;
         final long dataThreshold = context.getTotalMemory() * config.getSnapshotDataThresholdPercentage() / 100;
@@ -94,7 +94,7 @@ class ReplicatedLogImpl extends AbstractReplicatedLogImpl {
 
     @Override
     public boolean appendAndPersist(@Nonnull final ReplicatedLogEntry replicatedLogEntry,
-            @Nullable final Procedure<ReplicatedLogEntry> callback, boolean doAsync)  {
+            @Nullable final Procedure<ReplicatedLogEntry> callback, final boolean doAsync)  {
 
         context.getLogger().debug("{}: Append log entry and persist {} ", context.getId(), replicatedLogEntry);
 
index 7ff47f9..dd9445e 100644 (file)
@@ -67,7 +67,7 @@ public class SnapshotManager implements SnapshotState {
      * @param context the RaftActorContext
      * @param logger the Logger
      */
-    public SnapshotManager(RaftActorContext context, Logger logger) {
+    public SnapshotManager(final RaftActorContext context, final Logger logger) {
         this.context = context;
         this.log = logger;
     }
@@ -82,17 +82,18 @@ public class SnapshotManager implements SnapshotState {
     }
 
     @Override
-    public boolean captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex, String targetFollower) {
+    public boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex,
+            final String targetFollower) {
         return currentState.captureToInstall(lastLogEntry, replicatedToAllIndex, targetFollower);
     }
 
     @Override
-    public boolean capture(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex) {
+    public boolean capture(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex) {
         return currentState.capture(lastLogEntry, replicatedToAllIndex);
     }
 
     @Override
-    public void apply(ApplySnapshot snapshot) {
+    public void apply(final ApplySnapshot snapshot) {
         currentState.apply(snapshot);
     }
 
@@ -103,7 +104,7 @@ public class SnapshotManager implements SnapshotState {
     }
 
     @Override
-    public void commit(final long sequenceNumber, long timeStamp) {
+    public void commit(final long sequenceNumber, final long timeStamp) {
         currentState.commit(sequenceNumber, timeStamp);
     }
 
@@ -117,7 +118,8 @@ public class SnapshotManager implements SnapshotState {
         return currentState.trimLog(desiredTrimIndex);
     }
 
-    void setCreateSnapshotConsumer(Consumer<Optional<OutputStream>> createSnapshotProcedure) {
+    @SuppressWarnings("checkstyle:hiddenField")
+    void setCreateSnapshotConsumer(final Consumer<Optional<OutputStream>> createSnapshotProcedure) {
         this.createSnapshotProcedure = createSnapshotProcedure;
     }
 
@@ -126,7 +128,7 @@ public class SnapshotManager implements SnapshotState {
     }
 
     @Nonnull
-    public Snapshot.State convertSnapshot(ByteSource snapshotBytes) throws IOException {
+    public Snapshot.State convertSnapshot(final ByteSource snapshotBytes) throws IOException {
         return snapshotCohort.deserializeSnapshot(snapshotBytes);
     }
 
@@ -154,7 +156,7 @@ public class SnapshotManager implements SnapshotState {
      * @param replicatedToAllIndex the index of the last entry replicated to all followers.
      * @return a new CaptureSnapshot instance.
      */
-    public CaptureSnapshot newCaptureSnapshot(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex) {
+    public CaptureSnapshot newCaptureSnapshot(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex) {
         TermInformationReader lastAppliedTermInfoReader =
                 lastAppliedTermInformationReader.init(context.getReplicatedLog(), context.getLastApplied(),
                         lastLogEntry, hasFollowers());
@@ -192,20 +194,20 @@ public class SnapshotManager implements SnapshotState {
         }
 
         @Override
-        public boolean capture(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex) {
+        public boolean capture(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex) {
             log.debug("capture should not be called in state {}", this);
             return false;
         }
 
         @Override
-        public boolean captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex,
-                String targetFollower) {
+        public boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex,
+                final String targetFollower) {
             log.debug("captureToInstall should not be called in state {}", this);
             return false;
         }
 
         @Override
-        public void apply(ApplySnapshot snapshot) {
+        public void apply(final ApplySnapshot snapshot) {
             log.debug("apply should not be called in state {}", this);
         }
 
@@ -216,7 +218,7 @@ public class SnapshotManager implements SnapshotState {
         }
 
         @Override
-        public void commit(final long sequenceNumber, long timeStamp) {
+        public void commit(final long sequenceNumber, final long timeStamp) {
             log.debug("commit should not be called in state {}", this);
         }
 
@@ -273,7 +275,8 @@ public class SnapshotManager implements SnapshotState {
         }
 
         @SuppressWarnings("checkstyle:IllegalCatch")
-        private boolean capture(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex, String targetFollower) {
+        private boolean capture(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex,
+                final String targetFollower) {
             captureSnapshot = newCaptureSnapshot(lastLogEntry, replicatedToAllIndex);
 
             OutputStream installSnapshotStream = null;
@@ -303,18 +306,18 @@ public class SnapshotManager implements SnapshotState {
         }
 
         @Override
-        public boolean capture(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex) {
+        public boolean capture(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex) {
             return capture(lastLogEntry, replicatedToAllIndex, null);
         }
 
         @Override
-        public boolean captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex,
-                String targetFollower) {
+        public boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex,
+                final String targetFollower) {
             return capture(lastLogEntry, replicatedToAllIndex, targetFollower);
         }
 
         @Override
-        public void apply(ApplySnapshot toApply) {
+        public void apply(final ApplySnapshot toApply) {
             SnapshotManager.this.applySnapshot = toApply;
 
             lastSequenceNumber = context.getPersistenceProvider().getLastSequenceNumber();
@@ -439,7 +442,7 @@ public class SnapshotManager implements SnapshotState {
 
         @Override
         @SuppressWarnings("checkstyle:IllegalCatch")
-        public void commit(final long sequenceNumber, long timeStamp) {
+        public void commit(final long sequenceNumber, final long timeStamp) {
             log.debug("{}: Snapshot success -  sequence number: {}", persistenceId(), sequenceNumber);
 
             if (applySnapshot != null) {
@@ -519,8 +522,8 @@ public class SnapshotManager implements SnapshotState {
         private long index;
         private long term;
 
-        LastAppliedTermInformationReader init(ReplicatedLog log, long originalIndex, ReplicatedLogEntry lastLogEntry,
-                boolean hasFollowers) {
+        LastAppliedTermInformationReader init(final ReplicatedLog log, final long originalIndex,
+                final ReplicatedLogEntry lastLogEntry, final boolean hasFollowers) {
             ReplicatedLogEntry entry = log.get(originalIndex);
             this.index = -1L;
             this.term = -1L;
@@ -556,7 +559,7 @@ public class SnapshotManager implements SnapshotState {
         private long index;
         private long term;
 
-        ReplicatedToAllTermInformationReader init(ReplicatedLog log, long originalIndex) {
+        ReplicatedToAllTermInformationReader init(final ReplicatedLog log, final long originalIndex) {
             ReplicatedLogEntry entry = log.get(originalIndex);
             this.index = -1L;
             this.term = -1L;
index cc20cf6..4ac1705 100644 (file)
@@ -14,7 +14,7 @@ import akka.dispatch.ControlMessage;
  *
  * @author Thomas Pantelis
  */
-public class SnapshotComplete implements ControlMessage {
+public final class SnapshotComplete implements ControlMessage {
     public static final SnapshotComplete INSTANCE = new SnapshotComplete();
 
     private SnapshotComplete() {
index a40e75f..dc9cb23 100644 (file)
@@ -57,7 +57,7 @@ import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 import scala.concurrent.duration.FiniteDuration;
 
 /**
- * The behavior of a RaftActor when it is in the Leader state
+ * The behavior of a RaftActor when it is in the Leader state.
  *
  * <p>
  * Leaders:
@@ -185,7 +185,7 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
     }
 
     @VisibleForTesting
-    void setSnapshot(@Nullable final SnapshotHolder snapshotHolder) {
+    void setSnapshotHolder(@Nullable final SnapshotHolder snapshotHolder) {
         this.snapshotHolder = Optional.fromNullable(snapshotHolder);
     }
 
@@ -493,7 +493,8 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
             scheduleHeartBeat(context.getConfigParams().getHeartBeatInterval());
         } else if (message instanceof SendInstallSnapshot) {
             SendInstallSnapshot sendInstallSnapshot = (SendInstallSnapshot) message;
-            setSnapshot(new SnapshotHolder(sendInstallSnapshot.getSnapshot(), sendInstallSnapshot.getSnapshotBytes()));
+            setSnapshotHolder(new SnapshotHolder(sendInstallSnapshot.getSnapshot(),
+                sendInstallSnapshot.getSnapshotBytes()));
             sendInstallSnapshot();
         } else if (message instanceof Replicate) {
             replicate((Replicate) message);
@@ -547,7 +548,7 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
                     if (!anyFollowersInstallingSnapshot()) {
                         // once there are no pending followers receiving snapshots
                         // we can remove snapshot from the memory
-                        setSnapshot(null);
+                        setSnapshotHolder(null);
                     }
 
                     wasLastChunk = true;
@@ -724,8 +725,8 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
         }
     }
 
-    private List<ReplicatedLogEntry> getEntriesToSend(FollowerLogInformation followerLogInfo,
-            ActorSelection followerActor) {
+    private List<ReplicatedLogEntry> getEntriesToSend(final FollowerLogInformation followerLogInfo,
+            final ActorSelection followerActor) {
         // Try to get all the entries in the journal but not exceeding the max data size for a single AppendEntries
         // message.
         int maxEntries = (int) context.getReplicatedLog().size();
@@ -794,8 +795,8 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
         return Collections.emptyList();
     }
 
-    private void sendAppendEntriesToFollower(ActorSelection followerActor, List<ReplicatedLogEntry> entries,
-            FollowerLogInformation followerLogInformation) {
+    private void sendAppendEntriesToFollower(final ActorSelection followerActor, final List<ReplicatedLogEntry> entries,
+            final FollowerLogInformation followerLogInformation) {
         // In certain cases outlined below we don't want to send the actual commit index to prevent the follower from
         // possibly committing and applying conflicting entries (those with same index, different term) from a prior
         // term that weren't replicated to a majority, which would be a violation of raft.
index a1083eb..56ec83e 100644 (file)
@@ -15,7 +15,7 @@ import akka.dispatch.ControlMessage;
  *
  * @author Thomas Pantelis
  */
-public class GetOnDemandRaftState implements ControlMessage {
+public final class GetOnDemandRaftState implements ControlMessage {
     public static final GetOnDemandRaftState INSTANCE = new GetOnDemandRaftState();
 
     private GetOnDemandRaftState() {
index 40c90fb..aee90ac 100644 (file)
@@ -12,7 +12,7 @@ package org.opendaylight.controller.cluster.raft.persisted;
  *
  * @author Thomas Pantelis
  */
-public class EmptyState implements Snapshot.State {
+public final class EmptyState implements Snapshot.State {
     private static final long serialVersionUID = 1L;
 
     public static final EmptyState INSTANCE = new EmptyState();
index aa3500e..42a4a8d 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payloa
  *
  * @author Thomas Pantelis
  */
+// Not final for mocking
 public class Snapshot implements Serializable {
 
     /**
@@ -108,9 +109,9 @@ public class Snapshot implements Serializable {
     private final String electionVotedFor;
     private final ServerConfigurationPayload serverConfig;
 
-    private Snapshot(State state, List<ReplicatedLogEntry> unAppliedEntries, long lastIndex, long lastTerm,
-            long lastAppliedIndex, long lastAppliedTerm, long electionTerm, String electionVotedFor,
-            ServerConfigurationPayload serverConfig) {
+    Snapshot(final State state, final List<ReplicatedLogEntry> unAppliedEntries, final long lastIndex,
+            final long lastTerm, final long lastAppliedIndex, final long lastAppliedTerm, final long electionTerm,
+            final String electionVotedFor, final ServerConfigurationPayload serverConfig) {
         this.state = state;
         this.unAppliedEntries = unAppliedEntries;
         this.lastIndex = lastIndex;
@@ -122,9 +123,9 @@ public class Snapshot implements Serializable {
         this.serverConfig = serverConfig;
     }
 
-    public static Snapshot create(State state, List<ReplicatedLogEntry> entries, long lastIndex, long lastTerm,
-            long lastAppliedIndex, long lastAppliedTerm, long electionTerm, String electionVotedFor,
-            ServerConfigurationPayload serverConfig) {
+    public static Snapshot create(final State state, final List<ReplicatedLogEntry> entries, final long lastIndex,
+            final long lastTerm, final long lastAppliedIndex, final long lastAppliedTerm, final long electionTerm,
+            final String electionVotedFor, final ServerConfigurationPayload serverConfig) {
         return new Snapshot(state, entries, lastIndex, lastTerm, lastAppliedIndex, lastAppliedTerm,
                 electionTerm, electionVotedFor, serverConfig);
     }
index 9d275e7..ef4151d 100644 (file)
@@ -67,7 +67,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
     private static final class MockIdentifier extends AbstractStringIdentifier<MockIdentifier> {
         private static final long serialVersionUID = 1L;
 
-        protected MockIdentifier(String string) {
+        protected MockIdentifier(final String string) {
             super(string);
         }
     }
@@ -76,7 +76,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         private final String peerId;
         private final String peerAddress;
 
-        public SetPeerAddress(String peerId, String peerAddress) {
+        public SetPeerAddress(final String peerId, final String peerAddress) {
             this.peerId = peerId;
             this.peerAddress = peerAddress;
         }
@@ -95,20 +95,20 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         private final ActorRef collectorActor;
         private final Map<Class<?>, Predicate<?>> dropMessages = new ConcurrentHashMap<>();
 
-        private TestRaftActor(Builder builder) {
+        TestRaftActor(final Builder builder) {
             super(builder);
             this.collectorActor = builder.collectorActor;
         }
 
-        public void startDropMessages(Class<?> msgClass) {
+        public void startDropMessages(final Class<?> msgClass) {
             dropMessages.put(msgClass, msg -> true);
         }
 
-        <T> void startDropMessages(Class<T> msgClass, Predicate<T> filter) {
+        <T> void startDropMessages(final Class<T> msgClass, final Predicate<T> filter) {
             dropMessages.put(msgClass, filter);
         }
 
-        public void stopDropMessages(Class<?> msgClass) {
+        public void stopDropMessages(final Class<?> msgClass) {
             dropMessages.remove(msgClass);
         }
 
@@ -118,7 +118,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
 
         @SuppressWarnings({ "rawtypes", "unchecked", "checkstyle:IllegalCatch" })
         @Override
-        public void handleCommand(Object message) {
+        public void handleCommand(final Object message) {
             if (message instanceof MockPayload) {
                 MockPayload payload = (MockPayload) message;
                 super.persistData(collectorActor, new MockIdentifier(payload.toString()), payload, false);
@@ -154,7 +154,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
 
         @Override
         @SuppressWarnings("checkstyle:IllegalCatch")
-        public void createSnapshot(ActorRef actorRef, Optional<OutputStream> installSnapshotStream) {
+        public void createSnapshot(final ActorRef actorRef, final Optional<OutputStream> installSnapshotStream) {
             MockSnapshotState snapshotState = new MockSnapshotState(new ArrayList<>(getState()));
             if (installSnapshotStream.isPresent()) {
                 SerializationUtils.serialize(snapshotState, installSnapshotStream.get());
@@ -174,13 +174,13 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         public static class Builder extends AbstractBuilder<Builder, TestRaftActor> {
             private ActorRef collectorActor;
 
-            public Builder collectorActor(ActorRef newCollectorActor) {
-                this.collectorActor = newCollectorActor;
-                return this;
+            Builder() {
+                super(TestRaftActor.class);
             }
 
-            private Builder() {
-                super(TestRaftActor.class);
+            public Builder collectorActor(final ActorRef newCollectorActor) {
+                this.collectorActor = newCollectorActor;
+                return this;
             }
         }
     }
@@ -245,17 +245,17 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         return configParams;
     }
 
-    protected void waitUntilLeader(ActorRef actorRef) {
+    protected void waitUntilLeader(final ActorRef actorRef) {
         RaftActorTestKit.waitUntilLeader(actorRef);
     }
 
-    protected TestActorRef<TestRaftActor> newTestRaftActor(String id, Map<String, String> newPeerAddresses,
-            ConfigParams configParams) {
+    protected TestActorRef<TestRaftActor> newTestRaftActor(final String id, final Map<String, String> newPeerAddresses,
+            final ConfigParams configParams) {
         return newTestRaftActor(id, TestRaftActor.newBuilder().peerAddresses(newPeerAddresses != null
                 ? newPeerAddresses : Collections.<String, String>emptyMap()).config(configParams));
     }
 
-    protected TestActorRef<TestRaftActor> newTestRaftActor(String id, TestRaftActor.Builder builder) {
+    protected TestActorRef<TestRaftActor> newTestRaftActor(final String id, final TestRaftActor.Builder builder) {
         builder.collectorActor(factory.createActor(
                 MessageCollectorActor.props(), factory.generateActorId(id + "-collector"))).id(id);
 
@@ -274,7 +274,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         throw lastEx;
     }
 
-    protected void killActor(TestActorRef<TestRaftActor> actor) {
+    protected void killActor(final TestActorRef<TestRaftActor> actor) {
         JavaTestKit testkit = new JavaTestKit(getSystem());
         testkit.watch(actor);
 
@@ -284,13 +284,13 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         testkit.unwatch(actor);
     }
 
-    protected void verifyApplyJournalEntries(ActorRef actor, final long expIndex) {
+    protected void verifyApplyJournalEntries(final ActorRef actor, final long expIndex) {
         MessageCollectorActor.expectFirstMatching(actor, ApplyJournalEntries.class,
             msg -> msg.getToIndex() == expIndex);
     }
 
-    protected void verifySnapshot(String prefix, Snapshot snapshot, long lastAppliedTerm,
-            long lastAppliedIndex, long lastTerm, long lastIndex)
+    protected void verifySnapshot(final String prefix, final Snapshot snapshot, final long lastAppliedTerm,
+            final long lastAppliedIndex, final long lastTerm, final long lastIndex)
                     throws Exception {
         assertEquals(prefix + " Snapshot getLastAppliedTerm", lastAppliedTerm, snapshot.getLastAppliedTerm());
         assertEquals(prefix + " Snapshot getLastAppliedIndex", lastAppliedIndex, snapshot.getLastAppliedIndex());
@@ -305,7 +305,8 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         }
     }
 
-    protected void verifyPersistedJournal(String persistenceId, List<? extends ReplicatedLogEntry> expJournal) {
+    protected void verifyPersistedJournal(final String persistenceId,
+            final List<? extends ReplicatedLogEntry> expJournal) {
         List<ReplicatedLogEntry> journal = InMemoryJournal.get(persistenceId, ReplicatedLogEntry.class);
         assertEquals("Journal ReplicatedLogEntry count", expJournal.size(), journal.size());
         for (int i = 0; i < expJournal.size(); i++) {
@@ -315,11 +316,11 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         }
     }
 
-    protected MockPayload sendPayloadData(ActorRef actor, String data) {
+    protected MockPayload sendPayloadData(final ActorRef actor, final String data) {
         return sendPayloadData(actor, data, 0);
     }
 
-    protected MockPayload sendPayloadData(ActorRef actor, String data, int size) {
+    protected MockPayload sendPayloadData(final ActorRef actor, final String data, final int size) {
         MockPayload payload;
         if (size > 0) {
             payload = new MockPayload(data, size);
@@ -331,8 +332,8 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         return payload;
     }
 
-    protected void verifyApplyState(ApplyState applyState, ActorRef expClientActor,
-            String expId, long expTerm, long expIndex, Payload payload) {
+    protected void verifyApplyState(final ApplyState applyState, final ActorRef expClientActor,
+            final String expId, final long expTerm, final long expIndex, final Payload payload) {
         assertEquals("ApplyState getClientActor", expClientActor, applyState.getClientActor());
 
         final Identifier id = expId == null ? null : new MockIdentifier(expId);
@@ -341,31 +342,32 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         verifyReplicatedLogEntry(replicatedLogEntry, expTerm, expIndex, payload);
     }
 
-    protected void verifyReplicatedLogEntry(ReplicatedLogEntry replicatedLogEntry, long expTerm, long expIndex,
-            Payload payload) {
+    protected void verifyReplicatedLogEntry(final ReplicatedLogEntry replicatedLogEntry, final long expTerm,
+            final long expIndex, final Payload payload) {
         assertEquals("ReplicatedLogEntry getTerm", expTerm, replicatedLogEntry.getTerm());
         assertEquals("ReplicatedLogEntry getIndex", expIndex, replicatedLogEntry.getIndex());
         assertEquals("ReplicatedLogEntry getData", payload, replicatedLogEntry.getData());
     }
 
-    protected String testActorPath(String id) {
+    protected String testActorPath(final String id) {
         return factory.createTestActorPath(id);
     }
 
-    protected void verifyLeadersTrimmedLog(long lastIndex) {
+    protected void verifyLeadersTrimmedLog(final long lastIndex) {
         verifyTrimmedLog("Leader", leaderActor, lastIndex, lastIndex - 1);
     }
 
-    protected void verifyLeadersTrimmedLog(long lastIndex, long replicatedToAllIndex) {
+    protected void verifyLeadersTrimmedLog(final long lastIndex, final long replicatedToAllIndex) {
         verifyTrimmedLog("Leader", leaderActor, lastIndex, replicatedToAllIndex);
     }
 
-    protected void verifyFollowersTrimmedLog(int num, TestActorRef<TestRaftActor> actorRef, long lastIndex) {
+    protected void verifyFollowersTrimmedLog(final int num, final TestActorRef<TestRaftActor> actorRef,
+            final long lastIndex) {
         verifyTrimmedLog("Follower " + num, actorRef, lastIndex, lastIndex - 1);
     }
 
-    protected void verifyTrimmedLog(String name, TestActorRef<TestRaftActor> actorRef, long lastIndex,
-            long replicatedToAllIndex) {
+    protected void verifyTrimmedLog(final String name, final TestActorRef<TestRaftActor> actorRef, final long lastIndex,
+            final long replicatedToAllIndex) {
         TestRaftActor actor = actorRef.underlyingActor();
         RaftActorContext context = actor.getRaftActorContext();
         long snapshotIndex = lastIndex - 1;
@@ -381,7 +383,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    static void verifyRaftState(ActorRef raftActor, Consumer<OnDemandRaftState> verifier) {
+    static void verifyRaftState(final ActorRef raftActor, final Consumer<OnDemandRaftState> verifier) {
         Timeout timeout = new Timeout(500, TimeUnit.MILLISECONDS);
         AssertionError lastError = null;
         Stopwatch sw = Stopwatch.createStarted();
index 108156d..28cc9b3 100644 (file)
@@ -353,7 +353,7 @@ public class MockRaftActor extends RaftActor implements RaftActorRecoveryCohort,
     }
 
     public static class Builder extends AbstractBuilder<Builder, MockRaftActor> {
-        private Builder() {
+        Builder() {
             super(MockRaftActor.class);
         }
     }
index 27fc7c0..1212274 100644 (file)
@@ -177,15 +177,15 @@ public class AbstractLeaderElectionScenarioTest {
         }
     }
 
-    static class SendImmediateHeartBeat implements ControlMessage {
-        public static final SendImmediateHeartBeat INSTANCE = new SendImmediateHeartBeat();
+    static final class SendImmediateHeartBeat implements ControlMessage {
+        static final SendImmediateHeartBeat INSTANCE = new SendImmediateHeartBeat();
 
         private SendImmediateHeartBeat() {
         }
     }
 
-    static class GetBehaviorState implements ControlMessage {
-        public static final GetBehaviorState INSTANCE = new GetBehaviorState();
+    static final class GetBehaviorState implements ControlMessage {
+        static final GetBehaviorState INSTANCE = new GetBehaviorState();
 
         private GetBehaviorState() {
         }
index 7ad5812..5317ec4 100644 (file)
@@ -592,7 +592,7 @@ public class LeaderTest extends AbstractLeaderTest<Leader> {
         leader.markFollowerActive(FOLLOWER_ID);
 
         ByteString bs = toByteString(leadersSnapshot);
-        leader.setSnapshot(new SnapshotHolder(Snapshot.create(ByteState.of(bs.toByteArray()),
+        leader.setSnapshotHolder(new SnapshotHolder(Snapshot.create(ByteState.of(bs.toByteArray()),
                 Collections.<ReplicatedLogEntry>emptyList(), commitIndex, snapshotTerm, commitIndex, snapshotTerm,
                 -1, null, null), ByteSource.wrap(bs.toByteArray())));
         LeaderInstallSnapshotState fts = new LeaderInstallSnapshotState(
@@ -699,7 +699,7 @@ public class LeaderTest extends AbstractLeaderTest<Leader> {
         MessageCollectorActor.expectFirstMatching(followerActor, AppendEntries.class);
 
         // set the snapshot as absent and check if capture-snapshot is invoked.
-        leader.setSnapshot(null);
+        leader.setSnapshotHolder(null);
 
         // new entry
         SimpleReplicatedLogEntry entry = new SimpleReplicatedLogEntry(newEntryIndex, currentTerm,
@@ -757,7 +757,7 @@ public class LeaderTest extends AbstractLeaderTest<Leader> {
         MessageCollectorActor.expectFirstMatching(followerActor, AppendEntries.class);
 
         // set the snapshot as absent and check if capture-snapshot is invoked.
-        leader.setSnapshot(null);
+        leader.setSnapshotHolder(null);
 
         for (int i = 0; i < 4; i++) {
             actorContext.getReplicatedLog().append(new SimpleReplicatedLogEntry(i, 1,
@@ -953,7 +953,7 @@ public class LeaderTest extends AbstractLeaderTest<Leader> {
         actorContext.getTermInformation().update(currentTerm, leaderActor.path().toString());
 
         ByteString bs = toByteString(leadersSnapshot);
-        leader.setSnapshot(new SnapshotHolder(Snapshot.create(ByteState.of(bs.toByteArray()),
+        leader.setSnapshotHolder(new SnapshotHolder(Snapshot.create(ByteState.of(bs.toByteArray()),
                 Collections.<ReplicatedLogEntry>emptyList(), commitIndex, snapshotTerm, commitIndex, snapshotTerm,
                 -1, null, null), ByteSource.wrap(bs.toByteArray())));
         LeaderInstallSnapshotState fts = new LeaderInstallSnapshotState(
index 42411a9..b32b4f4 100644 (file)
@@ -16,16 +16,16 @@ import javax.annotation.Nonnull;
  *
  * @author Thomas Pantelis
  */
-public class ByteState implements Snapshot.State {
+public final class ByteState implements Snapshot.State {
     private static final long serialVersionUID = 1L;
 
     private final byte[] bytes;
 
-    private ByteState(@Nonnull byte[] bytes) {
+    private ByteState(@Nonnull final byte[] bytes) {
         this.bytes = Preconditions.checkNotNull(bytes);
     }
 
-    public static ByteState of(@Nonnull byte[] bytes) {
+    public static ByteState of(@Nonnull final byte[] bytes) {
         return new ByteState(bytes);
     }
 
@@ -46,7 +46,7 @@ public class ByteState implements Snapshot.State {
     }
 
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
index 699a5e3..4c3ad09 100644 (file)
@@ -41,7 +41,7 @@ public class InMemorySnapshotStore extends SnapshotStore {
     private static final Map<String, CountDownLatch> SNAPSHOT_DELETED_LATCHES = new ConcurrentHashMap<>();
     private static Map<String, List<StoredSnapshot>> snapshots = new ConcurrentHashMap<>();
 
-    public static void addSnapshot(String persistentId, Object snapshot) {
+    public static void addSnapshot(final String persistentId, final Object snapshot) {
         List<StoredSnapshot> snapshotList = snapshots.computeIfAbsent(persistentId, k -> new ArrayList<>());
 
         synchronized (snapshotList) {
@@ -51,7 +51,7 @@ public class InMemorySnapshotStore extends SnapshotStore {
     }
 
     @SuppressWarnings("unchecked")
-    public static <T> List<T> getSnapshots(String persistentId, Class<T> type) {
+    public static <T> List<T> getSnapshots(final String persistentId, final Class<T> type) {
         List<StoredSnapshot> stored = snapshots.get(persistentId);
         if (stored == null) {
             return Collections.emptyList();
@@ -74,15 +74,15 @@ public class InMemorySnapshotStore extends SnapshotStore {
         snapshots.clear();
     }
 
-    public static void addSnapshotSavedLatch(String persistenceId) {
+    public static void addSnapshotSavedLatch(final String persistenceId) {
         SNAPSHOT_SAVED_LATCHES.put(persistenceId, new CountDownLatch(1));
     }
 
-    public static void addSnapshotDeletedLatch(String persistenceId) {
+    public static void addSnapshotDeletedLatch(final String persistenceId) {
         SNAPSHOT_DELETED_LATCHES.put(persistenceId, new CountDownLatch(1));
     }
 
-    public static <T> T waitForSavedSnapshot(String persistenceId, Class<T> type) {
+    public static <T> T waitForSavedSnapshot(final String persistenceId, final Class<T> type) {
         if (!Uninterruptibles.awaitUninterruptibly(SNAPSHOT_SAVED_LATCHES.get(persistenceId), 5, TimeUnit.SECONDS)) {
             throw new AssertionError("Snapshot was not saved");
         }
@@ -90,15 +90,15 @@ public class InMemorySnapshotStore extends SnapshotStore {
         return getSnapshots(persistenceId, type).get(0);
     }
 
-    public static void waitForDeletedSnapshot(String persistenceId) {
+    public static void waitForDeletedSnapshot(final String persistenceId) {
         if (!Uninterruptibles.awaitUninterruptibly(SNAPSHOT_DELETED_LATCHES.get(persistenceId), 5, TimeUnit.SECONDS)) {
             throw new AssertionError("Snapshot was not deleted");
         }
     }
 
     @Override
-    public Future<Optional<SelectedSnapshot>> doLoadAsync(String persistenceId,
-            SnapshotSelectionCriteria snapshotSelectionCriteria) {
+    public Future<Optional<SelectedSnapshot>> doLoadAsync(final String persistenceId,
+            final SnapshotSelectionCriteria snapshotSelectionCriteria) {
         List<StoredSnapshot> snapshotList = snapshots.get(persistenceId);
         if (snapshotList == null) {
             return Futures.successful(Optional.<SelectedSnapshot>empty());
@@ -117,13 +117,13 @@ public class InMemorySnapshotStore extends SnapshotStore {
         return Futures.successful(Optional.<SelectedSnapshot>empty());
     }
 
-    private static boolean matches(StoredSnapshot snapshot, SnapshotSelectionCriteria criteria) {
+    private static boolean matches(final StoredSnapshot snapshot, final SnapshotSelectionCriteria criteria) {
         return snapshot.metadata.sequenceNr() <= criteria.maxSequenceNr()
                 && snapshot.metadata.timestamp() <= criteria.maxTimestamp();
     }
 
     @Override
-    public Future<Void> doSaveAsync(SnapshotMetadata snapshotMetadata, Object obj) {
+    public Future<Void> doSaveAsync(final SnapshotMetadata snapshotMetadata, final Object obj) {
         List<StoredSnapshot> snapshotList = snapshots.get(snapshotMetadata.persistenceId());
 
         LOG.trace("doSaveAsync: persistentId {}: sequenceNr: {}: timestamp {}: {}", snapshotMetadata.persistenceId(),
@@ -146,7 +146,7 @@ public class InMemorySnapshotStore extends SnapshotStore {
     }
 
     @Override
-    public Future<Void> doDeleteAsync(SnapshotMetadata metadata) {
+    public Future<Void> doDeleteAsync(final SnapshotMetadata metadata) {
         List<StoredSnapshot> snapshotList = snapshots.get(metadata.persistenceId());
 
         if (snapshotList != null) {
@@ -165,7 +165,7 @@ public class InMemorySnapshotStore extends SnapshotStore {
     }
 
     @Override
-    public Future<Void> doDeleteAsync(String persistenceId, SnapshotSelectionCriteria criteria) {
+    public Future<Void> doDeleteAsync(final String persistenceId, final SnapshotSelectionCriteria criteria) {
         LOG.trace("doDelete: persistentId {}: maxSequenceNr: {}: maxTimestamp {}", persistenceId,
             criteria.maxSequenceNr(), criteria.maxTimestamp());
 
@@ -193,11 +193,11 @@ public class InMemorySnapshotStore extends SnapshotStore {
         return Futures.successful(null);
     }
 
-    private static class StoredSnapshot {
+    private static final class StoredSnapshot {
         private final SnapshotMetadata metadata;
         private final Object data;
 
-        private StoredSnapshot(SnapshotMetadata metadata, Object data) {
+        StoredSnapshot(final SnapshotMetadata metadata, final Object data) {
             this.metadata = metadata;
             this.data = data;
         }
index 2dc3114..aaa9ad6 100644 (file)
@@ -30,35 +30,35 @@ public class Dispatchers {
 
         private final String path;
 
-        DispatcherType(String path) {
+        DispatcherType(final String path) {
             this.path = path;
         }
 
-        private String path(akka.dispatch.Dispatchers dispatchers) {
-            if (dispatchers.hasDispatcher(path)) {
+        String path(final akka.dispatch.Dispatchers knownDispatchers) {
+            if (knownDispatchers.hasDispatcher(path)) {
                 return path;
             }
             return DEFAULT_DISPATCHER_PATH;
         }
 
-        private ExecutionContext dispatcher(akka.dispatch.Dispatchers dispatchers) {
-            if (dispatchers.hasDispatcher(path)) {
-                return dispatchers.lookup(path);
+        ExecutionContext dispatcher(final akka.dispatch.Dispatchers knownDispatchers) {
+            if (knownDispatchers.hasDispatcher(path)) {
+                return knownDispatchers.lookup(path);
             }
-            return dispatchers.defaultGlobalDispatcher();
+            return knownDispatchers.defaultGlobalDispatcher();
         }
     }
 
-    public Dispatchers(akka.dispatch.Dispatchers dispatchers) {
+    public Dispatchers(final akka.dispatch.Dispatchers dispatchers) {
         Preconditions.checkNotNull(dispatchers, "dispatchers should not be null");
         this.dispatchers = dispatchers;
     }
 
-    public ExecutionContext getDispatcher(DispatcherType dispatcherType) {
+    public ExecutionContext getDispatcher(final DispatcherType dispatcherType) {
         return dispatcherType.dispatcher(this.dispatchers);
     }
 
-    public String getDispatcherPath(DispatcherType dispatcherType) {
+    public String getDispatcherPath(final DispatcherType dispatcherType) {
         return dispatcherType.path(this.dispatchers);
     }
 }
index 45e3a8e..87f0e98 100644 (file)
@@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
  * @author Thomas Pantelis
  * @see MessageSlicer
  */
-public class MessageAssembler implements AutoCloseable {
+public final  class MessageAssembler implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(MessageAssembler.class);
 
     private final Cache<Identifier, AssembledMessageState> stateCache;
@@ -40,7 +40,7 @@ public class MessageAssembler implements AutoCloseable {
     private final BiConsumer<Object, ActorRef> assembledMessageCallback;
     private final String logContext;
 
-    private MessageAssembler(final Builder builder) {
+    MessageAssembler(final Builder builder) {
         this.fileBackedStreamFactory = Preconditions.checkNotNull(builder.fileBackedStreamFactory,
                 "FiledBackedStreamFactory cannot be null");
         this.assembledMessageCallback = Preconditions.checkNotNull(builder.assembledMessageCallback,
index dc80c33..bfcfded 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.yangtools.concepts.Identifier;
  *
  * @author Thomas Pantelis
  */
-public class MessageSliceReply implements Serializable {
+public final class MessageSliceReply implements Serializable {
     private static final long serialVersionUID = 1L;
 
     private final Identifier identifier;
@@ -86,12 +86,12 @@ public class MessageSliceReply implements Serializable {
         public Proxy() {
         }
 
-        Proxy(MessageSliceReply messageSliceReply) {
+        Proxy(final MessageSliceReply messageSliceReply) {
             this.messageSliceReply = messageSliceReply;
         }
 
         @Override
-        public void writeExternal(ObjectOutput out) throws IOException {
+        public void writeExternal(final ObjectOutput out) throws IOException {
             out.writeObject(messageSliceReply.identifier);
             out.writeInt(messageSliceReply.sliceIndex);
             out.writeObject(messageSliceReply.failure);
@@ -99,7 +99,7 @@ public class MessageSliceReply implements Serializable {
         }
 
         @Override
-        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
             final Identifier identifier = (Identifier) in.readObject();
             final int sliceIndex = in.readInt();
             final MessageSliceException failure = (MessageSliceException) in.readObject();
index fd08a95..5f75e49 100644 (file)
@@ -46,7 +46,7 @@ public class MessageSlicer implements AutoCloseable {
     private final String logContext;
     private final long id;
 
-    private MessageSlicer(final Builder builder) {
+    MessageSlicer(final Builder builder) {
         this.fileBackedStreamFactory = builder.fileBackedStreamFactory;
         this.messageSliceSize = builder.messageSliceSize;
         this.maxSlicingTries = builder.maxSlicingTries;
index 630a554..6bae647 100644 (file)
@@ -21,10 +21,10 @@ import org.opendaylight.yangtools.concepts.Identifier;
  *
  * @author Thomas Pantelis
  */
-public class SliceOptions {
+public final class SliceOptions {
     private final Builder builder;
 
-    private SliceOptions(Builder builder) {
+    private SliceOptions(final Builder builder) {
         this.builder = builder;
     }
 
index cc64c32..e815187 100644 (file)
@@ -36,7 +36,7 @@ public class MetricsReporter implements AutoCloseable {
     private final JmxReporter jmxReporter;
     private final MetricRegistry metricRegistry = new MetricRegistry();
 
-    private MetricsReporter(final String domainName) {
+    MetricsReporter(final String domainName) {
         this.domainName = domainName;
         jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain(domainName).build();
         jmxReporter.start();
index 770a2ff..22d4d20 100644 (file)
@@ -52,7 +52,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
-public class TestModel {
+public final class TestModel {
 
     public static final QName TEST_QNAME = QName.create(
             "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test",
@@ -102,7 +102,6 @@ public class TestModel {
     private static final String DATASTORE_AUG_YANG = "/odl-datastore-augmentation.yang";
     private static final String DATASTORE_TEST_NOTIFICATION_YANG = "/odl-datastore-test-notification.yang";
 
-
     public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
     public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
             .builder(TEST_PATH).node(DESC_QNAME).build();
@@ -156,15 +155,19 @@ public class TestModel {
                     .build()) //
             .build();
 
-    public static final InputStream getDatastoreTestInputStream() {
+    private TestModel() {
+        throw new UnsupportedOperationException();
+    }
+
+    public static InputStream getDatastoreTestInputStream() {
         return getInputStream(DATASTORE_TEST_YANG);
     }
 
-    public static final InputStream getDatastoreAugInputStream() {
+    public static InputStream getDatastoreAugInputStream() {
         return getInputStream(DATASTORE_AUG_YANG);
     }
 
-    public static final InputStream getDatastoreTestNotificationInputStream() {
+    public static InputStream getDatastoreTestNotificationInputStream() {
         return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
     }
 
index 5ff1f38..c473899 100644 (file)
@@ -74,13 +74,13 @@ public class AbstractMessagingTest {
         JavaTestKit.shutdownActorSystem(ACTOR_SYSTEM, Boolean.TRUE);
     }
 
-    void setupMockFiledBackedStream(final FileBackedOutputStream mockFiledBackedStream) throws IOException {
-        doNothing().when(mockFiledBackedStream).write(any(byte[].class), anyInt(), anyInt());
-        doNothing().when(mockFiledBackedStream).write(any(byte[].class));
-        doNothing().when(mockFiledBackedStream).write(anyInt());
-        doNothing().when(mockFiledBackedStream).close();
-        doNothing().when(mockFiledBackedStream).cleanup();
-        doNothing().when(mockFiledBackedStream).flush();
-        doReturn(mockByteSource).when(mockFiledBackedStream).asByteSource();
+    void setupMockFiledBackedStream(final FileBackedOutputStream mockOutputStream) throws IOException {
+        doNothing().when(mockOutputStream).write(any(byte[].class), anyInt(), anyInt());
+        doNothing().when(mockOutputStream).write(any(byte[].class));
+        doNothing().when(mockOutputStream).write(anyInt());
+        doNothing().when(mockOutputStream).close();
+        doNothing().when(mockOutputStream).cleanup();
+        doNothing().when(mockOutputStream).flush();
+        doReturn(mockByteSource).when(mockOutputStream).asByteSource();
     }
 }
index b7bce6d..9207118 100644 (file)
@@ -43,6 +43,7 @@ public abstract class AbstractDataStoreClientActor extends AbstractClientActor {
         return Verify.verifyNotNull(initialBehavior(context, actorContext));
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     abstract AbstractDataStoreClientBehavior initialBehavior(ClientActorContext context, ActorContext actorContext);
 
     @SuppressWarnings("checkstyle:IllegalCatch")
index 0ce4df0..9b5942c 100644 (file)
@@ -65,9 +65,9 @@ abstract class AbstractShardBackendResolver extends BackendInfoResolver<ShardBac
             return result;
         }
 
-        private synchronized void onStageResolved(final ShardBackendInfo result, final Throwable failure) {
+        private synchronized void onStageResolved(final ShardBackendInfo info, final Throwable failure) {
             if (failure == null) {
-                this.result = Preconditions.checkNotNull(result);
+                this.result = Preconditions.checkNotNull(info);
             } else {
                 LOG.warn("Failed to resolve shard", failure);
             }
index efa503a..02ccde2 100644 (file)
@@ -118,8 +118,8 @@ public class ClientTransaction extends AbstractClientHandle<AbstractProxyTransac
         return parent().onTransactionReady(this, cohort);
     }
 
-    void closeCursor(@Nonnull final DOMDataTreeCursor cursor) {
-        if (cursor.equals(this.cursor)) {
+    void closeCursor(@Nonnull final DOMDataTreeCursor cursorToClose) {
+        if (cursorToClose.equals(this.cursor)) {
             this.cursor = null;
         }
     }
index 61b45ed..ad105c3 100644 (file)
@@ -449,9 +449,11 @@ abstract class ProxyHistory implements Identifiable<LocalHistoryIdentifier> {
     }
 
     @GuardedBy("lock")
+    @SuppressWarnings("checkstyle:hiddenField")
     abstract AbstractProxyTransaction doCreateTransactionProxy(AbstractClientConnection<ShardBackendInfo> connection,
             TransactionIdentifier txId, boolean snapshotOnly, boolean isDone);
 
+    @SuppressWarnings("checkstyle:hiddenField")
     abstract ProxyHistory createSuccessor(AbstractClientConnection<ShardBackendInfo> connection);
 
     @SuppressFBWarnings(value = "UL_UNRELEASED_LOCK", justification = "Lock is released asynchronously via the cohort")
index 2c0be57..33cf8e9 100644 (file)
@@ -31,11 +31,11 @@ import org.slf4j.LoggerFactory;
 import scala.concurrent.Future;
 
 /**
- * ListenerRegistrationProxy acts as a proxy for a ListenerRegistration that was done on a remote shard
+ * ListenerRegistrationProxy acts as a proxy for a ListenerRegistration that was done on a remote shard.
+ *
  * <p>
  * Registering a DataChangeListener on the Data Store creates a new instance of the ListenerRegistrationProxy
  * The ListenerRegistrationProxy talks to a remote ListenerRegistration actor.
- * </p>
  */
 @SuppressWarnings("rawtypes")
 public class DataChangeListenerRegistrationProxy implements ListenerRegistration {
@@ -50,7 +50,8 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
     private boolean closed = false;
 
     public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
-            DataChangeListenerRegistrationProxy(String shardName, ActorContext actorContext, L listener) {
+            DataChangeListenerRegistrationProxy(final String shardName, final ActorContext actorContext,
+                    final L listener) {
         this.shardName = Preconditions.checkNotNull(shardName);
         this.actorContext = Preconditions.checkNotNull(actorContext);
         this.listener = Preconditions.checkNotNull(listener);
@@ -71,7 +72,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
         return listener;
     }
 
-    private void setListenerRegistrationActor(ActorSelection listenerRegistrationActor) {
+    private void setListenerRegistrationActor(final ActorSelection listenerRegistrationActor) {
         if (listenerRegistrationActor == null) {
             return;
         }
@@ -99,7 +100,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
         Future<ActorRef> findFuture = actorContext.findLocalShardAsync(shardName);
         findFuture.onComplete(new OnComplete<ActorRef>() {
             @Override
-            public void onComplete(Throwable failure, ActorRef shard) {
+            public void onComplete(final Throwable failure, final ActorRef shard) {
                 if (failure instanceof LocalShardNotFoundException) {
                     LOG.debug("No local shard found for {} - DataChangeListener {} at path {} "
                             + "cannot be registered", shardName, listener, path);
@@ -113,8 +114,8 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
         }, actorContext.getClientDispatcher());
     }
 
-    private void doRegistration(ActorRef shard, final YangInstanceIdentifier path,
-            DataChangeScope scope) {
+    private void doRegistration(final ActorRef shard, final YangInstanceIdentifier path,
+            final DataChangeScope scope) {
 
         Future<Object> future = actorContext.executeOperationAsync(shard,
                 new RegisterChangeListener(path, dataChangeListenerActor, scope,
@@ -123,7 +124,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
 
         future.onComplete(new OnComplete<Object>() {
             @Override
-            public void onComplete(Throwable failure, Object result) {
+            public void onComplete(final Throwable failure, final Object result) {
                 if (failure != null) {
                     LOG.error("Failed to register DataChangeListener {} at path {}",
                             listener, path.toString(), failure);
index dee8142..8be23d1 100644 (file)
@@ -35,6 +35,7 @@ import scala.concurrent.duration.FiniteDuration;
  *
  * @author Thomas Pantelis
  */
+// Noo-final for mocking
 public class DatastoreContext implements ClientActorConfig {
     public static final String METRICS_DOMAIN = "org.opendaylight.controller.cluster.datastore";
 
@@ -97,7 +98,7 @@ public class DatastoreContext implements ClientActorConfig {
         return GLOBAL_DATASTORE_NAMES;
     }
 
-    private DatastoreContext() {
+    DatastoreContext() {
         setShardJournalRecoveryLogBatchSize(DEFAULT_JOURNAL_RECOVERY_BATCH_SIZE);
         setSnapshotBatchCount(DEFAULT_SNAPSHOT_BATCH_COUNT);
         setHeartbeatInterval(DEFAULT_HEARTBEAT_INTERVAL_IN_MILLIS);
@@ -348,7 +349,7 @@ public class DatastoreContext implements ClientActorConfig {
         private int maxShardDataStoreExecutorQueueSize =
                 InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE;
 
-        private Builder(final DatastoreContext datastoreContext) {
+        Builder(final DatastoreContext datastoreContext) {
             this.datastoreContext = datastoreContext;
 
             if (datastoreContext.getDataStoreProperties() != null) {
@@ -526,23 +527,23 @@ public class DatastoreContext implements ClientActorConfig {
             return this;
         }
 
-        public Builder maxShardDataChangeExecutorPoolSize(final int maxShardDataChangeExecutorPoolSize) {
-            this.maxShardDataChangeExecutorPoolSize = maxShardDataChangeExecutorPoolSize;
+        public Builder maxShardDataChangeExecutorPoolSize(final int newMaxShardDataChangeExecutorPoolSize) {
+            this.maxShardDataChangeExecutorPoolSize = newMaxShardDataChangeExecutorPoolSize;
             return this;
         }
 
-        public Builder maxShardDataChangeExecutorQueueSize(final int maxShardDataChangeExecutorQueueSize) {
-            this.maxShardDataChangeExecutorQueueSize = maxShardDataChangeExecutorQueueSize;
+        public Builder maxShardDataChangeExecutorQueueSize(final int newMaxShardDataChangeExecutorQueueSize) {
+            this.maxShardDataChangeExecutorQueueSize = newMaxShardDataChangeExecutorQueueSize;
             return this;
         }
 
-        public Builder maxShardDataChangeListenerQueueSize(final int maxShardDataChangeListenerQueueSize) {
-            this.maxShardDataChangeListenerQueueSize = maxShardDataChangeListenerQueueSize;
+        public Builder maxShardDataChangeListenerQueueSize(final int newMaxShardDataChangeListenerQueueSize) {
+            this.maxShardDataChangeListenerQueueSize = newMaxShardDataChangeListenerQueueSize;
             return this;
         }
 
-        public Builder maxShardDataStoreExecutorQueueSize(final int maxShardDataStoreExecutorQueueSize) {
-            this.maxShardDataStoreExecutorQueueSize = maxShardDataStoreExecutorQueueSize;
+        public Builder maxShardDataStoreExecutorQueueSize(final int newMaxShardDataStoreExecutorQueueSize) {
+            this.maxShardDataStoreExecutorQueueSize = newMaxShardDataStoreExecutorQueueSize;
             return this;
         }
 
index e29de0f..db9acae 100644 (file)
@@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Thomas Pantelis
  */
-public class DatastoreSnapshotRestore {
+public final class DatastoreSnapshotRestore {
     private static final Logger LOG = LoggerFactory.getLogger(DatastoreSnapshotRestore.class);
 
     private static AtomicReference<DatastoreSnapshotRestore> instance = new AtomicReference<>();
@@ -35,12 +35,12 @@ public class DatastoreSnapshotRestore {
     private final String restoreDirectoryPath;
     private final Map<String, DatastoreSnapshot> datastoreSnapshots = new ConcurrentHashMap<>();
 
-    public static DatastoreSnapshotRestore instance(String restoreDirectoryPath) {
+    public static DatastoreSnapshotRestore instance(final String restoreDirectoryPath) {
         instance.compareAndSet(null, new DatastoreSnapshotRestore(restoreDirectoryPath));
         return instance.get();
     }
 
-    private DatastoreSnapshotRestore(String restoreDirectoryPath) {
+    private DatastoreSnapshotRestore(final String restoreDirectoryPath) {
         this.restoreDirectoryPath = Preconditions.checkNotNull(restoreDirectoryPath);
     }
 
@@ -84,14 +84,14 @@ public class DatastoreSnapshotRestore {
         }
     }
 
-    private static DatastoreSnapshotList deserialize(InputStream inputStream)
+    private static DatastoreSnapshotList deserialize(final InputStream inputStream)
             throws IOException, ClassNotFoundException {
         try (ObjectInputStream ois = new ObjectInputStream(inputStream)) {
             return (DatastoreSnapshotList) ois.readObject();
         }
     }
 
-    public DatastoreSnapshot getAndRemove(String datastoreType) {
+    public DatastoreSnapshot getAndRemove(final String datastoreType) {
         initialize();
         return datastoreSnapshots.remove(datastoreType);
     }
index 2f82ac5..0846590 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class DistributedDataStoreFactory {
+public final class DistributedDataStoreFactory {
 
     private static final Logger LOG = LoggerFactory.getLogger(DistributedDataStoreFactory.class);
     private static final String DEFAULT_MODULE_SHARDS_PATH = "./configuration/initial/module-shards.conf";
index 22ba497..c1162c2 100644 (file)
@@ -97,12 +97,12 @@ final class RemoteTransactionContextSupport {
     /**
      * Sets the target primary shard and initiates a CreateTransaction try.
      */
-    void setPrimaryShard(PrimaryShardInfo primaryShardInfo) {
-        this.primaryShardInfo = primaryShardInfo;
+    void setPrimaryShard(final PrimaryShardInfo newPrimaryShardInfo) {
+        this.primaryShardInfo = newPrimaryShardInfo;
 
         if (getTransactionType() == TransactionType.WRITE_ONLY
                 && getActorContext().getDatastoreContext().isWriteOnlyTransactionOptimizationsEnabled()) {
-            ActorSelection primaryShard = primaryShardInfo.getPrimaryShardActor();
+            ActorSelection primaryShard = newPrimaryShardInfo.getPrimaryShardActor();
 
             LOG.debug("Tx {} Primary shard {} found - creating WRITE_ONLY transaction context",
                 getIdentifier(), primaryShard);
@@ -110,7 +110,7 @@ final class RemoteTransactionContextSupport {
             // For write-only Tx's we prepare the transaction modifications directly on the shard actor
             // to avoid the overhead of creating a separate transaction actor.
             transactionContextWrapper.executePriorTransactionOperations(createValidTransactionContext(
-                    primaryShard, String.valueOf(primaryShard.path()), primaryShardInfo.getPrimaryShardVersion()));
+                    primaryShard, String.valueOf(primaryShard.path()), newPrimaryShardInfo.getPrimaryShardVersion()));
         } else {
             tryCreateTransaction();
         }
@@ -131,7 +131,7 @@ final class RemoteTransactionContextSupport {
 
         createTxFuture.onComplete(new OnComplete<Object>() {
             @Override
-            public void onComplete(Throwable failure, Object response) {
+            public void onComplete(final Throwable failure, final Object response) {
                 onCreateTransactionComplete(failure, response);
             }
         }, getActorContext().getClientDispatcher());
@@ -161,7 +161,7 @@ final class RemoteTransactionContextSupport {
         }
     }
 
-    private void onCreateTransactionComplete(Throwable failure, Object response) {
+    private void onCreateTransactionComplete(final Throwable failure, final 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
@@ -194,7 +194,7 @@ final class RemoteTransactionContextSupport {
         createTransactionContext(failure, response);
     }
 
-    private void createTransactionContext(Throwable failure, Object response) {
+    private void createTransactionContext(final Throwable failure, final Object response) {
         // Create the TransactionContext from the response or failure. Store the new
         // TransactionContext locally until we've completed invoking the
         // TransactionOperations. This avoids thread timing issues which could cause
@@ -231,15 +231,15 @@ final class RemoteTransactionContextSupport {
         transactionContextWrapper.executePriorTransactionOperations(localTransactionContext);
     }
 
-    private TransactionContext createValidTransactionContext(CreateTransactionReply reply) {
+    private TransactionContext createValidTransactionContext(final CreateTransactionReply reply) {
         LOG.debug("Tx {} Received {}", getIdentifier(), reply);
 
         return createValidTransactionContext(getActorContext().actorSelection(reply.getTransactionPath()),
                 reply.getTransactionPath(), primaryShardInfo.getPrimaryShardVersion());
     }
 
-    private TransactionContext createValidTransactionContext(ActorSelection transactionActor, String transactionPath,
-            short remoteTransactionVersion) {
+    private TransactionContext createValidTransactionContext(final ActorSelection transactionActor,
+            final String transactionPath, final short remoteTransactionVersion) {
         final TransactionContext ret = new RemoteTransactionContext(transactionContextWrapper.getIdentifier(),
                 transactionActor, getActorContext(), remoteTransactionVersion, transactionContextWrapper.getLimiter());
 
index 402bf48..3719f74 100644 (file)
@@ -1059,9 +1059,9 @@ public class Shard extends RaftActor {
             return self();
         }
 
-        public T schemaContextProvider(final SchemaContextProvider schemaContextProvider) {
+        public T schemaContextProvider(final SchemaContextProvider newSchemaContextProvider) {
             checkSealed();
-            this.schemaContextProvider = Preconditions.checkNotNull(schemaContextProvider);
+            this.schemaContextProvider = Preconditions.checkNotNull(newSchemaContextProvider);
             return self();
         }
 
@@ -1128,7 +1128,7 @@ public class Shard extends RaftActor {
     }
 
     public static class Builder extends AbstractBuilder<Builder, Shard> {
-        private Builder() {
+        Builder() {
             super(Shard.class);
         }
     }
index ef40480..b7d77f8 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
  *
  * @author Thomas Pantelis
  */
-public class ShardDataChangePublisherActor
+public final class ShardDataChangePublisherActor
         extends ShardDataTreeNotificationPublisherActor<ShardDataChangeListenerPublisher> {
 
     private ShardDataChangePublisherActor(final String name, final String logContext) {
@@ -31,7 +31,7 @@ public class ShardDataChangePublisherActor
     }
 
     @Override
-    protected void handleReceive(Object message) {
+    protected void handleReceive(final Object message) {
         if (message instanceof RegisterListener) {
             RegisterListener reg = (RegisterListener)message;
             if (reg.initialState.isPresent()) {
index 61a3fa1..72d0ee8 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
  *
  * @author Thomas Pantelis
  */
-public class ShardDataTreeChangePublisherActor
+public final class ShardDataTreeChangePublisherActor
         extends ShardDataTreeNotificationPublisherActor<ShardDataTreeChangeListenerPublisher> {
 
     private ShardDataTreeChangePublisherActor(final String name, final String logContext) {
@@ -29,7 +29,7 @@ public class ShardDataTreeChangePublisherActor
     }
 
     @Override
-    protected void handleReceive(Object message) {
+    protected void handleReceive(final Object message) {
         if (message instanceof RegisterListener) {
             RegisterListener reg = (RegisterListener)message;
             LOG.debug("{}: Received {}", logContext(), reg);
index 455c874..d8c49a9 100644 (file)
@@ -33,7 +33,7 @@ import org.slf4j.Logger;
  *
  * @author Thomas Pantelis
  */
-class ShardSnapshotCohort implements RaftActorSnapshotCohort {
+final class ShardSnapshotCohort implements RaftActorSnapshotCohort {
     private static final FrontendType SNAPSHOT_APPLY = FrontendType.forName("snapshot-apply");
 
     private final ActorRef snapshotActor;
index 353c80c..5b4e2ff 100644 (file)
@@ -22,14 +22,14 @@ import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy
  *
  * @author Thomas Pantelis
  */
-public class ModuleConfig {
+public final class ModuleConfig {
     private final String name;
     private final String namespace;
     private final ShardStrategy shardStrategy;
     private final Map<String, ShardConfig> shardConfigs;
 
-    private ModuleConfig(String name, String namespace, ShardStrategy shardStrategy,
-            Map<String, ShardConfig> shardConfigs) {
+    ModuleConfig(final String name, final String namespace, final ShardStrategy shardStrategy,
+            final Map<String, ShardConfig> shardConfigs) {
         this.name = name;
         this.namespace = namespace;
         this.shardStrategy = shardStrategy;
@@ -52,7 +52,7 @@ public class ModuleConfig {
     }
 
     @Nullable
-    public ShardConfig getShardConfig(String forName) {
+    public ShardConfig getShardConfig(final String forName) {
         return shardConfigs.get(forName);
     }
 
@@ -66,25 +66,25 @@ public class ModuleConfig {
         return shardConfigs.keySet();
     }
 
-    public static Builder builder(String name) {
+    public static Builder builder(final String name) {
         return new Builder(name);
     }
 
-    public static Builder builder(ModuleConfig moduleConfig) {
+    public static Builder builder(final ModuleConfig moduleConfig) {
         return new Builder(moduleConfig);
     }
 
-    public static class Builder {
+    public static final class Builder {
         private String name;
         private String nameSpace;
         private ShardStrategy shardStrategy;
         private final Map<String, ShardConfig> shardConfigs = new HashMap<>();
 
-        private Builder(String name) {
+        Builder(final String name) {
             this.name = name;
         }
 
-        private Builder(ModuleConfig moduleConfig) {
+        private Builder(final ModuleConfig moduleConfig) {
             this.name = moduleConfig.getName();
             this.nameSpace = moduleConfig.getNamespace();
             this.shardStrategy = moduleConfig.getShardStrategy();
@@ -93,22 +93,22 @@ public class ModuleConfig {
             }
         }
 
-        public Builder name(String newName) {
+        public Builder name(final String newName) {
             this.name = newName;
             return this;
         }
 
-        public Builder nameSpace(String newNameSpace) {
+        public Builder nameSpace(final String newNameSpace) {
             this.nameSpace = newNameSpace;
             return this;
         }
 
-        public Builder shardStrategy(ShardStrategy newShardStrategy) {
+        public Builder shardStrategy(final ShardStrategy newShardStrategy) {
             this.shardStrategy = newShardStrategy;
             return this;
         }
 
-        public Builder shardConfig(String shardName, Collection<MemberName> replicas) {
+        public Builder shardConfig(final String shardName, final Collection<MemberName> replicas) {
             shardConfigs.put(shardName, new ShardConfig(shardName, replicas));
             return this;
         }
index beee118..944d14a 100644 (file)
@@ -74,7 +74,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ
     private volatile ActorRef localEntityOwnershipShard;
     private volatile DataTree localEntityOwnershipShardDataTree;
 
-    private DistributedEntityOwnershipService(final ActorContext context) {
+    DistributedEntityOwnershipService(final ActorContext context) {
         this.context = Preconditions.checkNotNull(context);
     }
 
index fbffd5b..42779b0 100644 (file)
@@ -20,15 +20,15 @@ import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
  *
  * @author Thomas Pantelis
  */
-class EntityOwnershipListenerActor extends AbstractUntypedActor {
+final class EntityOwnershipListenerActor extends AbstractUntypedActor {
     private final DOMEntityOwnershipListener listener;
 
-    private EntityOwnershipListenerActor(DOMEntityOwnershipListener listener) {
+    private EntityOwnershipListenerActor(final DOMEntityOwnershipListener listener) {
         this.listener = listener;
     }
 
     @Override
-    protected void handleReceive(Object message) {
+    protected void handleReceive(final Object message) {
         if (message instanceof DOMEntityOwnershipChange) {
             onEntityOwnershipChanged((DOMEntityOwnershipChange)message);
         } else {
@@ -37,7 +37,7 @@ class EntityOwnershipListenerActor extends AbstractUntypedActor {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    private void onEntityOwnershipChanged(DOMEntityOwnershipChange change) {
+    private void onEntityOwnershipChanged(final DOMEntityOwnershipChange change) {
         LOG.debug("Notifying EntityOwnershipListener {}: {}", listener, change);
 
         try {
@@ -47,7 +47,7 @@ class EntityOwnershipListenerActor extends AbstractUntypedActor {
         }
     }
 
-    static Props props(DOMEntityOwnershipListener listener) {
+    static Props props(final DOMEntityOwnershipListener listener) {
         return Props.create(new EntityOwnershipListenerCreator(listener));
     }
 
@@ -58,7 +58,7 @@ class EntityOwnershipListenerActor extends AbstractUntypedActor {
                 + "create remote instances of this actor and thus don't need it to be Serializable.")
         private final DOMEntityOwnershipListener listener;
 
-        EntityOwnershipListenerCreator(DOMEntityOwnershipListener listener) {
+        EntityOwnershipListenerCreator(final DOMEntityOwnershipListener listener) {
             this.listener = Preconditions.checkNotNull(listener);
         }
 
index 84a58d9..ee786e7 100644 (file)
@@ -49,11 +49,12 @@ class EntityOwnershipListenerSupport extends EntityOwnershipChangePublisher {
 
     private volatile boolean inJeopardy = false;
 
-    EntityOwnershipListenerSupport(ActorContext actorContext, String logId) {
+    EntityOwnershipListenerSupport(final ActorContext actorContext, final String logId) {
         this.actorContext = actorContext;
         this.logId = logId;
     }
 
+    @Override
     String getLogId() {
         return logId;
     }
@@ -64,13 +65,14 @@ class EntityOwnershipListenerSupport extends EntityOwnershipChangePublisher {
      * @param inJeopardy new value of the in-jeopardy flag
      * @return Previous value of the flag.
      */
+    @SuppressWarnings("checkstyle:hiddenField")
     boolean setInJeopardy(final boolean inJeopardy) {
         final boolean wasInJeopardy = this.inJeopardy;
         this.inJeopardy = inJeopardy;
         return wasInJeopardy;
     }
 
-    void addEntityOwnershipListener(String entityType, DOMEntityOwnershipListener listener) {
+    void addEntityOwnershipListener(final String entityType, final DOMEntityOwnershipListener listener) {
         LOG.debug("{}: Adding EntityOwnershipListener {} for entity type {}", logId, listener, entityType);
 
         listenerLock.writeLock().lock();
@@ -88,7 +90,7 @@ class EntityOwnershipListenerSupport extends EntityOwnershipChangePublisher {
         }
     }
 
-    void removeEntityOwnershipListener(String entityType, DOMEntityOwnershipListener listener) {
+    void removeEntityOwnershipListener(final String entityType, final DOMEntityOwnershipListener listener) {
         LOG.debug("{}: Removing EntityOwnershipListener {} for entity type {}", logId, listener, entityType);
 
         listenerLock.writeLock().lock();
@@ -114,7 +116,8 @@ class EntityOwnershipListenerSupport extends EntityOwnershipChangePublisher {
     }
 
     @Override
-    void notifyEntityOwnershipListeners(DOMEntity entity, boolean wasOwner, boolean isOwner, boolean hasOwner) {
+    void notifyEntityOwnershipListeners(final DOMEntity entity, final boolean wasOwner, final boolean isOwner,
+            final boolean hasOwner) {
         listenerLock.readLock().lock();
         try {
             Collection<DOMEntityOwnershipListener> listeners = entityTypeListenerMap.get(entity.getType());
@@ -127,8 +130,8 @@ class EntityOwnershipListenerSupport extends EntityOwnershipChangePublisher {
         }
     }
 
-    void notifyEntityOwnershipListener(DOMEntity entity, boolean wasOwner, boolean isOwner, boolean hasOwner,
-            DOMEntityOwnershipListener listener) {
+    void notifyEntityOwnershipListener(final DOMEntity entity, final boolean wasOwner, final boolean isOwner,
+            final boolean hasOwner, final DOMEntityOwnershipListener listener) {
         listenerLock.readLock().lock();
         try {
             notifyListeners(entity, wasOwner, isOwner, hasOwner, ImmutableList.of(listenerActorMap.get(listener)));
@@ -138,8 +141,8 @@ class EntityOwnershipListenerSupport extends EntityOwnershipChangePublisher {
     }
 
     @GuardedBy("listenerLock")
-    private void notifyListeners(DOMEntity entity, boolean wasOwner, boolean isOwner, boolean hasOwner,
-            Collection<ListenerActorRefEntry> listenerEntries) {
+    private void notifyListeners(final DOMEntity entity, final boolean wasOwner, final boolean isOwner,
+            final boolean hasOwner, final Collection<ListenerActorRefEntry> listenerEntries) {
         DOMEntityOwnershipChange changed = new DOMEntityOwnershipChange(entity,
                 EntityOwnershipChangeState.from(wasOwner, isOwner, hasOwner), inJeopardy);
         for (ListenerActorRefEntry entry: listenerEntries) {
index 1999296..a5ffc49 100644 (file)
@@ -30,7 +30,8 @@ public final class EntityOwnerSelectionStrategyConfig {
         return entityTypeToStrategyInfo.get(entityType) != null;
     }
 
-    public EntityOwnerSelectionStrategy createStrategy(String entityType, Map<String, Long> initialStatistics) {
+    public EntityOwnerSelectionStrategy createStrategy(final String entityType,
+            final Map<String, Long> initialStatistics) {
         final EntityOwnerSelectionStrategy strategy;
         final EntityOwnerSelectionStrategy existingStrategy = entityTypeToOwnerSelectionStrategy.get(entityType);
         if (existingStrategy != null) {
@@ -70,7 +71,7 @@ public final class EntityOwnerSelectionStrategyConfig {
             this.delay = delay;
         }
 
-        public EntityOwnerSelectionStrategy createStrategy(Map<String, Long> initialStatistics) {
+        public EntityOwnerSelectionStrategy createStrategy(final Map<String, Long> initialStatistics) {
             try {
                 return strategyClass.getDeclaredConstructor(long.class, Map.class)
                         .newInstance(delay, initialStatistics);
@@ -86,10 +87,10 @@ public final class EntityOwnerSelectionStrategyConfig {
         return new Builder(new EntityOwnerSelectionStrategyConfig());
     }
 
-    public static class Builder {
+    public static final class Builder {
         private final EntityOwnerSelectionStrategyConfig config;
 
-        private Builder(final EntityOwnerSelectionStrategyConfig config) {
+        Builder(final EntityOwnerSelectionStrategyConfig config) {
             this.config = config;
         }
 
index e8824fb..956fa36 100644 (file)
@@ -23,7 +23,7 @@ public class ShardIdentifier {
     private final String type;
     private final String fullName;
 
-    private ShardIdentifier(String shardName, MemberName memberName, String type) {
+    ShardIdentifier(final String shardName, final MemberName memberName, final String type) {
         this.shardName = Preconditions.checkNotNull(shardName, "shardName should not be null");
         this.memberName = Preconditions.checkNotNull(memberName, "memberName should not be null");
         this.type = Preconditions.checkNotNull(type, "type should not be null");
@@ -43,7 +43,7 @@ public class ShardIdentifier {
     }
 
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
@@ -101,22 +101,22 @@ public class ShardIdentifier {
             return new ShardIdentifier(shardName, memberName, type);
         }
 
-        public Builder shardName(String newShardName) {
+        public Builder shardName(final String newShardName) {
             this.shardName = newShardName;
             return this;
         }
 
-        public Builder memberName(MemberName newMemberName) {
+        public Builder memberName(final MemberName newMemberName) {
             this.memberName = newMemberName;
             return this;
         }
 
-        public Builder type(String newType) {
+        public Builder type(final String newType) {
             this.type = newType;
             return this;
         }
 
-        public Builder fromShardIdString(String shardId) {
+        public Builder fromShardIdString(final String shardId) {
             Matcher matcher = PATTERN.matcher(shardId);
 
             if (matcher.matches()) {
index 230da28..ba00d0b 100644 (file)
@@ -12,12 +12,8 @@ import akka.pattern.Patterns;
 import akka.util.Timeout;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Stopwatch;
-import com.google.common.base.Throwables;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
-import com.google.common.util.concurrent.ExecutionError;
-import com.google.common.util.concurrent.UncheckedExecutionException;
-import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.datastore.messages.OnDemandShardState;
 import org.opendaylight.controller.cluster.raft.client.messages.GetOnDemandRaftState;
@@ -36,7 +32,7 @@ class OnDemandShardStateCache {
     private final String shardName;
     private volatile String stateRetrievalTime;
 
-    OnDemandShardStateCache(String shardName, ActorRef shardActor) {
+    OnDemandShardStateCache(final String shardName, final ActorRef shardActor) {
         this.shardName = Preconditions.checkNotNull(shardName);
         this.shardActor = shardActor;
     }
@@ -46,16 +42,7 @@ class OnDemandShardStateCache {
             return OnDemandShardState.newBuilder().build();
         }
 
-        try {
-            return ONDEMAND_SHARD_STATE_CACHE.get(shardName, this::retrieveState);
-        } catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
-            if (e.getCause() != null) {
-                Throwables.propagateIfPossible(e.getCause(), Exception.class);
-                throw new RuntimeException("unexpected", e.getCause());
-            }
-
-            throw e;
-        }
+        return ONDEMAND_SHARD_STATE_CACHE.get(shardName, this::retrieveState);
     }
 
     String getStatRetrievaelTime() {
index 4f90c32..c70f37b 100644 (file)
@@ -5,10 +5,9 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class DataChangedReply {
+public final class DataChangedReply {
     public static final DataChangedReply INSTANCE = new DataChangedReply();
 
     private DataChangedReply() {
index 0d63b6b..654bd73 100644 (file)
@@ -12,7 +12,7 @@ package org.opendaylight.controller.cluster.datastore.messages;
  *
  * @author Thomas Pantelis
  */
-public class GetShardDataTree {
+public final class GetShardDataTree {
     public static final GetShardDataTree INSTANCE = new GetShardDataTree();
 
     private GetShardDataTree() {
index fde42f8..4f74bda 100644 (file)
@@ -14,7 +14,7 @@ import java.io.Serializable;
  *
  * @author Thomas Pantelis
  */
-public class SuccessReply implements Serializable {
+public final class SuccessReply implements Serializable {
     private static final long serialVersionUID = 1L;
 
     public static final SuccessReply INSTANCE = new SuccessReply();
index ced960d..b59132f 100644 (file)
@@ -5,17 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.cluster.datastore.modification;
 
 import java.util.List;
 
 /**
- * CompositeModification contains a list of modifications that need to be applied to the DOMStore
+ * CompositeModification contains a list of modifications that need to be applied to the DOMStore.
+ *
  * <p>
  * A CompositeModification gets stored in the transaction log for a Shard. During recovery when the transaction log
  * is being replayed a DOMStoreWriteTransaction could be created and a CompositeModification could be applied to it.
- * </p>
  */
 public interface CompositeModification extends Modification {
     /**
index 4692236..b0ad960 100644 (file)
@@ -63,6 +63,7 @@ public abstract class AbstractIdentifiablePayload<T extends Identifier>
         protected abstract T readIdentifier(@Nonnull DataInput in) throws IOException;
 
         @Nonnull
+        @SuppressWarnings("checkstyle:hiddenField")
         protected abstract Identifiable<T> createObject(@Nonnull T identifier, @Nonnull byte[] serialized);
     }
 
@@ -90,5 +91,6 @@ public abstract class AbstractIdentifiablePayload<T extends Identifier>
     }
 
     @Nonnull
+    @SuppressWarnings("checkstyle:hiddenField")
     protected abstract AbstractProxy<T> externalizableProxy(@Nonnull byte[] serialized);
 }
index 4dd409e..eb6ebb3 100644 (file)
@@ -74,9 +74,9 @@ public abstract class AbstractShardManagerCreator<T extends AbstractShardManager
         return distributedDataStore;
     }
 
-    public T distributedDataStore(final AbstractDataStore distributedDataStore) {
+    public T distributedDataStore(final AbstractDataStore newDistributedDataStore) {
         checkSealed();
-        this.distributedDataStore = distributedDataStore;
+        this.distributedDataStore = newDistributedDataStore;
         return self();
     }
 
index 8fc77ac..b2ac96e 100644 (file)
@@ -63,7 +63,7 @@ final class ShardInformation {
 
     private DatastoreContext datastoreContext;
     private Shard.AbstractBuilder<?, ?> builder;
-    private boolean isActiveMember = true;
+    private boolean activeMember = true;
 
     ShardInformation(final String shardName, final ShardIdentifier shardId,
             final Map<String, String> initialPeerAddresses, final DatastoreContext datastoreContext,
@@ -101,8 +101,8 @@ final class ShardInformation {
         return shardId;
     }
 
-    void setLocalDataTree(final Optional<DataTree> localShardDataTree) {
-        this.localShardDataTree = localShardDataTree;
+    void setLocalDataTree(final Optional<DataTree> dataTree) {
+        this.localShardDataTree = dataTree;
     }
 
     Optional<DataTree> getLocalShardDataTree() {
@@ -113,8 +113,8 @@ final class ShardInformation {
         return datastoreContext;
     }
 
-    void setDatastoreContext(final DatastoreContext datastoreContext, final ActorRef sender) {
-        this.datastoreContext = datastoreContext;
+    void setDatastoreContext(final DatastoreContext newDatastoreContext, final ActorRef sender) {
+        this.datastoreContext = newDatastoreContext;
         if (actor != null) {
             LOG.debug("Sending new DatastoreContext to {}", shardId);
             actor.tell(this.datastoreContext, sender);
@@ -233,10 +233,10 @@ final class ShardInformation {
         return false;
     }
 
-    boolean setLeaderId(final String leaderId) {
-        final boolean changed = !Objects.equals(this.leaderId, leaderId);
-        this.leaderId = leaderId;
-        if (leaderId != null) {
+    boolean setLeaderId(final String newLeaderId) {
+        final boolean changed = !Objects.equals(this.leaderId, newLeaderId);
+        this.leaderId = newLeaderId;
+        if (newLeaderId != null) {
             this.leaderAvailable = true;
         }
         notifyOnShardInitializedCallbacks();
@@ -265,11 +265,11 @@ final class ShardInformation {
     }
 
     boolean isActiveMember() {
-        return isActiveMember;
+        return activeMember;
     }
 
     void setActiveMember(final boolean isActiveMember) {
-        this.isActiveMember = isActiveMember;
+        this.activeMember = isActiveMember;
     }
 
     SchemaContext getSchemaContext() {