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 81b374d9fa43420af3a4f2fa670e702d0280d314..e823523e8e75aea7cdcc69da90fa634e995296d0 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 83e83e9b176a9bb1f44c8f87535609b480e77216..760853e93b7f88d100c740f1f9f6e4de51e2fa9a 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 08e6d18c6433d80fc8fc98ec81e2630d6caaaa95..de4b582abfff25cb7eea38a5457142f8b0cd9c78 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 839612cb18320c075a5f2d7e46725fb954ded7aa..5cb99d34d4a8afde5c958b4630866d1941e5a2df 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 12287c00f5620a99b4fa3db0c89c705ce9b01fa1..29a8ce3ebe498ceadbbae08f2b7b662190773bba 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 b3c2d7461b5a553168aa0b14337ac6ad29161834..559e0663def9d2949dc7a95fe199314f0919e32d 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 5f6db7291afaa43c73a119d38c2d2f6ce75c1d79..11b3f0be7e3a0ee688ebfd6178fe99214575644b 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 c535b2184c8b10759f46d18da4e4d64c298186e5..0f9e6f3ac02661d96417d560ddaca1132d38af2d 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 2d8bcbb83b55bbbaa7624f774f1c614b91c82326..50db588f6f662d0c9761f9f79ceb38ee542d9f7a 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 f5131c8752c0092922d06e9c62155fe20eb5a06e..36a41d04419bb779c31f90cd14e800aace728525 100644 (file)
@@ -24,6 +24,7 @@ public abstract class AttributeIfcSwitchStatement<T> {
 
     private AttributeIfc lastAttribute;
 
+    @SuppressWarnings("checkstyle:avoidHidingCauseException")
     public T switchAttribute(final AttributeIfc attributeIfc) {
 
         this.lastAttribute = attributeIfc;
index 4920cc563a283ef65d31da0a6b535ec0ca9c3b84..6d193118b5447b57a5bc32dbcfba012745f37d2d 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 1878808f3f6701f77b7e75c0623a7ae3085030d8..4fa679645f127c7dbcae4bff0921dbaddf976bf2 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 0dc03bf4026dbcbacb55cf9e516c325d1b609381..36fd085da60932f7acaebc3edf065dad2949b1f4 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 7f085978a0f9a31c4157c029c18f805448efdd2c..ec2b665b2fc0ae912ed3533b7727153ba7041394 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 f1050b9df3a890f2e158da8f869d23cefd69427d..4fcdc1298cc9f3ea51c044729d4dc9827f2a3389 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 9a42e93d2ef972d5659077bff12055b56069544a..12f48e37776d323511a4ba47eaa46551e58078cd 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 a62b243eb723c7a874b2a5e89a4049ef0084d5fc..a3a8b7aafa3e7d673d1bc95e9c7f6204151ae96c 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 9847dfb8c23c7e978cfe8731f8cf6d7cb13106c0..00d863907e3da387e3ba1caaadc424ad03d7afa2 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 b9e4bce94d79ef71a910fd7132df6885005ae571..ff9a9f6ff7632f2a1ee3f2626f163e9da1a3000f 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 0578b42701a18c0275eb1885bac1f0d422db0f85..016c944d80986110db5ee418a45993b4f5742c62 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 c4ca3e74db1c6f6a98709dc72ee5db1da3683f27..ce34496810a2356b04b593bfd43dfc5c4bf1f6a8 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 08d9d21cdd80ee98dc416582f7c7879abb4e5e74..c1a1fd47a6949bdc67376285f1fcc0aa611a4187 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 ebd98f8c1f551c23c60da6ae0f6b25ab5ce1b465..02aa783cb1ab0c0e239332fb1edb8288594da935 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 591595eaa5ed019731b352a724d2c6ab49ed10a5..637e837284cbaa8910d916e39bfd856b7431930f 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 4000253e1dd0da6f9e21d4f33e6df49ccd091bae..776abdce40a79db7fe7801e9d76bf8cc6345f012 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 a40bac9b054a9e34490b181b838be4a1ef71643d..e255757dc188cbaa87bffe0971965b6ee2a1176b 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 cad98b30f4edd9a3f2689fd43bfa0a6127316103..61153266329ec4325ea8a899ae64410c0447ca18 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 51cef4d3ea9e834d8beca9b8bcaa7ddbe2cb01d6..b682766f75d4a693fdfe8b8bd0f17766533b354c 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 e69aa8611af7f7aff96b543159a48b85b74e87c2..f46113fb9a4d1db5eb0f132b6256d96c894715f3 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 ada8a17532a60d879332012bbcffd0d1f0eacbdf..1a2c6b7b22f20cea8e3d309cde933ba45e7a588e 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 e5bb549492708dd8542d909fdae21267c247246a..54f7946db5dbf9fa5e88a554adc3598bc1a47420 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 a4fcdbbf8e97e40fc1db1672e6cba0ba728c43c7..50cccc796fa9def277081e0c6efef26c8bf08719 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 71fcd58400cb64095579596e9d249ced694eef46..cfbd95a39e8d22256c5474cdb4f409c6cba2b2d4 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 9871a04f42ca0c243182a2150ad822583328c4e8..97042f2c7db67d19840b1b556ee3c1bccf5c3abc 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 fd1e37a98f795300444132f85ebecab30e2b988e..92184f40487e8405da45e57e9e24f66c0cb44790 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 2642e560224c4697c93461c5a91bbc9cd422572e..816f9c6ca0c038e7cd5d11e75f30f92153cd3b9e 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 c03c226978f054b4ff3df9cd98b9b291ed4bc9af..628baeebab71e4b97bdfd09fdc73a81d91a12d1d 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 7d48ad17ed6df2760f762359d40607dac82d47b1..7f6253ea46b0deda09af34570ca81f4a17348a85 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 cf96e2630da0feb1573aba911dbee9247b105ee1..6554c6fed513b6b921c69358506f565668e8096e 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 49742d83414276d254794c1ddb4aefefcc8b0540..88820bd1f53e7d5e06a7fb6cec1d759904c25c6c 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 11ec59578c882daa2f86c7361dad5a18628acb07..71a731addea1ad17ee275fc8056b793fb894c7ec 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 1dbb86bb2f073de2e0d17223870dbe57cfcdfa51..1e873b4bdfc350b43d3a7b582523f98de9bfda3a 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 f31054905e3089281bd614b913ad9f7c53a5bb9c..3f56f080600099bae49d3122e9ed8194ef091faa 100644 (file)
@@ -47,5 +47,6 @@ public abstract class AbstractEnvelopeTest<E extends Envelope<?>> {
 
     protected abstract E createEnvelope();
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected abstract void doAdditionalAssertions(E envelope, E resolvedObject);
 }
index 6a3ba276fbe2ac58d4df2ad0ac7b621dd8fe0122..acf876b6ce6eb3f85b9c7a2753f254aae878ddbf 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 e31fc559175fdc3df27df5f79ed05d73f995fb67..92d310dddc0f3f5ace75bb2573d3ae70c1d40df0 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 513253e669b4d27975b70ea709d9b89dc7ba8513..598b598db8876b5b8fb71491181a751a96a718a8 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 7f40dc1b37d82c6a3b6e646d493450a7cba1307d..94948767aeb98246d0663b8dd3e472dfa960dc0b 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 5f53dcc1d8969f121a394a23bf3778d3bda4a6bd..d6b10396313ef4f13eb203f71870933ca50710a1 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 8bd0cf3d34f4639a1e053cc6c17158e469a4422f..25710880dd8ab0c5c7b03e31f8d1fa6fd048f5d5 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 203a61233d3df2d8c95da39701f746e31e5df1a4..89b454425ea56a935ccc1c15dd9fb4add95b4cbe 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 56cda0307c8e35005b519fdaedfca62873ac6f3f..5f7d08c08b0af75df0dc84210f3ae5fcb99fdaa5 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 d494c8828398b95f434a61394ca51ec56a7dbca7..64794ca05432d3a485f9ba51c444bb8c4bfce235 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 fd6eb17384448bbef1b0885fd0b99d7b4997f0d1..be38c17f4e2cd4e1efcf47dd08ea4f69e242032a 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 2296eabe27a9ed818031af09360130a9815511e2..19d796c9363aa928e7f287e218807093fa93f2a3 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 0014a6fce716f988a2f96ffe22b3e0ffc5ee6d2b..3f030d0ff05bc61f5af07a1a4e9b962d81864fae 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 7196fc5f12d82013c58f80248d82342d0f88aecb..764bce1ddb97aa4af14620736a5e286d64d1a87a 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 7ff47f93d93e0ede5a1e47608aa80be57410f099..dd9445e749d3526c3484121232fec7e274b71194 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 cc20cf677a213c0b7bf21863ead7ab898a4f2886..4ac17053bce417a9241981df409817d2aa400114 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 a40e75f4c3b2e5629cf2904891a61c7819ee12c9..dc9cb23facac0aaab31b463105db136de7ea31a2 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 a1083ebdf78964bcbb8f143d33480477204272ab..56ec83ee0a92f589c3d1ddf2e2546dc0ca6604fd 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 40c90fbe94dfff91f0e8468ffe03fc0d6390469c..aee90ace41e9907d2823ac842ebc96cea8e77b30 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 aa3500e33a1789ed10ade94f8a3cbc59a23836f7..42a4a8de810bd5a2b4d04d872b2e00620ff9bd07 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 9d275e7f310bc0e3d18c74b7574595aaf99a86e5..ef4151d03ed8227fc43afb4c2857c337904a6aec 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 108156d951c152c1b31bbea6624293e484b14546..28cc9b3f81e9226e2baf5e7ecd4422d9e20413ee 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 27fc7c09741bd790d5410d73af3fc4599642b098..1212274ddcf5517351ec300b3379aecb55bf33ad 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 7ad5812f64250ccbe25a95d25e5e824d264b966f..5317ec4d34fb74b1921fe4ea4367a05bbde758b0 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 42411a95c4c28f6bc48ef1d965d3535e6136773f..b32b4f47285dd6973157c37d88adb6099f7a8675 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 699a5e3daf95a2ccabff8e2f3e5b6195578329be..4c3ad09d5172a6b7fe0203cc8ea193ee2da2c11f 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 2dc31145ec95a7143a5b0ac2693f4f24cca898b5..aaa9ad6c81a57d917ed2db687be9880740bbf067 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 45e3a8e828fef4ba58c321b8437902e9aaaa5b55..87f0e9890ecbc71fdad7e4549899e04e28e2fd12 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 dc80c330fd453a19f023c3c31ec8f843eca68a8b..bfcfdede850bdd3a273e72d7c8865e164b3a5040 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 fd08a95a34c5d6114323423f07f76806f910fd24..5f75e495af5b7db6f7f4ab4da2fab5cf3ee3d19a 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 630a5545905ce231b97ff1d842abbe304fd151df..6bae647cb7a43a1ef000961b48333104f7f6857a 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 cc64c321f5283da62b96a5453045d0f5cc378420..e815187d596223ed0dbc8b449a94724e7d39efce 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 043aa467c07c86ef8a7f73f192d9b7511a9f88b9..7f91c1bc8573dbfc27fa701dea5c5314921ce693 100644 (file)
@@ -77,7 +77,7 @@ public class MeteredBoundedMailboxTest {
 
         ReentrantLock lock;
 
-        private PingPongActor(final ReentrantLock lock) {
+        PingPongActor(final ReentrantLock lock) {
             this.lock = lock;
         }
 
index 770a2ffb3e9b9d20d9ec5daa03a7b45ff471db89..22d4d20dc7e3d3a2995f8f0dc3b93c9ee9a9f72e 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 5ff1f38e838d297488b4f42b88205bd45fd6a220..c4738998f35c60b56cf4ebfe7aa9c28a9788c69f 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 b7bce6dc33dc651648d4b379c69dc9a9b036a184..92071180eb7bec605b5ec7e8d8748b7da0b08be8 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 0ce4df0f134f0a95191cd582e94f102397d8c238..9b5942c6283c2a0944a338589ded1220b741aa5e 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 efa503a90c0f3a8c909222a0c13d624a50111ba3..02ccde264ecfbd40eb6beae51386e61fa4a0163d 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 61b45ed79f7c6974a45d0d01e7803a65f0192836..ad105c31f2f194ff610bac75ff8c3d432324b853 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 2c0be57bc1be9c2ba6831ff05c5c2ebfe3065364..33cf8e9c1d292ca46f47cfb3efd9497ed38a63cc 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 dee8142bbc0904e6666784143d8f1cb795f27baa..8be23d1994fa99b4cbbed31cd1316eb94e817976 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 e29de0f13f976840b0f90f1cb540bda08351eb76..db9acaebcdd3e39316d0cc67abd456f68fc922ea 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 a2a2bfca0850e746e045f561d1db0d6f5635732c..53d2730f86120ae7040f912425807bd73bd85458 100644 (file)
@@ -84,7 +84,7 @@ class DebugThreePhaseCommitCohort extends AbstractThreePhaseCommitCohort<Object>
     }
 
     @VisibleForTesting
-    void setLogger(final Logger log) {
-        this.log = log;
+    void setLogger(final Logger logger) {
+        this.log = logger;
     }
 }
index 2f82ac5d6415bf93f57cb771c387926e7189dea2..0846590c1e1cd912320b2d5b13bc5399bf43f964 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 22ba497801f3e960a2524c41556a98af700fd6ac..c1162c2d9385f0b40e644adbf09cfba1a83c07a2 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 402bf4822b01a1f56a12ebfcbf1a2296c24d4fb2..3719f749df6bce26cbe469250284ffd834bba8a0 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 ef40480e4d86fbf7fd15d70e613fedaaaaff3ee6..b7d77f88a01b83b7751450603d4ac6a19f7f4851 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 61a3fa13be6415c27e839580df9e2eac1d58258a..72d0ee8a88def253defa7aa6ccb69c164ef480c5 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 455c874229f3c1c86fd6c3fcfc5609a6c81a91bb..d8c49a9e744807e5089da752f02abe69e13892c7 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 353c80ce45b7d7376746bea2bb1ed453cf375ffb..5b4e2ffe702a8a538d8d5876712cbb3dae5a2948 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 beee118a51b301f3be469a799ffc0fae78298dc0..944d14a3d91b1c9441f6569689d1e43bb1f2e415 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 fbffd5b11a207a0e8906f08b30bd257a470ffe58..42779b06edad91297622edc5b58744795ea49cd1 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 84a58d95943bcd3405db83b5199c08a1acfc0d5b..ee786e7fc0fda3a7800078225a0f390b29288d33 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 19992961239e058b39abe01b361a14af80c8ae3f..a5ffc49a0eb6d5341a374a3b1e7b91733c4ed301 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 e8824fbe11b1378774b644310d3878414b17d5a5..956fa36d102e0af0437d8a35286a2bb3f2ace891 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 230da28e9a660a12894fc81de27fe04b89c0f212..ba00d0b7a5acee32b0c4db1e9b58e764e8d4bfa7 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 8b46987bb3e615b4bc9275356488b01e76276722..bdf125e7d45b84e41bffe47a80a84d689074de05 100644 (file)
@@ -15,7 +15,7 @@ import org.opendaylight.controller.cluster.datastore.Shard;
  *
  * @author Basheeruddin syedbahm@cisco.com
  */
-public class ShardMBeanFactory {
+public final class ShardMBeanFactory {
 
     private ShardMBeanFactory() {
     }
index 4f90c32635dbe27debfb3fa7b21b51b7ff6d18e0..c70f37ba34c499b943a46514a95807620666f3d8 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 0d63b6bc6d354cf3c5c3b27462e2f19f5d13794d..654bd73c0881273ac16f249fed49fcfda4af2760 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 fde42f86488e06c307d186c9f6a469fe452cb99d..4f74bda43e5dfd9f9e4306e7511f90de811e57da 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 ced960db5cd203195960a192a07af2aa6d553145..b59132fe874471eb7689459788849368ef31190a 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 4692236532d4829f9a7e19d9ac9ca3abda334ff0..b0ad960cb84af19642cdd8571ee48ba6b5fbe684 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 4dd409e85e1d0624df16df2c5519df7241fe24ce..eb6ebb3d6220164290b24c8dbbe7d4d6e58869f6 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 8fc77acf96395f58cfe1d919a1fd3e8a598eba38..b2ac96e1641e81d9a7dd3430601840db2bdb0c4d 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() {
index c474cf89fc8ee6cf8f35f91b43189a13d332824c..c767eb208f8b04efb56c9050f490a5327752a57e 100644 (file)
@@ -34,14 +34,14 @@ import scala.concurrent.duration.Duration;
  *
  * @author Thomas Pantelis
  */
-class ShardManagerGetSnapshotReplyActor extends UntypedActor {
+final class ShardManagerGetSnapshotReplyActor extends UntypedActor {
     private static final Logger LOG = LoggerFactory.getLogger(ShardManagerGetSnapshotReplyActor.class);
 
     private final Set<String> remainingShardNames;
     private final Params params;
     private final List<ShardSnapshot> shardSnapshots = new ArrayList<>();
 
-    private ShardManagerGetSnapshotReplyActor(Params params) {
+    private ShardManagerGetSnapshotReplyActor(final Params params) {
         this.params = params;
         remainingShardNames = new HashSet<>(params.shardNames);
 
@@ -51,7 +51,7 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor {
     }
 
     @Override
-    public void onReceive(Object message) {
+    public void onReceive(final Object message) {
         if (message instanceof GetSnapshotReply) {
             onGetSnapshotReply((GetSnapshotReply)message);
         } else if (message instanceof Failure) {
@@ -70,7 +70,7 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor {
         }
     }
 
-    private void onGetSnapshotReply(GetSnapshotReply getSnapshotReply) {
+    private void onGetSnapshotReply(final GetSnapshotReply getSnapshotReply) {
         LOG.debug("{}: Received {}", params.id, getSnapshotReply);
 
         ShardIdentifier shardId = ShardIdentifier.fromShardIdString(getSnapshotReply.getId());
@@ -87,8 +87,9 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor {
         }
     }
 
-    public static Props props(Collection<String> shardNames, String datastoreType,
-            ShardManagerSnapshot shardManagerSnapshot, ActorRef replyToActor, String id, Duration receiveTimeout) {
+    public static Props props(final Collection<String> shardNames, final String datastoreType,
+            final ShardManagerSnapshot shardManagerSnapshot, final ActorRef replyToActor, final String id,
+            final Duration receiveTimeout) {
         return Props.create(ShardManagerGetSnapshotReplyActor.class, new Params(shardNames, datastoreType,
                 shardManagerSnapshot, replyToActor, id, receiveTimeout));
     }
@@ -101,8 +102,9 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor {
         final String id;
         final Duration receiveTimeout;
 
-        Params(Collection<String> shardNames, String datastoreType, ShardManagerSnapshot shardManagerSnapshot,
-                ActorRef replyToActor, String id, Duration receiveTimeout) {
+        Params(final Collection<String> shardNames, final String datastoreType,
+                final ShardManagerSnapshot shardManagerSnapshot, final ActorRef replyToActor, final String id,
+                final Duration receiveTimeout) {
             this.shardNames = shardNames;
             this.datastoreType = datastoreType;
             this.shardManagerSnapshot = shardManagerSnapshot;
index a8774300348d68487cdccd136ebb5e04e22dd047..dea8320d0a020a634bd6f8937035efe92a37445a 100644 (file)
@@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Utils for encoding prefix shard name.
  */
-public class ClusterUtils {
+public final class ClusterUtils {
     private static final Logger LOG = LoggerFactory.getLogger(ClusterUtils.class);
 
     // id for the shard used to store prefix configuration
index cdbad0b29df657e3871b93de8be18b19978ea702..09b497fe6a5a8a42ea96636fdac2d7917b05ea49 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
 import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-public class NormalizedNodeAggregator {
+public final class NormalizedNodeAggregator {
     private final YangInstanceIdentifier rootIdentifier;
     private final List<Optional<NormalizedNode<?, ?>>> nodes;
     private final DataTree dataTree;
index 57e75136c77ce2025bfd8d02667c048eceac27f9..f91dc3b2600dd09a5ed815b4d7a24f391d527404 100644 (file)
@@ -178,7 +178,7 @@ public class DistributedShardChangePublisher
         return listenerPathArgs;
     }
 
-    private static class ProxyRegistration implements ListenerRegistration<DOMDataTreeChangeListener> {
+    private static final class ProxyRegistration implements ListenerRegistration<DOMDataTreeChangeListener> {
 
         private final ListenerRegistration<org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener> proxy;
         private final DOMDataTreeChangeListener listener;
@@ -349,6 +349,7 @@ public class DistributedShardChangePublisher
 
         @Nullable
         @Override
+        @SuppressWarnings("checkstyle:hiddenField")
         public DataTreeCandidateNode getModifiedChild(final PathArgument identifier) {
             return null;
         }
index 53893e22510607f353ed46fda99dafc79fcbd584..1b2d99388370e196d0e501b6714a29f57e14469d 100644 (file)
@@ -655,6 +655,7 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
 
         @Nonnull
         @Override
+        @SuppressWarnings("checkstyle:hiddenField")
         public DOMDataTreeProducer createProducer(@Nonnull final Collection<DOMDataTreeIdentifier> subtrees) {
             // TODO we probably don't need to distribute this on the remote nodes since once we have this producer
             // open we surely have the rights to all the subtrees.
index ca33e31a87f3d5e882709ffa8b860e0557a7b9c6..232983e4e8c36f2a3397a693b0158e61c8f08222 100644 (file)
@@ -23,7 +23,7 @@ import javax.annotation.concurrent.NotThreadSafe;
 abstract class LookupTask implements Runnable {
     private final int maxRetries;
     private final ActorRef replyTo;
-    private int retries = 0;
+    private int retried = 0;
 
     LookupTask(final ActorRef replyTo, final int maxRetries) {
         this.replyTo = replyTo;
@@ -33,9 +33,9 @@ abstract class LookupTask implements Runnable {
     abstract void reschedule(int retries);
 
     void tryReschedule(@Nullable final Throwable throwable) {
-        if (retries <= maxRetries) {
-            retries++;
-            reschedule(retries);
+        if (retried <= maxRetries) {
+            retried++;
+            reschedule(retried);
         } else {
             fail(throwable);
         }
index 38b69e720aeadf4597b8fbe7dfb1571bd792505a..3307089a45971f6e4879087ff27eb081597af2f2 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.controller.cluster.notifications.RoleChangeNotification;
  * {@link LeaderLocationListener#onLeaderLocationChanged(LeaderLocation)}
  * events.
  */
-public class RoleChangeListenerActor extends AbstractUntypedActor {
+public final class RoleChangeListenerActor extends AbstractUntypedActor {
     private final LeaderLocationListener leaderLocationListener;
     private final ActorRef roleChangeNotifier;
 
index 3efbbabeb8fb1a6335995bf236d86098f29093be..d0df84893d2d7f75ff91d49a5bd0cb4eec13fddc 100644 (file)
@@ -776,8 +776,8 @@ public class ShardedDataTreeActor extends AbstractUntypedPersistentActor {
             return this;
         }
 
-        public ShardedDataTreeActorCreator setClusterWrapper(final ClusterWrapper cluster) {
-            this.cluster = cluster;
+        public ShardedDataTreeActorCreator setClusterWrapper(final ClusterWrapper clusterWrapper) {
+            this.cluster = clusterWrapper;
             return this;
         }
 
@@ -805,8 +805,8 @@ public class ShardedDataTreeActor extends AbstractUntypedPersistentActor {
             return this;
         }
 
-        public ShardedDataTreeActorCreator setLookupTaskMaxRetries(final int maxRetries) {
-            this.maxRetries = maxRetries;
+        public ShardedDataTreeActorCreator setLookupTaskMaxRetries(final int newMaxRetries) {
+            this.maxRetries = newMaxRetries;
             return this;
         }
 
index bec9765552f583dce1eb8d502adb19d0140d18a2..fbdf3f8a4d075c127ef1d68b3e3efc92421fe7e1 100644 (file)
@@ -12,7 +12,7 @@ package org.opendaylight.controller.cluster.sharding.messages;
  * Message sent to the local ShardManager, once the shard configuration shard is ready and the ShardManager should
  * start its listener.
  */
-public class InitConfigListener {
+public final class InitConfigListener {
 
     public static final InitConfigListener INSTANCE = new InitConfigListener();
 
index 1357e555bb167b02de6063646d949adcb471cec6..0eac56f61cb99592158ae4364350bbbfeada96ed 100644 (file)
@@ -11,10 +11,14 @@ import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader;
 
-public class AkkaConfigFactory {
+public final class AkkaConfigFactory {
 
     private static final String CONFIGURATION_NAME = "odl-cluster-data";
 
+    private AkkaConfigFactory() {
+
+    }
+
     public static Config createAkkaConfig(final AkkaConfigurationReader reader) {
         return ConfigFactory.load(reader.read()).getConfig(CONFIGURATION_NAME);
     }
index d47b47bb60dcd2dd7888e027382b5b688d14c92a..f01e85d53133f57db80fa8918d412397b9ab533f 100644 (file)
@@ -12,7 +12,11 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import org.osgi.framework.BundleContext;
 
-public class BundleClassLoaderFactory {
+public final class BundleClassLoaderFactory {
+
+    private BundleClassLoaderFactory() {
+
+    }
 
     public static ClassLoader createClassLoader(final BundleContext bundleContext) {
         return AccessController
index 3917c5ee5a86c8031d12b0e43c3123d66d9c6eee..50a7647754b85130fe2b03ba1974ce5761dd9416 100644 (file)
@@ -13,9 +13,13 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class QuarantinedMonitorActorPropsFactory {
+public final class QuarantinedMonitorActorPropsFactory {
     private static final Logger LOG = LoggerFactory.getLogger(QuarantinedMonitorActorPropsFactory.class);
 
+    private QuarantinedMonitorActorPropsFactory() {
+
+    }
+
     public static Props createProps(final BundleContext bundleContext) {
         return QuarantinedMonitorActor.props(() -> {
             // restart the entire karaf container
index 9cbf3b5a314980de4feee70ce185542c02c636db..9044728ef6adf896745c3ccccd325f94f9483d1d 100644 (file)
@@ -490,6 +490,7 @@ public class ConcurrentDOMDataBrokerTest {
                 LogicalDatastoreType.OPERATIONAL, operationalDomStore, LogicalDatastoreType.CONFIGURATION,
                 configDomStore), futureExecutor) {
             @Override
+            @SuppressWarnings("checkstyle:hiddenField")
             public CheckedFuture<Void, TransactionCommitFailedException> submit(DOMDataWriteTransaction transaction,
                     Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
                 commitCohorts.addAll(cohorts);
index ade447eed8776e4c2c04927d7651be5bbe50000b..5e30b0464bf9d13bd0d862e98fd8347f047f9f50 100644 (file)
@@ -94,6 +94,7 @@ public abstract class AbstractClientHandleTest<T extends AbstractClientHandle<Ab
         handle = createHandle(parent);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected abstract T createHandle(AbstractClientHistory parent);
 
     /**
@@ -102,6 +103,7 @@ public abstract class AbstractClientHandleTest<T extends AbstractClientHandle<Ab
      *
      * @param handle handle
      */
+    @SuppressWarnings("checkstyle:hiddenField")
     protected abstract void doHandleOperation(T handle);
 
     @After
index 618933e0685cee1fc5a7830aaae4ab5e8f3bef54..1961792a96961b6279fceae91748a92811639b2c 100644 (file)
@@ -59,6 +59,7 @@ public abstract class AbstractDataStoreClientBehaviorTest {
         behavior = createBehavior(clientContext, context);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected abstract AbstractDataStoreClientBehavior createBehavior(ClientActorContext clientContext,
                                                                       ActorContext context);
 
@@ -171,4 +172,4 @@ public abstract class AbstractDataStoreClientBehaviorTest {
         return mock;
     }
 
-}
\ No newline at end of file
+}
index 0f51c8e9576123639c7a3608fdf9dd7da4bd9568..fc111171481abf37386e76e79632c3c1775dff48 100644 (file)
@@ -113,6 +113,7 @@ public abstract class AbstractProxyTransactionTest<T extends AbstractProxyTransa
         tester = new TransactionTester<>(transaction, connection, backendProbe);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected abstract T createTransaction(ProxyHistory parent, TransactionIdentifier id, DataTreeSnapshot snapshot);
 
     @After
@@ -226,6 +227,7 @@ public abstract class AbstractProxyTransactionTest<T extends AbstractProxyTransa
         Assert.assertThat(modifications, hasItem(both(isA(TransactionDelete.class)).and(hasPath(PATH_3))));
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected <R extends TransactionRequest<R>> void testRequestResponse(final Consumer<VotingFuture<Void>> consumer,
             final Class<R> expectedRequest,
             final BiFunction<TransactionIdentifier, Long, TransactionSuccess<?>> replySupplier) throws Exception {
@@ -291,6 +293,7 @@ public abstract class AbstractProxyTransactionTest<T extends AbstractProxyTransa
         return new TestProbe(system);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected TransactionTester<LocalReadWriteProxyTransaction> createLocalProxy() {
         final TestProbe backendProbe = new TestProbe(system, "backend2");
         final TestProbe clientContextProbe = new TestProbe(system, "clientContext2");
@@ -309,6 +312,7 @@ public abstract class AbstractProxyTransactionTest<T extends AbstractProxyTransa
         return new TransactionTester<>(tx, connection, backendProbe);
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     protected TransactionTester<RemoteProxyTransaction> createRemoteProxyTransactionTester() {
         final TestProbe clientContextProbe = new TestProbe(system, "remoteClientContext");
         final TestProbe backendProbe = new TestProbe(system, "remoteBackend");
index 8aadd86ddbb41ce4c08958e7276473540dc4828f..158b408c874724e578ca2743bbd13300221a1629 100644 (file)
@@ -105,15 +105,15 @@ public class ClientLocalHistoryTest extends AbstractClientHistoryTest<ClientLoca
     @Override
     @Test
     public void testOnTransactionComplete() throws Exception {
-        final ClientTransaction transaction = object().createTransaction();
+        final ClientTransaction tx = object().createTransaction();
 
         // make transaction ready
-        object().onTransactionReady(transaction, cohort);
+        object().onTransactionReady(tx, cohort);
         // state should be set to IDLE
         Assert.assertEquals(AbstractClientHistory.State.IDLE, object.state());
 
         // complete transaction
-        object().onTransactionComplete(transaction.getIdentifier());
+        object().onTransactionComplete(tx.getIdentifier());
         // state is still IDLE
         Assert.assertEquals(AbstractClientHistory.State.IDLE, object.state());
     }
@@ -129,9 +129,9 @@ public class ClientLocalHistoryTest extends AbstractClientHistoryTest<ClientLoca
     @Override
     @Test(expected = IllegalStateException.class)
     public void testOnTransactionReadyDuplicate() throws Exception {
-        final ClientTransaction transaction = object().createTransaction();
-        object().onTransactionReady(transaction, cohort);
-        object().onTransactionReady(transaction, cohort);
+        final ClientTransaction tx = object().createTransaction();
+        object().onTransactionReady(tx, cohort);
+        object().onTransactionReady(tx, cohort);
     }
 
     @Test
@@ -154,4 +154,4 @@ public class ClientLocalHistoryTest extends AbstractClientHistoryTest<ClientLoca
     public void testOnTransactionReadyAndCompleteIdleFail() throws Exception {
         object().onTransactionReady(transaction, cohort);
     }
-}
\ No newline at end of file
+}
index c3dfebd6be3832b8d77b62692e1b14559c07d202..ba38cfe11d8f03170d5e2851af04c39de534c15e 100644 (file)
@@ -26,6 +26,7 @@ public class LocalReadOnlyProxyTransactionTest extends LocalProxyTransactionTest
     private DataTreeSnapshot snapshot;
 
     @Override
+    @SuppressWarnings("checkstyle:hiddenField")
     protected LocalReadOnlyProxyTransaction createTransaction(final ProxyHistory parent,
                                                               final TransactionIdentifier id,
                                                               final DataTreeSnapshot snapshot) {
@@ -130,4 +131,4 @@ public class LocalReadOnlyProxyTransactionTest extends LocalProxyTransactionTest
         assertOperationThrowsException(() -> transaction.replayModifyTransactionRequest(request, createCallbackMock(),
             Ticker.systemTicker().read()), VerifyException.class);
     }
-}
\ No newline at end of file
+}
index 977ada54e63f7e47640d5a98e7d08b19676efb57..092d262ae8fe034ccc83d073a4b585a961a3713f 100644 (file)
@@ -17,7 +17,11 @@ import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifie
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 
-class TestUtils {
+final class TestUtils {
+    @FunctionalInterface
+    public interface RunnableWithException {
+        void run() throws Exception;
+    }
 
     static final MemberName MEMBER_NAME = MemberName.forName("member-1");
     static final FrontendType FRONTEND_TYPE = FrontendType.forName("type-1");
@@ -26,13 +30,12 @@ class TestUtils {
     static final LocalHistoryIdentifier HISTORY_ID = new LocalHistoryIdentifier(CLIENT_ID, 0L);
     static final TransactionIdentifier TRANSACTION_ID = new TransactionIdentifier(HISTORY_ID, 0L);
 
-    @FunctionalInterface
-    public interface RunnableWithException {
-        void run() throws Exception;
-    }
-
     private static final long TIMEOUT = 3;
 
+    private TestUtils() {
+
+    }
+
     /**
      * Asserts, that future result when it completes is equal to given object.
      * Future must complete in {@link TestUtils#TIMEOUT} seconds.
index c0ce5391448813748628d97e741a45877c4c0a66..e52012b459e44035e12f0f1fba1f9367991d5e02 100644 (file)
@@ -84,7 +84,7 @@ class TransactionTester<T extends AbstractProxyTransaction> {
     private static class MockFailure extends RequestFailure<TransactionIdentifier, TransactionFailure> {
         private static final long serialVersionUID = 1L;
 
-        private MockFailure(@Nonnull final TransactionIdentifier target, final long sequence,
+        MockFailure(@Nonnull final TransactionIdentifier target, final long sequence,
                             @Nonnull final RequestException cause) {
             super(target, sequence, cause);
         }
index 322e15b3caa95e927861dc82b6498525675a13b2..894e7df91cdf8b884df0b7f810bdf1f15ae8aee6 100644 (file)
@@ -386,6 +386,7 @@ public abstract class AbstractTransactionProxyTest extends AbstractTest {
                 shardName);
     }
 
+    @SuppressWarnings("checkstyle:avoidHidingCauseException")
     protected void propagateReadFailedExceptionCause(final CheckedFuture<?, ReadFailedException> future)
             throws Exception {
         try {
index 88d1b8061fd5b6db146a3d3e56c4ff9658e03bbb..4659b1603539cd6f29fbded47c02e2d34eaf5a28 100644 (file)
@@ -94,6 +94,7 @@ public class DatastoreContextContextPropertiesUpdaterTest {
         private DatastoreContextFactory contextFactory;
 
         @Override
+        @SuppressWarnings("checkstyle:hiddenField")
         public void onDatastoreContextUpdated(final DatastoreContextFactory contextFactory) {
             this.contextFactory = contextFactory;
         }
index ae07ffdeda3b2d338173176d6d6f36e734d1b98c..6b7509e7fa012e67f3ac951b80053ad764cfef9d 100644 (file)
@@ -15,6 +15,10 @@ import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 
 public final class MockIdentifiers {
+    private MockIdentifiers() {
+
+    }
+
     public static ClientIdentifier clientIdentifier(final Class<?> clazz, final String memberName) {
         return ClientIdentifier.create(FrontendIdentifier.create(MemberName.forName(memberName),
             FrontendType.forName(clazz.getSimpleName())), 0);
index dadd3a99f7f8d0def3b7025d0206c3098d4cb907..ba7295bcea75a7a3b4f9806549065211a0290f13 100644 (file)
@@ -260,8 +260,8 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
         verifyCohortActors();
     }
 
+    @SuppressWarnings("checkstyle:avoidHidingCauseException")
     private void propagateExecutionExceptionCause(final ListenableFuture<?> future) throws Exception {
-
         try {
             future.get(5, TimeUnit.SECONDS);
             fail("Expected ExecutionException");
@@ -315,7 +315,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
         private final AtomicInteger abortCount = new AtomicInteger();
         private volatile AssertionError assertionError;
 
-        private CohortActor(final Builder builder) {
+        CohortActor(final Builder builder) {
             this.builder = builder;
         }
 
index a3cf9aaf65987dfb39e8be343a7962fea743cff7..ee0f91ee27653920f3f9293599647c3c9ace4ed8 100644 (file)
@@ -2092,7 +2092,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
         private CountDownLatch memberReachableReceived = new CountDownLatch(1);
         private volatile MessageInterceptor messageInterceptor;
 
-        private TestShardManager(final Builder builder) {
+        TestShardManager(final Builder builder) {
             super(builder);
             shardActor = builder.shardActor;
             shardActors = builder.shardActors;
index 960e0328d6cab5142d59540df7cbcdafffff49eb..0dc81926904bea2b2e226fe865c399917e366207 100644 (file)
@@ -73,7 +73,7 @@ public class ActorContextTest extends AbstractActorTest {
     private static class TestMessage {
     }
 
-    private static class MockShardManager extends UntypedActor {
+    private static final class MockShardManager extends UntypedActor {
 
         private final boolean found;
         private final ActorRef actorRef;
index fb7431f9748d1afa8dc76c3cfd2a6b7098826682..92c6349ba6ac353d35ebf827b765574d9356e17a 100644 (file)
@@ -11,15 +11,15 @@ package org.opendaylight.controller.cluster.datastore.utils;
 import akka.actor.ActorRef;
 import akka.actor.UntypedActor;
 
-public class ForwardingActor extends UntypedActor {
+public final class ForwardingActor extends UntypedActor {
     private final ActorRef target;
 
-    private ForwardingActor(ActorRef target) {
+    private ForwardingActor(final ActorRef target) {
         this.target = target;
     }
 
     @Override
-    public void onReceive(Object obj) throws Exception {
+    public void onReceive(final Object obj) throws Exception {
         target.forward(obj, context());
     }
 
index 7a8d065b14e0834a8ad0e921d3285b5d2af2fee9..2d345e5ea8b4bf93cb851ccb85d35a9175218f5e 100644 (file)
@@ -72,6 +72,7 @@ public class PruningDataTreeModificationTest {
     private PruningDataTreeModification pruningDataTreeModification;
 
     @Before
+    @SuppressWarnings("checkstyle:avoidHidingCauseException")
     public void setUp() {
         MockitoAnnotations.initMocks(this);
 
index b71095808468428e295cd1a155095b466529dba8..6a346202fb0469b4f0ad76441978ed1e1acebcb6 100644 (file)
@@ -149,10 +149,10 @@ public class DistributedShardFrontendTest {
 
         final DOMDataTreeProducer producer = shardedDOMDataTree.createProducer(Collections.singletonList(ROOT));
         final DOMDataTreeCursorAwareTransaction tx = producer.createTransaction(false);
-        final DOMDataTreeWriteCursor cursor = tx.createCursor(ROOT);
+        final DOMDataTreeWriteCursor txCursor = tx.createCursor(ROOT);
 
-        assertNotNull(cursor);
-        cursor.write(TestModel.TEST_PATH.getLastPathArgument(), createCrossShardContainer());
+        assertNotNull(txCursor);
+        txCursor.write(TestModel.TEST_PATH.getLastPathArgument(), createCrossShardContainer());
 
         //check the lower shard got the correct modification
         verify(outerListCursor, times(2)).write(pathArgumentCaptor.capture(), nodeCaptor.capture());
@@ -171,13 +171,12 @@ public class DistributedShardFrontendTest {
         final MapNode actualInnerListNode = (MapNode) nodeCaptor.getAllValues().get(1);
         assertEquals(createInnerMapNode(1), actualInnerListNode);
 
-        cursor.close();
+        txCursor.close();
         tx.submit().checkedGet();
 
         verify(commitCohort, times(2)).canCommit();
         verify(commitCohort, times(2)).preCommit();
         verify(commitCohort, times(2)).commit();
-
     }
 
     private static MapNode createInnerMapNode(final int id) {
index bd6594007d48cefad6a0b9750c378c4e98d43806..f633804e66be3f1a5c1b6fe1a8c942f202732765 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.md.cluster.datastore.model;
 
 import java.math.BigInteger;
@@ -20,7 +19,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNo
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
 
-public class CarsModel {
+public final class CarsModel {
     public static final QName BASE_QNAME = QName.create(
             "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars", "2014-03-13", "cars");
 
@@ -32,6 +31,10 @@ public class CarsModel {
     public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME);
     public static final YangInstanceIdentifier CAR_LIST_PATH = BASE_PATH.node(CAR_QNAME);
 
+    private CarsModel() {
+
+    }
+
     public static NormalizedNode<?, ?> create() {
 
         // Create a list builder
@@ -68,12 +71,12 @@ public class CarsModel {
         return newCarsNode(newCarsMapNode());
     }
 
-    public static ContainerNode newCarsNode(MapNode carsList) {
+    public static ContainerNode newCarsNode(final MapNode carsList) {
         return ImmutableContainerNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(
                 BASE_QNAME)).withChild(carsList).build();
     }
 
-    public static MapNode newCarsMapNode(MapEntryNode... carEntries) {
+    public static MapNode newCarsMapNode(final MapEntryNode... carEntries) {
         CollectionNodeBuilder<MapEntryNode, MapNode> builder = ImmutableMapNodeBuilder.create()
                 .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CAR_QNAME));
         for (MapEntryNode e : carEntries) {
@@ -93,13 +96,13 @@ public class CarsModel {
         return ImmutableNodes.mapNodeBuilder(CAR_QNAME).build();
     }
 
-    public static MapEntryNode newCarEntry(String name, BigInteger price) {
+    public static MapEntryNode newCarEntry(final String name, final BigInteger price) {
         return ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, name)
                 .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, name))
                 .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, price)).build();
     }
 
-    public static YangInstanceIdentifier newCarPath(String name) {
+    public static YangInstanceIdentifier newCarPath(final String name) {
         return YangInstanceIdentifier.builder(CAR_LIST_PATH).nodeWithKey(CAR_QNAME, CAR_NAME_QNAME, name).build();
     }
 }
index 2b72099798a19d12ee47800e939fd22a241151cd..3047082b4c0e1592839d0466ee0b9fed20f5a3c5 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.md.cluster.datastore.model;
 
 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
@@ -38,7 +37,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 CompositeModel {
+public final class CompositeModel {
 
     public static final QName TEST_QNAME = QName
             .create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13", "test");
@@ -102,22 +101,26 @@ public class CompositeModel {
     private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
     private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
 
-    private static final MapEntryNode BAR_NODE = mapEntryBuilder(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
-            .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
-                    .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
-                    .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
-                    .build()) //
+    private static final MapEntryNode BAR_NODE = mapEntryBuilder(OUTER_LIST_QNAME, ID_QNAME, TWO_ID)
+            .withChild(mapNodeBuilder(INNER_LIST_QNAME)
+                    .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME))
+                    .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME))
+                    .build())
             .build();
 
-    public static final InputStream getDatastoreTestInputStream() {
+    private CompositeModel() {
+
+    }
+
+    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 566ca34034431e7f48eaaf76ee866fe33b762491..33ee0a38afe9a4c2ee186f6bcc35e525e3a2c6ec 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.md.cluster.datastore.model;
 
 import org.opendaylight.yangtools.yang.common.QName;
@@ -18,7 +17,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNo
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
 
-public class PeopleModel {
+public final class PeopleModel {
     public static final QName BASE_QNAME = QName.create(
             "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people", "2014-03-13", "people");
 
@@ -30,6 +29,10 @@ public class PeopleModel {
     public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME);
     public static final YangInstanceIdentifier PERSON_LIST_PATH = BASE_PATH.node(PERSON_QNAME);
 
+    private PeopleModel() {
+
+    }
+
     public static NormalizedNode<?, ?> create() {
 
         // Create a list builder
@@ -73,12 +76,12 @@ public class PeopleModel {
         return ImmutableNodes.mapNodeBuilder(PERSON_QNAME).build();
     }
 
-    public static MapEntryNode newPersonEntry(String name) {
+    public static MapEntryNode newPersonEntry(final String name) {
         return ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, name)
                 .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, name)).build();
     }
 
-    public static YangInstanceIdentifier newPersonPath(String name) {
+    public static YangInstanceIdentifier newPersonPath(final String name) {
         return YangInstanceIdentifier.builder(PERSON_LIST_PATH)
                 .nodeWithKey(PERSON_QNAME, PERSON_NAME_QNAME, name).build();
     }
index ceee437ac3d148623ef84022771fe6d5eff3260b..f2d23e0059ccafa91f5ab469fb1ed306138bf6c8 100644 (file)
@@ -19,12 +19,16 @@ 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 SchemaContextHelper {
+public final class SchemaContextHelper {
 
     public static final String ODL_DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
     public static final String PEOPLE_YANG = "/people.yang";
     public static final String CARS_YANG = "/cars.yang";
 
+    private SchemaContextHelper() {
+
+    }
+
     public static InputStream getInputStream(final String yangFileName) {
         return SchemaContextHelper.class.getResourceAsStream(yangFileName);
     }
index cd8a75454c4298b83148eea0b226c3e9874dcd0d..c75bd04bf46a4d09b9e1942c7db1a102deffef5f 100644 (file)
@@ -26,7 +26,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", "2014-03-13", "test");
@@ -37,7 +37,6 @@ public class TestModel {
     public static final QName JUNK_QNAME =
             QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:junk", "2014-03-13", "junk");
 
-
     public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list");
     public static final QName OUTER_CONTAINER_QNAME = QName.create(TEST_QNAME, "outer-container");
     public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list");
@@ -59,6 +58,10 @@ public class TestModel {
     public static final QName TWO_QNAME = QName.create(TEST_QNAME,"two");
     public static final QName THREE_QNAME = QName.create(TEST_QNAME,"three");
 
+    private TestModel() {
+
+    }
+
     public static SchemaContext createTestContext() {
         final List<InputStream> sources;
 
index 9bb4928a63e57932d4a2a302872f60f030294adc..e3cf76dc8009dba50d36433f188456310746bbe0 100644 (file)
@@ -27,13 +27,13 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 abstract class AbstractDOMRpcRoutingTableEntry {
-    private final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> impls;
+    private final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> implementations;
     private final SchemaPath schemaPath;
 
     AbstractDOMRpcRoutingTableEntry(final SchemaPath schemaPath,
-        final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> impls) {
+        final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> implementations) {
         this.schemaPath = Preconditions.checkNotNull(schemaPath);
-        this.impls = Preconditions.checkNotNull(impls);
+        this.implementations = Preconditions.checkNotNull(implementations);
     }
 
     final SchemaPath getSchemaPath() {
@@ -41,19 +41,20 @@ abstract class AbstractDOMRpcRoutingTableEntry {
     }
 
     final List<DOMRpcImplementation> getImplementations(final YangInstanceIdentifier context) {
-        return impls.get(context);
+        return implementations.get(context);
     }
 
     final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> getImplementations() {
-        return impls;
+        return implementations;
     }
 
     final boolean containsContext(final YangInstanceIdentifier contextReference) {
-        return impls.containsKey(contextReference);
+        return implementations.containsKey(contextReference);
     }
 
     final Set<YangInstanceIdentifier> registeredIdentifiers(final DOMRpcAvailabilityListener listener) {
-        return Maps.filterValues(impls, list -> list.stream().anyMatch(listener::acceptsImplementation)).keySet();
+        return Maps.filterValues(implementations, list -> list.stream().anyMatch(listener::acceptsImplementation))
+                .keySet();
     }
 
     /**
@@ -65,7 +66,7 @@ abstract class AbstractDOMRpcRoutingTableEntry {
     final AbstractDOMRpcRoutingTableEntry add(final DOMRpcImplementation implementation,
             final List<YangInstanceIdentifier> newRpcs) {
         final Builder<YangInstanceIdentifier, List<DOMRpcImplementation>> vb = ImmutableMap.builder();
-        for (final Entry<YangInstanceIdentifier, List<DOMRpcImplementation>> ve : impls.entrySet()) {
+        for (final Entry<YangInstanceIdentifier, List<DOMRpcImplementation>> ve : implementations.entrySet()) {
             if (newRpcs.remove(ve.getKey())) {
                 final List<DOMRpcImplementation> i = new ArrayList<>(ve.getValue().size() + 1);
                 i.addAll(ve.getValue());
@@ -91,7 +92,7 @@ abstract class AbstractDOMRpcRoutingTableEntry {
     final AbstractDOMRpcRoutingTableEntry remove(final DOMRpcImplementation implementation,
             final List<YangInstanceIdentifier> removed) {
         final Builder<YangInstanceIdentifier, List<DOMRpcImplementation>> vb = ImmutableMap.builder();
-        for (final Entry<YangInstanceIdentifier, List<DOMRpcImplementation>> ve : impls.entrySet()) {
+        for (final Entry<YangInstanceIdentifier, List<DOMRpcImplementation>> ve : implementations.entrySet()) {
             if (removed.remove(ve.getKey())) {
                 final List<DOMRpcImplementation> i = new ArrayList<>(ve.getValue());
                 i.remove(implementation);
index 9bf0e2adb64eaf19ca2543e814b6c5655364c381..a1d5faee7ccd113953448db7da8001766c443692 100644 (file)
@@ -34,6 +34,7 @@ final class DOMNotificationRouterEvent {
         // Hidden on purpose, initialized in initialize()
     }
 
+    @SuppressWarnings("checkstyle:hiddenField")
     ListenableFuture<Void> initialize(final DOMNotification notification,
                                       final Collection<ListenerRegistration<? extends DOMNotificationListener>>
                                               subscribers) {
index 692ad99b3c4004d7b5026b6959206fc5803f5ae6..2e1348718e8be9760e02902f8e606479722b2631 100644 (file)
@@ -58,13 +58,13 @@ final class DOMRpcRoutingTable {
         return ret;
     }
 
-    DOMRpcRoutingTable add(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcs) {
-        if (rpcs.isEmpty()) {
+    DOMRpcRoutingTable add(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcsToAdd) {
+        if (rpcsToAdd.isEmpty()) {
             return this;
         }
 
         // First decompose the identifiers to a multimap
-        final ListMultimap<SchemaPath, YangInstanceIdentifier> toAdd = decomposeIdentifiers(rpcs);
+        final ListMultimap<SchemaPath, YangInstanceIdentifier> toAdd = decomposeIdentifiers(rpcsToAdd);
 
         // Now iterate over existing entries, modifying them as appropriate...
         final Builder<SchemaPath, AbstractDOMRpcRoutingTableEntry> mb = ImmutableMap.builder();
@@ -92,13 +92,13 @@ final class DOMRpcRoutingTable {
         return new DOMRpcRoutingTable(mb.build(), schemaContext);
     }
 
-    DOMRpcRoutingTable remove(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcs) {
-        if (rpcs.isEmpty()) {
+    DOMRpcRoutingTable remove(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcIds) {
+        if (rpcIds.isEmpty()) {
             return this;
         }
 
         // First decompose the identifiers to a multimap
-        final ListMultimap<SchemaPath, YangInstanceIdentifier> toRemove = decomposeIdentifiers(rpcs);
+        final ListMultimap<SchemaPath, YangInstanceIdentifier> toRemove = decomposeIdentifiers(rpcIds);
 
         // Now iterate over existing entries, modifying them as appropriate...
         final Builder<SchemaPath, AbstractDOMRpcRoutingTableEntry> b = ImmutableMap.builder();
index cb56f10bf95b0e71b691b85fdaa3f4617097d3fc..5d91a742a34787895032b0e123bf5db29eb169e4 100644 (file)
@@ -35,13 +35,14 @@ import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 public class LegacyEntityOwnershipServiceAdapter implements EntityOwnershipService, AutoCloseable {
     private final DOMEntityOwnershipService domService;
 
-    public LegacyEntityOwnershipServiceAdapter(@Nonnull DOMEntityOwnershipService domService) {
+    public LegacyEntityOwnershipServiceAdapter(@Nonnull final DOMEntityOwnershipService domService) {
         this.domService = Preconditions.checkNotNull(domService);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:avoidHidingCauseException")
     public EntityOwnershipCandidateRegistration registerCandidate(
-            Entity entity) throws CandidateAlreadyRegisteredException {
+            final Entity entity) throws CandidateAlreadyRegisteredException {
         try {
             return new EntityOwnershipCandidateRegistrationAdapter(domService.registerCandidate(toDOMEntity(entity)),
                                                                    entity);
@@ -51,18 +52,19 @@ public class LegacyEntityOwnershipServiceAdapter implements EntityOwnershipServi
     }
 
     @Override
-    public EntityOwnershipListenerRegistration registerListener(String entityType, EntityOwnershipListener listener) {
+    public EntityOwnershipListenerRegistration registerListener(final String entityType,
+            final EntityOwnershipListener listener) {
         return new EntityOwnershipListenerRegistrationAdapter(entityType, listener, domService
                 .registerListener(entityType, new DOMEntityOwnershipListenerAdapter(listener)));
     }
 
     @Override
-    public Optional<EntityOwnershipState> getOwnershipState(Entity forEntity) {
+    public Optional<EntityOwnershipState> getOwnershipState(final Entity forEntity) {
         return toEntityOwnershipState(domService.getOwnershipState(toDOMEntity(forEntity)));
     }
 
     @Override
-    public boolean isCandidateRegistered(Entity entity) {
+    public boolean isCandidateRegistered(final Entity entity) {
         return domService.isCandidateRegistered(toDOMEntity(entity));
     }
 
@@ -70,12 +72,12 @@ public class LegacyEntityOwnershipServiceAdapter implements EntityOwnershipServi
     public void close() {
     }
 
-    private DOMEntity toDOMEntity(Entity from) {
+    private static DOMEntity toDOMEntity(final Entity from) {
         return new DOMEntity(from.getType(), from.getId());
     }
 
-    private Optional<EntityOwnershipState> toEntityOwnershipState(
-            Optional<org.opendaylight.mdsal.eos.common.api.EntityOwnershipState> from) {
+    private static Optional<EntityOwnershipState> toEntityOwnershipState(
+            final Optional<org.opendaylight.mdsal.eos.common.api.EntityOwnershipState> from) {
         if (!from.isPresent()) {
             return Optional.absent();
         }
@@ -90,8 +92,8 @@ public class LegacyEntityOwnershipServiceAdapter implements EntityOwnershipServi
             implements EntityOwnershipCandidateRegistration {
         private final DOMEntityOwnershipCandidateRegistration domRegistration;
 
-        EntityOwnershipCandidateRegistrationAdapter(DOMEntityOwnershipCandidateRegistration domRegistration,
-                                                    Entity entity) {
+        EntityOwnershipCandidateRegistrationAdapter(final DOMEntityOwnershipCandidateRegistration domRegistration,
+                                                    final Entity entity) {
             super(entity);
             this.domRegistration = Preconditions.checkNotNull(domRegistration);
         }
@@ -107,8 +109,8 @@ public class LegacyEntityOwnershipServiceAdapter implements EntityOwnershipServi
         private final String entityType;
         private final DOMEntityOwnershipListenerRegistration domRegistration;
 
-        EntityOwnershipListenerRegistrationAdapter(String entityType, EntityOwnershipListener listener,
-                                                   DOMEntityOwnershipListenerRegistration domRegistration) {
+        EntityOwnershipListenerRegistrationAdapter(final String entityType, final EntityOwnershipListener listener,
+                                                   final DOMEntityOwnershipListenerRegistration domRegistration) {
             super(listener);
             this.entityType = Preconditions.checkNotNull(entityType);
             this.domRegistration = Preconditions.checkNotNull(domRegistration);
@@ -128,12 +130,12 @@ public class LegacyEntityOwnershipServiceAdapter implements EntityOwnershipServi
     private static class DOMEntityOwnershipListenerAdapter implements DOMEntityOwnershipListener {
         private final EntityOwnershipListener delegateListener;
 
-        DOMEntityOwnershipListenerAdapter(EntityOwnershipListener delegateListener) {
+        DOMEntityOwnershipListenerAdapter(final EntityOwnershipListener delegateListener) {
             this.delegateListener = Preconditions.checkNotNull(delegateListener);
         }
 
         @Override
-        public void ownershipChanged(DOMEntityOwnershipChange ownershipChange) {
+        public void ownershipChanged(final DOMEntityOwnershipChange ownershipChange) {
             Entity entity = new Entity(ownershipChange.getEntity().getType(),
                                        ownershipChange.getEntity().getIdentifier());
             delegateListener.ownershipChanged(new EntityOwnershipChange(entity, ownershipChange.getState().wasOwner(),
index e82db12b4d685fb95440fbd1fad4a1115d6711a5..e2baf3ecbf2ae993c907fad8a3f702d263e4fc07 100644 (file)
@@ -203,7 +203,7 @@ public class DOMBrokerTest {
             throw caughtEx.get();
         }
 
-        NormalizedNode<?, ?> actualNode = dcListener.change.getCreatedData().get(TestModel.TEST_PATH);
+        NormalizedNode<?, ?> actualNode = dcListener.capturedChange.getCreatedData().get(TestModel.TEST_PATH);
         assertEquals("Created node", testNode, actualNode);
     }
 
@@ -326,12 +326,12 @@ public class DOMBrokerTest {
 
     static class TestDOMDataChangeListener implements DOMDataChangeListener {
 
-        volatile AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change;
+        volatile AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> capturedChange;
         private final CountDownLatch latch = new CountDownLatch(1);
 
         @Override
         public void onDataChanged(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
-            this.change = change;
+            this.capturedChange = change;
             latch.countDown();
         }
 
index 74e98e447adf8236d79ef9c910bbd891aba3fb32..5a8591330c4c6879456c04dc7576a87fcb7f129f 100644 (file)
@@ -25,7 +25,8 @@ import org.slf4j.LoggerFactory;
 import scala.concurrent.ExecutionContext;
 import scala.concurrent.Future;
 
-class RemoteDOMRpcFuture extends AbstractFuture<DOMRpcResult> implements CheckedFuture<DOMRpcResult, DOMRpcException> {
+final class RemoteDOMRpcFuture extends AbstractFuture<DOMRpcResult>
+        implements CheckedFuture<DOMRpcResult, DOMRpcException> {
 
     private static final Logger LOG = LoggerFactory.getLogger(RemoteDOMRpcFuture.class);
 
index 226faf22dcced063a49fb28a691a0095fc789c6f..cc77e4cb6cd6bccef601a638fca8ca18633d09d3 100644 (file)
@@ -12,7 +12,11 @@ import akka.actor.ActorSystem;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 
-public class RemoteRpcProviderFactory {
+public final class RemoteRpcProviderFactory {
+    private RemoteRpcProviderFactory() {
+
+    }
+
     public static RemoteRpcProvider createInstance(final DOMRpcProviderService rpcProviderService,
             final DOMRpcService rpcService, final ActorSystem actorSystem, final RemoteRpcProviderConfig config) {
 
index 6f0e3b8f796380e9a0fa61704830562dccc4f303..a863166eb4620c5e11dde5ac62a6013ea575c691 100644 (file)
@@ -34,9 +34,8 @@ public class RpcManager extends AbstractUntypedActor {
     private ActorRef rpcRegistry;
     private ActorRef rpcRegistrar;
 
-    private RpcManager(final DOMRpcProviderService rpcProvisionRegistry,
-                       final DOMRpcService rpcServices,
-                       final RemoteRpcProviderConfig config) {
+    RpcManager(final DOMRpcProviderService rpcProvisionRegistry, final DOMRpcService rpcServices,
+            final RemoteRpcProviderConfig config) {
         this.rpcProvisionRegistry = Preconditions.checkNotNull(rpcProvisionRegistry);
         this.rpcServices = Preconditions.checkNotNull(rpcServices);
         this.config = Preconditions.checkNotNull(config);
index 7d647cff8c1c4a5305e2f43b69b665c8c7de7da9..be76674a3ddfd5675123014ceafd4447f47b8e5c 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public class ExecuteRpc implements Serializable {
+public final class ExecuteRpc implements Serializable {
     private static final long serialVersionUID = 1128904894827335676L;
 
     @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
index e5a2a5488313a33f8ba0ee53f28dd65cca0e7f0a..5e9d907aadd18227869cf8bb8dc8c0bc0a6e25cd 100644 (file)
@@ -48,8 +48,8 @@ final class LocalBucket<T extends BucketData<T>> {
         return new BucketImpl<>(version, data);
     }
 
-    boolean setData(final T data) {
-        this.data = Preconditions.checkNotNull(data);
+    boolean setData(final T newData) {
+        this.data = Preconditions.checkNotNull(newData);
         if (!bumpVersion) {
             return false;
         }