Fix modernization issues 32/83832/8
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Aug 2019 19:06:59 +0000 (21:06 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 21 Aug 2019 13:28:57 +0000 (15:28 +0200)
This fixes issues pointed out by Modernizer, which mostly boil
down to using Objects.requireNonNull() and direct java.util
collections.

Change-Id: Id32530a6722cd101f96c23f6a745f91b2f09e2f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
190 files changed:
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintContainerRestartServiceImpl.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/AbstractDependentComponentFactoryMetadata.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/AbstractInvokableServiceMetadata.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/MandatoryServiceReferenceMetadata.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/StaticServiceReferenceRecipe.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ModifyTransactionRequestBuilder.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ReadTransactionSuccess.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/TransactionDataModification.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/TransactionModification.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/ClientIdentifier.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/Envelope.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/FrontendIdentifier.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/LocalHistoryIdentifier.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/MemberName.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/RuntimeRequestException.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/BackendInfo.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ConnectionEntry.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/InitialClientActorContext.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/InversibleLockException.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ReconnectForwarder.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/main/java/org/opendaylight/controller/cluster/access/client/RecoveringClientActorBehavior.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/SavingClientActorBehavior.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/TransmitQueue.java
opendaylight/md-sal/cds-access-client/src/test/java/org/opendaylight/controller/cluster/access/client/MockedSnapshotStore.java
opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceRegistrationImpl.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/RaftActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorDelegatingPersistentDataProvider.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/TimedRunnable.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/EmptyExternalizableProxy.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/SyncStatusTracker.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RemoveServer.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestLeadership.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/ServerRemoved.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntry.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorContextImplTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupportTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/InMemorySnapshotStore.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/AbstractNotificationListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/AggregatedNotificationListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataTreeChangeListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataTreeChangeServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMTransactionChainAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDataTreeChangeListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazyDOMRpcResultFuture.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/RpcServiceAdapter.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.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/datastore/node/utils/NormalizedNodeNavigator.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractNormalizedNodeDataOutput.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/AbortSlicing.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/MessageSlice.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/MessageSliceIdentifier.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/SliceOptions.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/notifications/RoleChangeNotifier.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractShardedTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBroker.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/DOMBrokerTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/DOMStoreThreePhaseCommitCohortAdaptor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHandle.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractTransactionCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/BouncingReconnectForwarder.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientTransactionCursor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/DirectTransactionCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/GetClientRequest.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalProxyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractShardDataTreeTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ChainedCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CohortEntry.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CompositeDataTreeCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DOMDataTreeCandidateTO.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorRegistry.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/ForwardingDataTreeChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendHistoryMetadataBuilder.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendMetadata.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LeaderLocalDelegateFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalFrontendHistory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OperationLimiter.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardRecoveryCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/DataTreeNotificationListenerRegistrationActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ConfigurationImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/PrefixShardConfiguration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipListenerRegistration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnerChangeListener.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/EntityOwnershipShard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShardCommitCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/messages/SelectOwner.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/ShardDataTreeListenerInfoMXBeanImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbstractThreePhaseCommitMessage.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ChangeShardMembersVotingStatus.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataTreeChanged.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataTreeListenerInfo.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FlipShardMembersVotingStatus.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyLocalTransactionSerializer.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterDataTreeNotificationListenerReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractDataTreeCandidateNode.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractIdentifiablePayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/CommitTransactionPayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/FrontendClientMetadata.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ModifiedDataTreeCandidateNode.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/AbstractShardManagerCreator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardInformation.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerInfo.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardPeerAddressResolver.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/UnsignedLongRangeSet.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardModificationFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/PrefixedShardConfigUpdateHandler.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/ShardProxyTransaction.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/ShardingServiceAddressResolver.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/messages/LookupPrefixShard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/messages/NotifyProducerCreated.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/messages/NotifyProducerRemoved.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/messages/PrefixShardRemovalLookup.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospectorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/MemberNode.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTest.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/ActorUtilsTest.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMForwardedCompositeTransaction.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/CommitCoordinationTask.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataBrokerTransactionChainImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedWriteTransaction.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/broker/impl/GlobalDOMRpcRoutingTableEntry.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/SerializedDOMDataBroker.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/LegacyShardedDOMDataBrokerAdapter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingTransactionChain.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingWriteTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/broker/spi/rpc/RpcRoutingStrategy.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/AbstractSnapshotBackedTransactionChain.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/SnapshotBackedReadTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/SnapshotBackedReadWriteTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/SnapshotBackedWriteTransaction.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/ActionRegistry.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/BucketStoreActor.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/GossipEnvelope.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/Gossiper.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/LocalBucket.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImplTest.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PublishNotificationsTask.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/WriteTransactionsHandler.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/YnlListener.java
opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java

index 2b2af15..0e52cb6 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.blueprint;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import java.util.ArrayDeque;
@@ -84,8 +85,8 @@ class BlueprintContainerRestartServiceImpl implements AutoCloseable, BlueprintCo
     }
 
     private void restartContainerAndDependentsInternal(final Bundle forBundle) {
-        Preconditions.checkNotNull(blueprintExtenderService);
-        Preconditions.checkNotNull(quiesceParticipant);
+        requireNonNull(blueprintExtenderService);
+        requireNonNull(quiesceParticipant);
 
         // We use a LinkedHashSet to preserve insertion order as we walk the service usage hierarchy.
         Set<Bundle> containerBundlesSet = new LinkedHashSet<>();
@@ -223,7 +224,7 @@ class BlueprintContainerRestartServiceImpl implements AutoCloseable, BlueprintCo
         }
     }
 
-    private ServiceRegistration<?> registerEventHandler(final BundleContext bundleContext,
+    private static ServiceRegistration<?> registerEventHandler(final BundleContext bundleContext,
             final BlueprintListener listener) {
         return bundleContext.registerService(BlueprintListener.class.getName(), listener, new Hashtable<>());
     }
index c47db3a..07bfd8f 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.blueprint.ext;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -50,7 +51,7 @@ abstract class AbstractDependentComponentFactoryMetadata implements DependentCom
     private boolean stoppedServiceRecipes;
 
     protected AbstractDependentComponentFactoryMetadata(final String id) {
-        this.id = Preconditions.checkNotNull(id);
+        this.id = requireNonNull(id);
     }
 
     @Override
index 10ec16f..873fd00 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.blueprint.ext;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
 import java.util.Set;
@@ -36,7 +37,7 @@ abstract class AbstractInvokableServiceMetadata extends AbstractDependentCompone
 
     AbstractInvokableServiceMetadata(final String id, final String interfaceName) {
         super(id);
-        this.interfaceName = Preconditions.checkNotNull(interfaceName);
+        this.interfaceName = requireNonNull(interfaceName);
     }
 
     Class<RpcService> rpcInterface() {
index 8139e1d..eaa1ce2 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.blueprint.ext;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -24,7 +25,7 @@ class MandatoryServiceReferenceMetadata implements ServiceReferenceMetadata {
     private final String id;
 
     MandatoryServiceReferenceMetadata(final String id, final String interfaceClass) {
-        this.id = Preconditions.checkNotNull(id);
+        this.id = requireNonNull(id);
         this.interfaceClass = interfaceClass;
     }
 
index 43ad997..525fc82 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.controller.blueprint.ext;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.Objects.requireNonNull;
+
 import java.util.Collections;
 import java.util.function.Consumer;
 import org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe;
@@ -106,15 +108,12 @@ class StaticServiceReferenceRecipe extends AbstractServiceReferenceRecipe {
             return trackedService;
         }
 
-        Preconditions.checkNotNull(localTrackedServiceReference, "trackedServiceReference is null");
-
-        trackedService = getServiceSecurely(localTrackedServiceReference);
+        trackedService = getServiceSecurely(requireNonNull(localTrackedServiceReference,
+            "trackedServiceReference is null"));
 
         LOG.debug("{}: Returning service instance: {}", getName(), trackedService);
 
-        Preconditions.checkNotNull(trackedService, "getService() returned null for %s", localTrackedServiceReference);
-
-        return trackedService;
+        return checkNotNull(trackedService, "getService() returned null for %s", localTrackedServiceReference);
     }
 
     @Override
index 8a04936..b0a0cad 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
@@ -35,8 +37,8 @@ public final class ModifyTransactionRequestBuilder implements Builder<ModifyTran
     private long sequence;
 
     public ModifyTransactionRequestBuilder(final TransactionIdentifier identifier, final ActorRef replyTo) {
-        this.identifier = Preconditions.checkNotNull(identifier);
-        this.replyTo = Preconditions.checkNotNull(replyTo);
+        this.identifier = requireNonNull(identifier);
+        this.replyTo = requireNonNull(replyTo);
     }
 
     @Override
@@ -45,16 +47,16 @@ public final class ModifyTransactionRequestBuilder implements Builder<ModifyTran
     }
 
     private void checkNotFinished() {
-        Preconditions.checkState(protocol == null, "Batch has already been finished");
+        checkState(protocol == null, "Batch has already been finished");
     }
 
     public void addModification(final TransactionModification modification) {
         checkNotFinished();
-        modifications.add(Preconditions.checkNotNull(modification));
+        modifications.add(requireNonNull(modification));
     }
 
     public void setSequence(final long sequence) {
-        Preconditions.checkState(!haveSequence, "Sequence has already been set");
+        checkState(!haveSequence, "Sequence has already been set");
         this.sequence = sequence;
         haveSequence = true;
     }
@@ -82,7 +84,7 @@ public final class ModifyTransactionRequestBuilder implements Builder<ModifyTran
 
     @Override
     public ModifyTransactionRequest build() {
-        Preconditions.checkState(haveSequence, "Request sequence has not been set");
+        checkState(haveSequence, "Request sequence has not been set");
 
         final ModifyTransactionRequest ret = new ModifyTransactionRequest(identifier, sequence, replyTo, modifications,
             protocol);
index 8fe4b0b..5283257 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Optional;
 import org.opendaylight.controller.cluster.access.ABIVersion;
@@ -32,7 +33,7 @@ public final class ReadTransactionSuccess extends TransactionSuccess<ReadTransac
     public ReadTransactionSuccess(final TransactionIdentifier identifier, final long sequence,
             final Optional<NormalizedNode<?, ?>> data) {
         super(identifier, sequence);
-        this.data = Preconditions.checkNotNull(data);
+        this.data = requireNonNull(data);
     }
 
     public Optional<NormalizedNode<?, ?>> getData() {
index 72520c0..cc901d6 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import java.io.IOException;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataOutput;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -25,7 +26,7 @@ public abstract class TransactionDataModification extends TransactionModificatio
 
     TransactionDataModification(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
         super(path);
-        this.data = Preconditions.checkNotNull(data);
+        this.data = requireNonNull(data);
     }
 
     public final NormalizedNode<?, ?> getData() {
index dcd05c3..e4168d5 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.io.IOException;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataInput;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataOutput;
@@ -34,7 +35,7 @@ public abstract class TransactionModification {
     private final YangInstanceIdentifier path;
 
     TransactionModification(final YangInstanceIdentifier path) {
-        this.path = Preconditions.checkNotNull(path);
+        this.path = requireNonNull(path);
     }
 
     public final YangInstanceIdentifier getPath() {
index fe178f2..e97626b 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.Externalizable;
@@ -40,7 +41,7 @@ public final class ClientIdentifier implements WritableIdentifier {
         }
 
         Proxy(final FrontendIdentifier frontendId, final long generation) {
-            this.frontendId = Preconditions.checkNotNull(frontendId);
+            this.frontendId = requireNonNull(frontendId);
             this.generation = generation;
         }
 
@@ -66,7 +67,7 @@ public final class ClientIdentifier implements WritableIdentifier {
     private final long generation;
 
     ClientIdentifier(final FrontendIdentifier frontendId, final long generation) {
-        this.frontendId = Preconditions.checkNotNull(frontendId);
+        this.frontendId = requireNonNull(frontendId);
         this.generation = generation;
     }
 
index 02686d9..8c5f513 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.io.Serializable;
 import org.opendaylight.yangtools.concepts.Immutable;
 
@@ -20,7 +21,7 @@ public abstract class Envelope<T extends Message<?, ?>> implements Immutable, Se
     private final long sessionId;
 
     Envelope(final T message, final long sessionId, final long txSequence) {
-        this.message = Preconditions.checkNotNull(message);
+        this.message = requireNonNull(message);
         this.sessionId = sessionId;
         this.txSequence = txSequence;
     }
index 60e40e9..d47f037 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.Externalizable;
@@ -38,8 +39,8 @@ public final class FrontendIdentifier implements WritableIdentifier {
         }
 
         Proxy(final MemberName memberName, final FrontendType clientType) {
-            this.memberName = Preconditions.checkNotNull(memberName);
-            this.clientType = Preconditions.checkNotNull(clientType);
+            this.memberName = requireNonNull(memberName);
+            this.clientType = requireNonNull(clientType);
         }
 
         @Override
@@ -64,8 +65,8 @@ public final class FrontendIdentifier implements WritableIdentifier {
     private final FrontendType clientType;
 
     FrontendIdentifier(final MemberName memberName, final FrontendType clientType) {
-        this.clientType = Preconditions.checkNotNull(clientType);
-        this.memberName = Preconditions.checkNotNull(memberName);
+        this.clientType = requireNonNull(clientType);
+        this.memberName = requireNonNull(memberName);
     }
 
     public static FrontendIdentifier create(final MemberName memberName, final FrontendType clientType) {
index 7346ed0..f8f890e 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.Externalizable;
@@ -50,7 +51,7 @@ public final class LocalHistoryIdentifier implements WritableIdentifier {
         }
 
         Proxy(final ClientIdentifier frontendId, final long historyId, final long cookie) {
-            this.clientId = Preconditions.checkNotNull(frontendId);
+            this.clientId = requireNonNull(frontendId);
             this.historyId = historyId;
             this.cookie = cookie;
         }
@@ -85,7 +86,7 @@ public final class LocalHistoryIdentifier implements WritableIdentifier {
     }
 
     public LocalHistoryIdentifier(final ClientIdentifier frontendId, final long historyId, final long cookie) {
-        this.clientId = Preconditions.checkNotNull(frontendId);
+        this.clientId = requireNonNull(frontendId);
         this.historyId = historyId;
         this.cookie = cookie;
     }
index 09e39e8..70df622 100644 (file)
@@ -7,11 +7,13 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Verify.verifyNotNull;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
-import com.google.common.base.Verify;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.DataInput;
 import java.io.DataOutput;
@@ -41,7 +43,7 @@ public final class MemberName implements Comparable<MemberName>, WritableIdentif
         }
 
         Proxy(final byte[] serialized) {
-            this.serialized = Preconditions.checkNotNull(serialized);
+            this.serialized = requireNonNull(serialized);
         }
 
         @Override
@@ -70,16 +72,16 @@ public final class MemberName implements Comparable<MemberName>, WritableIdentif
     private volatile byte[] serialized;
 
     private MemberName(final String name) {
-        this.name = Preconditions.checkNotNull(name);
+        this.name = requireNonNull(name);
     }
 
     MemberName(final String name, final byte[] serialized) {
         this(name);
-        this.serialized = Verify.verifyNotNull(serialized);
+        this.serialized = verifyNotNull(serialized);
     }
 
     public static MemberName forName(final String name) {
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(name));
+        checkArgument(!Strings.isNullOrEmpty(name));
         // TODO: consider caching instances here
         return new MemberName(name);
     }
index a52396f..7fb0ef0 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
 
 /**
@@ -21,8 +23,8 @@ public final class RuntimeRequestException extends RequestException {
     private static final long serialVersionUID = 1L;
 
     public RuntimeRequestException(final String message, final Throwable cause) {
-        super(message, Preconditions.checkNotNull(cause));
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(message), "Exception message is mandatory");
+        super(message, requireNonNull(cause));
+        checkArgument(!Strings.isNullOrEmpty(message), "Exception message is mandatory");
     }
 
     @Override
index 01aff95..891de52 100644 (file)
@@ -7,10 +7,12 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 
 /**
@@ -33,10 +35,10 @@ public class BackendInfo {
 
     protected BackendInfo(final ActorRef actor, final String name, final long sessionId, final ABIVersion version,
             final int maxMessages) {
-        this.version = Preconditions.checkNotNull(version);
-        this.actor = Preconditions.checkNotNull(actor);
-        this.name = Preconditions.checkNotNull(name);
-        Preconditions.checkArgument(maxMessages > 0, "Maximum messages has to be positive, not %s", maxMessages);
+        this.version = requireNonNull(version);
+        this.actor = requireNonNull(actor);
+        this.name = requireNonNull(name);
+        checkArgument(maxMessages > 0, "Maximum messages has to be positive, not %s", maxMessages);
         this.maxMessages = maxMessages;
         this.sessionId = sessionId;
     }
index 8d769b2..b47ddee 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
 import java.util.function.Consumer;
 import org.opendaylight.controller.cluster.access.concepts.Request;
 import org.opendaylight.controller.cluster.access.concepts.Response;
@@ -29,8 +30,8 @@ public class ConnectionEntry implements Immutable {
     private final long enqueuedTicks;
 
     ConnectionEntry(final Request<?, ?> request, final Consumer<Response<?, ?>> callback, final long now) {
-        this.request = Preconditions.checkNotNull(request);
-        this.callback = Preconditions.checkNotNull(callback);
+        this.request = requireNonNull(request);
+        this.callback = requireNonNull(callback);
         this.enqueuedTicks = now;
     }
 
index 4449dd2..b739a0b 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorSystem;
 import akka.persistence.SnapshotSelectionCriteria;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 
 /**
@@ -22,7 +23,7 @@ final class InitialClientActorContext extends AbstractClientActorContext {
 
     InitialClientActorContext(final AbstractClientActor actor, final String persistenceId) {
         super(actor.self(), persistenceId);
-        this.actor = Preconditions.checkNotNull(actor);
+        this.actor = requireNonNull(actor);
     }
 
     void saveSnapshot(final ClientIdentifier snapshot) {
index 7ec18a2..a2f2ffd 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import java.util.concurrent.CountDownLatch;
 
 /**
@@ -24,7 +25,7 @@ public final class InversibleLockException extends RuntimeException {
     private final transient CountDownLatch latch;
 
     InversibleLockException(final CountDownLatch latch) {
-        this.latch = Preconditions.checkNotNull(latch);
+        this.latch = requireNonNull(latch);
     }
 
     public void awaitResolution() {
index 58334f9..8217b72 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
 
 /**
  * Forwarder class responsible for routing requests from the previous connection incarnation back to the originator,
@@ -20,7 +20,7 @@ public abstract class ReconnectForwarder {
     private final AbstractReceivingClientConnection<?> successor;
 
     protected ReconnectForwarder(final AbstractReceivingClientConnection<?> successor) {
-        this.successor = Preconditions.checkNotNull(successor);
+        this.successor = requireNonNull(successor);
     }
 
     protected final void sendToSuccessor(final ConnectionEntry entry) {
index acf876b..e63e725 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import org.opendaylight.controller.cluster.access.concepts.RequestException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -26,7 +27,7 @@ public final class ReconnectingClientConnection<T extends BackendInfo> extends A
 
     ReconnectingClientConnection(final ConnectedClientConnection<T> oldConnection, final RequestException cause) {
         super(oldConnection);
-        this.cause = Preconditions.checkNotNull(cause);
+        this.cause = requireNonNull(cause);
     }
 
     @Override
@@ -38,7 +39,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);
+        this.cause = requireNonNull(cause);
         LOG.warn("Skipping reconnect of already-reconnecting connection {}", this);
         return current;
     }
index 5e2b455..795c98d 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.persistence.RecoveryCompleted;
 import akka.persistence.SnapshotOffer;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
 import org.slf4j.Logger;
@@ -27,7 +28,7 @@ final class RecoveringClientActorBehavior extends AbstractClientActorBehavior<In
 
     RecoveringClientActorBehavior(final InitialClientActorContext context, final FrontendIdentifier frontendId) {
         super(context);
-        currentFrontend = Preconditions.checkNotNull(frontendId);
+        currentFrontend = requireNonNull(frontendId);
     }
 
     @Override
index 58a1077..42823a1 100644 (file)
@@ -7,12 +7,13 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.persistence.DeleteSnapshotsFailure;
 import akka.persistence.DeleteSnapshotsSuccess;
 import akka.persistence.SaveSnapshotFailure;
 import akka.persistence.SaveSnapshotSuccess;
 import akka.persistence.SnapshotSelectionCriteria;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -28,7 +29,7 @@ final class SavingClientActorBehavior extends RecoveredClientActorBehavior<Initi
 
     SavingClientActorBehavior(final InitialClientActorContext context, final ClientIdentifier nextId) {
         super(context);
-        this.myId = Preconditions.checkNotNull(nextId);
+        this.myId = requireNonNull(nextId);
     }
 
     @Override
index e4ee78c..71de580 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
@@ -94,8 +95,8 @@ abstract class TransmitQueue {
         Transmitting(final TransmitQueue oldQueue, final int targetDepth, final BackendInfo backend, final long now,
                 final MessageSlicer messageSlicer) {
             super(oldQueue, targetDepth, now);
-            this.backend = Preconditions.checkNotNull(backend);
-            this.messageSlicer = Preconditions.checkNotNull(messageSlicer);
+            this.backend = requireNonNull(backend);
+            this.messageSlicer = requireNonNull(messageSlicer);
         }
 
         @Override
@@ -347,8 +348,8 @@ abstract class TransmitQueue {
     }
 
     final void setForwarder(final ReconnectForwarder forwarder, final long now) {
-        Verify.verify(successor == null, "Successor %s already set on connection %s", successor, this);
-        successor = Preconditions.checkNotNull(forwarder);
+        verify(successor == null, "Successor %s already set on connection %s", successor, this);
+        successor = requireNonNull(forwarder);
         LOG.debug("Connection {} superseded by {}, splicing queue", this, successor);
 
         /*
index 3e26ae9..e0dd69e 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.dispatch.OnComplete;
 import akka.pattern.Patterns;
@@ -14,7 +16,6 @@ import akka.persistence.SelectedSnapshot;
 import akka.persistence.SnapshotMetadata;
 import akka.persistence.SnapshotSelectionCriteria;
 import akka.persistence.snapshot.japi.SnapshotStore;
-import com.google.common.base.Preconditions;
 import java.util.Optional;
 import scala.concurrent.Future;
 import scala.concurrent.Promise;
@@ -67,9 +68,7 @@ class MockedSnapshotStore extends SnapshotStore {
     }
 
     private <T> Future<T> askDelegate(final MockedSnapshotStoreMessage message) {
-        Preconditions.checkNotNull(delegate, "Delegate ref wasn't sent");
-        final Future<Object> ask = Patterns.ask(delegate, message, TIMEOUT);
-        return transform(ask);
+        return transform(Patterns.ask(requireNonNull(delegate, "Delegate ref was not sent"), message, TIMEOUT));
     }
 
     private <T> Future<T> transform(final Future<Object> future) {
index dac4f8f..89b8a9c 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.messagebus.app.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import org.opendaylight.controller.messagebus.spi.EventSource;
 import org.opendaylight.controller.messagebus.spi.EventSourceRegistration;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
@@ -25,7 +26,7 @@ class EventSourceRegistrationImpl<T extends EventSource> extends AbstractObjectR
      */
     EventSourceRegistrationImpl(T instance, EventSourceTopology eventSourceTopology) {
         super(instance);
-        this.eventSourceTopology = Preconditions.checkNotNull(eventSourceTopology);
+        this.eventSourceTopology = requireNonNull(eventSourceTopology);
     }
 
     @Override
index a533168..d1e0b5c 100644 (file)
@@ -7,12 +7,13 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.PoisonPill;
 import akka.actor.Props;
 import akka.actor.ReceiveTimeout;
 import akka.actor.UntypedAbstractActor;
-import com.google.common.base.Preconditions;
 import java.util.concurrent.TimeoutException;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshot;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshotReply;
@@ -82,11 +83,11 @@ class GetSnapshotReplyActor extends UntypedAbstractActor {
 
         Params(final CaptureSnapshot captureSnapshot, final ElectionTerm electionTerm, final ActorRef replyToActor,
                 final FiniteDuration receiveTimeout, final String id, final ServerConfigurationPayload peerInfo) {
-            this.captureSnapshot = Preconditions.checkNotNull(captureSnapshot);
-            this.electionTerm = Preconditions.checkNotNull(electionTerm);
-            this.replyToActor = Preconditions.checkNotNull(replyToActor);
-            this.receiveTimeout = Preconditions.checkNotNull(receiveTimeout);
-            this.id = Preconditions.checkNotNull(id);
+            this.captureSnapshot = requireNonNull(captureSnapshot);
+            this.electionTerm = requireNonNull(electionTerm);
+            this.replyToActor = requireNonNull(replyToActor);
+            this.receiveTimeout = requireNonNull(receiveTimeout);
+            this.id = requireNonNull(id);
             this.peerInformation = peerInfo;
         }
     }
index dc97336..9195ad3 100755 (executable)
@@ -16,7 +16,7 @@ import akka.actor.ActorSelection;
 import akka.actor.PoisonPill;
 import akka.actor.Status;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -480,7 +480,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         if (getCurrentBehavior() instanceof AbstractLeader) {
             AbstractLeader leader = (AbstractLeader)getCurrentBehavior();
             Collection<String> followerIds = leader.getFollowerIds();
-            List<FollowerInfo> followerInfoList = Lists.newArrayListWithCapacity(followerIds.size());
+            List<FollowerInfo> followerInfoList = new ArrayList<>(followerIds.size());
             for (String id: followerIds) {
                 final FollowerLogInformation info = leader.getFollower(id);
                 followerInfoList.add(new FollowerInfo(id, info.getNextIndex(), info.getMatchIndex(),
index 238b7e7..0bd8638 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.japi.Procedure;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.DelegatingPersistentDataProvider;
 import org.opendaylight.controller.cluster.PersistentDataProvider;
@@ -24,10 +25,10 @@ import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Persis
 class RaftActorDelegatingPersistentDataProvider extends DelegatingPersistentDataProvider {
     private final PersistentDataProvider persistentProvider;
 
-    RaftActorDelegatingPersistentDataProvider(DataPersistenceProvider delegate,
-            PersistentDataProvider persistentProvider) {
+    RaftActorDelegatingPersistentDataProvider(final DataPersistenceProvider delegate,
+            final PersistentDataProvider persistentProvider) {
         super(delegate);
-        this.persistentProvider = Preconditions.checkNotNull(persistentProvider);
+        this.persistentProvider = requireNonNull(persistentProvider);
     }
 
     @Override
@@ -36,7 +37,7 @@ class RaftActorDelegatingPersistentDataProvider extends DelegatingPersistentData
     }
 
     @Override
-    public <T> void persistAsync(T entry, Procedure<T> procedure) {
+    public <T> void persistAsync(final T entry, final Procedure<T> procedure) {
         doPersist(entry, procedure, true);
     }
 
index 02269a2..e6dc8bb 100644 (file)
@@ -55,7 +55,7 @@ public class SnapshotManager implements SnapshotState {
     private CaptureSnapshot captureSnapshot;
     private long lastSequenceNumber = -1;
 
-    private Consumer<Optional<OutputStream>> createSnapshotProcedure;
+    private Consumer<Optional<OutputStream>> createSnapshotProcedure = null;
 
     private ApplySnapshot applySnapshot;
     private RaftActorSnapshotCohort snapshotCohort = NoopRaftActorSnapshotCohort.INSTANCE;
index 9560665..f16e5e2 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.Cancellable;
-import com.google.common.base.Preconditions;
 import scala.concurrent.duration.FiniteDuration;
 
 /**
@@ -26,11 +27,10 @@ abstract class TimedRunnable implements Runnable {
     private final Cancellable cancelTimer;
     private boolean canRun = true;
 
-    TimedRunnable(FiniteDuration timeout, RaftActor actor) {
-        Preconditions.checkNotNull(timeout);
-        Preconditions.checkNotNull(actor);
-        cancelTimer = actor.getContext().system().scheduler().scheduleOnce(timeout, actor.self(),
-                (Runnable) this::cancel, actor.getContext().system().dispatcher(), actor.self());
+    TimedRunnable(final FiniteDuration timeout, final RaftActor actor) {
+        cancelTimer = requireNonNull(actor).getContext().system().scheduler()
+                .scheduleOnce(requireNonNull(timeout), actor.self(), (Runnable) this::cancel,
+                    actor.getContext().system().dispatcher(), actor.self());
     }
 
     @Override
index 091237a..67f3ed9 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.raft.base.messages;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Externalizable;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
@@ -23,16 +24,16 @@ public abstract class EmptyExternalizableProxy implements Externalizable {
 
     private final Object readResolveTo;
 
-    protected EmptyExternalizableProxy(Object readResolveTo) {
-        this.readResolveTo = Preconditions.checkNotNull(readResolveTo);
+    protected EmptyExternalizableProxy(final Object readResolveTo) {
+        this.readResolveTo = requireNonNull(readResolveTo);
     }
 
     @Override
-    public void writeExternal(ObjectOutput out) {
+    public void writeExternal(final ObjectOutput out) {
     }
 
     @Override
-    public void readExternal(ObjectInput in) {
+    public void readExternal(final ObjectInput in) {
     }
 
     protected Object readResolve() {
index 087c656..2b28c37 100644 (file)
@@ -5,12 +5,12 @@
  * 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.raft.behaviors;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.Cancellable;
-import com.google.common.base.Preconditions;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Random;
 import java.util.concurrent.TimeUnit;
@@ -64,8 +64,8 @@ public abstract class AbstractRaftActorBehavior implements RaftActorBehavior {
     private long replicatedToAllIndex = -1;
 
     AbstractRaftActorBehavior(final RaftActorContext context, final RaftState state) {
-        this.context = Preconditions.checkNotNull(context);
-        this.state = Preconditions.checkNotNull(state);
+        this.context = requireNonNull(context);
+        this.state = requireNonNull(state);
         this.log = context.getLogger();
 
         logName = String.format("%s (%s)", context.getId(), state);
index 2071449..2b700ff 100644 (file)
@@ -5,11 +5,12 @@
  * 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.raft.behaviors;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.raft.base.messages.FollowerInitialSyncUpStatus;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -28,7 +29,7 @@ public class SyncStatusTracker {
         final String leaderId;
 
         LeaderInfo(final String leaderId, final long minimumCommitIndex) {
-            this.leaderId = Preconditions.checkNotNull(leaderId);
+            this.leaderId = requireNonNull(leaderId);
             this.minimumCommitIndex = minimumCommitIndex;
         }
     }
@@ -46,14 +47,14 @@ public class SyncStatusTracker {
     private boolean syncStatus;
 
     public SyncStatusTracker(final ActorRef actor, final String id, final long syncThreshold) {
-        this.actor = Preconditions.checkNotNull(actor, "actor should not be null");
-        this.id = Preconditions.checkNotNull(id, "id should not be null");
-        Preconditions.checkArgument(syncThreshold >= 0, "syncThreshold should be greater than or equal to 0");
+        this.actor = requireNonNull(actor, "actor should not be null");
+        this.id = requireNonNull(id, "id should not be null");
+        checkArgument(syncThreshold >= 0, "syncThreshold should be greater than or equal to 0");
         this.syncThreshold = syncThreshold;
     }
 
     public void update(final String leaderId, final long leaderCommit, final long commitIndex) {
-        Preconditions.checkNotNull(leaderId, "leaderId should not be null");
+        requireNonNull(leaderId, "leaderId should not be null");
 
         if (syncTarget == null || !leaderId.equals(syncTarget.leaderId)) {
             LOG.debug("{}: Last sync leader does not match current leader {}, need to catch up to {}", id,
index 9f4977e..0c74d89 100644 (file)
@@ -5,10 +5,10 @@
  * 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.raft.messages;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Serializable;
 
 /**
@@ -19,8 +19,8 @@ public class RemoveServer implements Serializable {
 
     private final String serverId;
 
-    public RemoveServer(String serverId) {
-        this.serverId = Preconditions.checkNotNull(serverId);
+    public RemoveServer(final String serverId) {
+        this.serverId = requireNonNull(serverId);
     }
 
     public String getServerId() {
index 5561085..766c5c4 100644 (file)
@@ -5,11 +5,11 @@
  * 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.raft.messages;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
 import java.io.Serializable;
 
 /**
@@ -22,8 +22,8 @@ public final class RequestLeadership implements Serializable {
     private final ActorRef replyTo;
 
     public RequestLeadership(final String requestedFollowerId, final ActorRef replyTo) {
-        this.requestedFollowerId = Preconditions.checkNotNull(requestedFollowerId);
-        this.replyTo = Preconditions.checkNotNull(replyTo);
+        this.requestedFollowerId = requireNonNull(requestedFollowerId);
+        this.replyTo = requireNonNull(replyTo);
     }
 
     public String getRequestedFollowerId() {
index 3375137..a7de8ea 100644 (file)
@@ -5,10 +5,10 @@
  * 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.raft.messages;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Serializable;
 
 /**
@@ -20,8 +20,8 @@ public class ServerRemoved implements Serializable {
 
     private final String serverId;
 
-    public ServerRemoved(String serverId) {
-        this.serverId = Preconditions.checkNotNull(serverId);
+    public ServerRemoved(final String serverId) {
+        this.serverId = requireNonNull(serverId);
     }
 
     public String getServerId() {
index 14ce542..4c07e6b 100644 (file)
@@ -5,10 +5,10 @@
  * 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.raft.persisted;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -39,7 +39,7 @@ public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, Seria
             this.replicatedLogEntry = replicatedLogEntry;
         }
 
-        static int estimatedSerializedSize(ReplicatedLogEntry replicatedLogEntry) {
+        static int estimatedSerializedSize(final ReplicatedLogEntry replicatedLogEntry) {
             return 8 /* index */ + 8 /* term */ + replicatedLogEntry.getData().size()
                     + 400 /* estimated extra padding for class info */;
         }
@@ -75,10 +75,10 @@ public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, Seria
      * @param term the term
      * @param payload the payload
      */
-    public SimpleReplicatedLogEntry(long index, long term, Payload payload) {
+    public SimpleReplicatedLogEntry(final long index, final long term, final Payload payload) {
         this.index = index;
         this.term = term;
-        this.payload = Preconditions.checkNotNull(payload);
+        this.payload = requireNonNull(payload);
     }
 
     @Override
@@ -107,7 +107,7 @@ public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, Seria
     }
 
     @Override
-    public void setPersistencePending(boolean pending) {
+    public void setPersistencePending(final boolean pending) {
         persistencePending = pending;
     }
 
@@ -130,7 +130,7 @@ public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, Seria
     }
 
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
index cf09ab5..815b8d9 100644 (file)
@@ -20,7 +20,6 @@ import static org.mockito.Mockito.verify;
 import akka.actor.Props;
 import akka.testkit.TestActorRef;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -85,7 +84,7 @@ public class RaftActorContextImplTest extends AbstractActorTest {
         DefaultConfigParamsImpl configParams = new DefaultConfigParamsImpl();
         RaftActorContextImpl context = new RaftActorContextImpl(actor, actor.underlyingActor().getContext(),
                 "test", new ElectionTermImpl(createProvider(), "test", LOG), -1, -1,
-                Maps.newHashMap(ImmutableMap.<String, String>of("peer1", "peerAddress1")), configParams,
+                new HashMap<>(ImmutableMap.of("peer1", "peerAddress1")), configParams,
                 createProvider(), applyState -> { }, LOG,  MoreExecutors.directExecutor());
 
         context.setPeerAddress("peer1", "peerAddress1_1");
@@ -99,7 +98,7 @@ public class RaftActorContextImplTest extends AbstractActorTest {
     public void testUpdatePeerIds() {
         RaftActorContextImpl context = new RaftActorContextImpl(actor, actor.underlyingActor().getContext(),
                 "self", new ElectionTermImpl(createProvider(), "test", LOG), -1, -1,
-                Maps.newHashMap(ImmutableMap.<String, String>of("peer1", "peerAddress1")),
+                new HashMap<>(ImmutableMap.of("peer1", "peerAddress1")),
                 new DefaultConfigParamsImpl(), createProvider(), applyState -> { }, LOG,
                 MoreExecutors.directExecutor());
 
index 54ba69e..140735b 100644 (file)
@@ -23,8 +23,7 @@ import akka.testkit.TestActorRef;
 import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Stopwatch;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.io.ByteSource;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.io.OutputStream;
@@ -32,6 +31,8 @@ import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -203,9 +204,9 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         // Verify new server config was applied in both followers
 
-        assertEquals("Follower peers", Sets.newHashSet(LEADER_ID, NEW_SERVER_ID), followerActorContext.getPeerIds());
+        assertEquals("Follower peers", ImmutableSet.of(LEADER_ID, NEW_SERVER_ID), followerActorContext.getPeerIds());
 
-        assertEquals("New follower peers", Sets.newHashSet(LEADER_ID, FOLLOWER_ID),
+        assertEquals("New follower peers", ImmutableSet.of(LEADER_ID, FOLLOWER_ID),
                 newFollowerActorContext.getPeerIds());
 
         assertEquals("Follower commit index", 3, followerActorContext.getCommitIndex());
@@ -277,7 +278,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         // Verify new server config was applied in the new follower
 
-        assertEquals("New follower peers", Sets.newHashSet(LEADER_ID), newFollowerActorContext.getPeerIds());
+        assertEquals("New follower peers", ImmutableSet.of(LEADER_ID), newFollowerActorContext.getPeerIds());
 
         LOG.info("testAddServerWithNoExistingFollower ending");
     }
@@ -324,7 +325,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         // Verify new server config was applied in the new follower
 
-        assertEquals("New follower peers", Sets.newHashSet(LEADER_ID), newFollowerActorContext.getPeerIds());
+        assertEquals("New follower peers", ImmutableSet.of(LEADER_ID), newFollowerActorContext.getPeerIds());
 
         assertNoneMatching(newFollowerCollectorActor, InstallSnapshot.class, 500);
 
@@ -409,7 +410,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         // Verify ServerConfigurationPayload entry in the new follower
 
         expectMatching(newFollowerCollectorActor, ApplyState.class, 2);
-        assertEquals("New follower peers", Sets.newHashSet(LEADER_ID, NEW_SERVER_ID2),
+        assertEquals("New follower peers", ImmutableSet.of(LEADER_ID, NEW_SERVER_ID2),
                newFollowerActorContext.getPeerIds());
 
         LOG.info("testAddServerWithOperationInProgress ending");
@@ -1283,8 +1284,8 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         ServerChangeReply reply = testKit.expectMsgClass(Duration.ofSeconds(5), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.NO_LEADER, reply.getStatus());
 
-        assertEquals("Server config", Sets.newHashSet(nonVotingServer(node1ID), votingServer(node2ID)),
-                Sets.newHashSet(node1RaftActor.getRaftActorContext().getPeerServerInfo(true).getServerConfig()));
+        assertEquals("Server config", ImmutableSet.of(nonVotingServer(node1ID), votingServer(node2ID)),
+            new HashSet<>(node1RaftActor.getRaftActorContext().getPeerServerInfo(true).getServerConfig()));
         assertEquals("getRaftState", RaftState.Follower, node1RaftActor.getRaftState());
 
         LOG.info("testChangeToVotingWithNoLeaderAndElectionTimeout ending");
@@ -1463,7 +1464,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         ReplicatedLogEntry logEntry = log.get(log.lastIndex());
         assertEquals("Last log entry payload class", ServerConfigurationPayload.class, logEntry.getData().getClass());
         ServerConfigurationPayload payload = (ServerConfigurationPayload)logEntry.getData();
-        assertEquals("Server config", Sets.newHashSet(expected), Sets.newHashSet(payload.getServerConfig()));
+        assertEquals("Server config", ImmutableSet.copyOf(expected), new HashSet<>(payload.getServerConfig()));
     }
 
     private static RaftActorContextImpl newFollowerContext(final String id,
@@ -1590,8 +1591,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
     public static class MockNewFollowerRaftActor extends AbstractMockRaftActor {
         public MockNewFollowerRaftActor(final ConfigParams config, final ActorRef collectorActor) {
-            super(NEW_SERVER_ID, Maps.<String, String>newHashMap(), Optional.of(config), NO_PERSISTENCE,
-                    collectorActor);
+            super(NEW_SERVER_ID, new HashMap<>(), Optional.of(config), NO_PERSISTENCE, collectorActor);
             setPersistence(false);
         }
 
index e9bd04b..662a063 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.cluster.raft.utils;
 
 import akka.dispatch.Futures;
@@ -13,7 +12,6 @@ import akka.persistence.SelectedSnapshot;
 import akka.persistence.SnapshotMetadata;
 import akka.persistence.SnapshotSelectionCriteria;
 import akka.persistence.snapshot.japi.SnapshotStore;
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.Uninterruptibles;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -59,7 +57,7 @@ public class InMemorySnapshotStore extends SnapshotStore {
 
         List<T> retList;
         synchronized (stored) {
-            retList = Lists.newArrayListWithCapacity(stored.size());
+            retList = new ArrayList<>(stored.size());
             for (StoredSnapshot s: stored) {
                 if (type.isInstance(s.data)) {
                     retList.add((T) s.data);
index 71b6593..4d53384 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
@@ -25,7 +26,7 @@ abstract class AbstractNotificationListenerRegistration<T extends Notification>
     protected AbstractNotificationListenerRegistration(final Class<? extends Notification> type,
             final NotificationListener<T> listener) {
         super(listener);
-        this.type = Preconditions.checkNotNull(type);
+        this.type = requireNonNull(type);
     }
 
     @Override
index a095808..3fee8bf 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
@@ -31,7 +32,7 @@ abstract class AggregatedNotificationListenerRegistration<N extends Notification
     protected AggregatedNotificationListenerRegistration(final Class<? extends Notification> type,
             final NotificationListener<N> listener, final A aggregator) {
         super(type, listener);
-        this.aggregator = Preconditions.checkNotNull(aggregator);
+        this.aggregator = requireNonNull(aggregator);
     }
 
     protected A getAggregator() {
index 2466b49..dc81ce0 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -32,11 +34,10 @@ abstract class AbstractForwardedTransaction<T extends AsyncTransaction<YangInsta
     private final BindingToNormalizedNodeCodec codec;
 
     AbstractForwardedTransaction(final T delegateTx, final BindingToNormalizedNodeCodec codec) {
-        this.delegate = Preconditions.checkNotNull(delegateTx, "Delegate must not be null");
-        this.codec = Preconditions.checkNotNull(codec, "Codec must not be null");
+        this.delegate = requireNonNull(delegateTx, "Delegate must not be null");
+        this.codec = requireNonNull(codec, "Codec must not be null");
     }
 
-
     @Override
     public final  Object getIdentifier() {
         return delegate.getIdentifier();
index 13245db..8d3b9c0 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.util.Collection;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
@@ -24,16 +25,15 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
  */
 @Deprecated
 class BindingDOMDataTreeChangeListenerAdapter<T extends DataObject> implements DOMDataTreeChangeListener {
-
     private final BindingToNormalizedNodeCodec codec;
     private final DataTreeChangeListener<T> listener;
     private final LogicalDatastoreType store;
 
     BindingDOMDataTreeChangeListenerAdapter(final BindingToNormalizedNodeCodec codec,
             final DataTreeChangeListener<T> listener, final LogicalDatastoreType store) {
-        this.codec = Preconditions.checkNotNull(codec);
-        this.listener = Preconditions.checkNotNull(listener);
-        this.store = Preconditions.checkNotNull(store);
+        this.codec = requireNonNull(codec);
+        this.listener = requireNonNull(listener);
+        this.store = requireNonNull(store);
     }
 
     @Override
index 5c488da..0c99a0e 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeService;
@@ -18,7 +19,6 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
-
 /**
  * Adapter exposing Binding {@link DataTreeChangeService} and wrapping
  * {@link DOMDataTreeChangeService} and is responsible for translation
@@ -37,8 +37,8 @@ final class BindingDOMDataTreeChangeServiceAdapter implements DataTreeChangeServ
 
     private BindingDOMDataTreeChangeServiceAdapter(final BindingToNormalizedNodeCodec codec,
             final DOMDataTreeChangeService dataTreeChangeService) {
-        this.codec = Preconditions.checkNotNull(codec);
-        this.dataTreeChangeService = Preconditions.checkNotNull(dataTreeChangeService);
+        this.codec = requireNonNull(codec);
+        this.dataTreeChangeService = requireNonNull(dataTreeChangeService);
     }
 
     static DataTreeChangeService create(final BindingToNormalizedNodeCodec codec,
index b621031..2551f7a 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -40,10 +42,10 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
 
     BindingDOMTransactionChainAdapter(final DOMDataBroker chainFactory,
             final BindingToNormalizedNodeCodec codec, final TransactionChainListener listener) {
-        Preconditions.checkNotNull(chainFactory, "DOM Transaction chain factory must not be null");
         this.domListener = new DelegateChainListener();
         this.bindingListener = listener;
-        this.delegate = chainFactory.createTransactionChain(domListener);
+        this.delegate = requireNonNull(chainFactory, "DOM Transaction chain factory must not be null")
+                .createTransactionChain(domListener);
         this.codec = codec;
     }
 
@@ -117,12 +119,10 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
     }
 
     private final class DelegateChainListener implements TransactionChainListener {
-
         @Override
         public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
                 final AsyncTransaction<?, ?> transaction, final Throwable cause) {
-            Preconditions.checkState(delegate.equals(chain),
-                    "Illegal state - listener for %s was invoked for incorrect chain %s.", delegate, chain);
+            checkChain(chain);
             /*
              * Intentionally NOOP, callback for failure, since we
              * are also listening on each transaction future for failure,
@@ -130,17 +130,20 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
              * of this transaction chain), instead of DOM transaction
              * which is known only to this chain, binding transaction implementation
              * and underlying transaction chain.
-             *
              */
             LOG.debug("Transaction chain {} failed. Failed DOM Transaction {}",this,transaction,cause);
         }
 
         @Override
         public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
-            Preconditions.checkState(delegate.equals(chain),
-                    "Illegal state - listener for %s was invoked for incorrect chain %s.", delegate, chain);
+            checkChain(chain);
             bindingListener.onTransactionChainSuccessful(BindingDOMTransactionChainAdapter.this);
         }
+
+        private void checkChain(final TransactionChain<?, ?> chain) {
+            checkState(delegate.equals(chain), "Illegal state - listener for %s was invoked for incorrect chain %s.",
+                delegate, chain);
+        }
     }
 
 }
index cdc2d35..0b5c92d 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
@@ -20,7 +21,7 @@ class BindingDataTreeChangeListenerRegistration<L extends DataTreeChangeListener
 
     BindingDataTreeChangeListenerRegistration(final L listener, final ListenerRegistration<?> domReg) {
         super(listener);
-        this.domReg = Preconditions.checkNotNull(domReg);
+        this.domReg = requireNonNull(domReg);
     }
 
     @Override
index 636f0b8..1acdd24 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Throwables;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -33,8 +34,8 @@ final class LazyDOMRpcResultFuture implements CheckedFuture<DOMRpcResult, DOMRpc
 
     private LazyDOMRpcResultFuture(final ListenableFuture<RpcResult<?>> delegate,
             final BindingNormalizedNodeSerializer codec) {
-        this.bindingFuture = Preconditions.checkNotNull(delegate, "delegate");
-        this.codec = Preconditions.checkNotNull(codec, "codec");
+        this.bindingFuture = requireNonNull(delegate, "delegate");
+        this.codec = requireNonNull(codec, "codec");
     }
 
     static CheckedFuture<DOMRpcResult, DOMRpcException> create(final BindingNormalizedNodeSerializer codec,
index 94b06e8..af2ad1d 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
@@ -56,9 +57,9 @@ class RpcServiceAdapter implements InvocationHandler {
 
     RpcServiceAdapter(final Class<? extends RpcService> type, final BindingToNormalizedNodeCodec codec,
             final DOMRpcService domService) {
-        this.type = Preconditions.checkNotNull(type);
-        this.codec = Preconditions.checkNotNull(codec);
-        this.delegate = Preconditions.checkNotNull(domService);
+        this.type = requireNonNull(type);
+        this.codec = requireNonNull(codec);
+        this.delegate = requireNonNull(domService);
         final ImmutableMap.Builder<Method, RpcInvocationStrategy> rpcBuilder = ImmutableMap.builder();
         for (final Entry<Method, RpcDefinition> rpc : codec.getRpcMethodToSchema(type).entrySet()) {
             rpcBuilder.put(rpc.getKey(), createStrategy(rpc.getKey(), rpc.getValue()));
index 7645791..eaca341 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.md.sal.binding.util;
 
-import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.Objects.requireNonNull;
 
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.MutableClassToInstanceMap;
@@ -31,35 +31,34 @@ public final class BindingContextUtils {
     private BindingContextUtils() {
     }
 
-    public static ConsumerContext createConsumerContext(BindingAwareConsumer consumer,
-            ClassToInstanceMap<BindingAwareService> serviceProvider) {
-        checkNotNull(consumer,"Consumer should not be null");
-        checkNotNull(serviceProvider,"Service map should not be null");
-        return new SingleConsumerContextImpl(serviceProvider);
+    public static ConsumerContext createConsumerContext(final BindingAwareConsumer consumer,
+            final ClassToInstanceMap<BindingAwareService> serviceProvider) {
+        requireNonNull(consumer, "Consumer should not be null");
+        return new SingleConsumerContextImpl(requireNonNull(serviceProvider, "Service map should not be null"));
     }
 
-    public static ProviderContext createProviderContext(BindingAwareProvider provider,
-            ClassToInstanceMap<BindingAwareService> serviceProvider) {
-        checkNotNull(provider,"Provider should not be null");
-        checkNotNull(serviceProvider,"Service map should not be null");
-        return new SingleProviderContextImpl(serviceProvider);
+    public static ProviderContext createProviderContext(final BindingAwareProvider provider,
+            final ClassToInstanceMap<BindingAwareService> serviceProvider) {
+        requireNonNull(provider, "Provider should not be null");
+        return new SingleProviderContextImpl(requireNonNull(serviceProvider, "Service map should not be null"));
     }
 
-    public static ConsumerContext createConsumerContextAndInitialize(BindingAwareConsumer consumer,
-            ClassToInstanceMap<BindingAwareService> serviceProvider) {
+    public static ConsumerContext createConsumerContextAndInitialize(final BindingAwareConsumer consumer,
+            final ClassToInstanceMap<BindingAwareService> serviceProvider) {
         ConsumerContext context = createConsumerContext(consumer, serviceProvider);
         consumer.onSessionInitialized(context);
         return context;
     }
 
-    public static ProviderContext createProviderContextAndInitialize(BindingAwareProvider provider,
-            ClassToInstanceMap<BindingAwareService> serviceProvider) {
+    public static ProviderContext createProviderContextAndInitialize(final BindingAwareProvider provider,
+            final ClassToInstanceMap<BindingAwareService> serviceProvider) {
         ProviderContext context = createProviderContext(provider, serviceProvider);
         provider.onSessionInitiated(context);
         return context;
     }
 
-    public static <T extends BindingAwareService> T createContextProxyOrReturnService(Class<T> service, T instance) {
+    public static <T extends BindingAwareService> T createContextProxyOrReturnService(final Class<T> service,
+            final T instance) {
         // FIXME: Create Proxy
         return instance;
     }
@@ -69,27 +68,27 @@ public final class BindingContextUtils {
         private ClassToInstanceMap<BindingAwareService> alreadyRetrievedServices;
         private ClassToInstanceMap<BindingAwareService> serviceProvider;
 
-        SingleConsumerContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
+        SingleConsumerContextImpl(final ClassToInstanceMap<BindingAwareService> serviceProvider) {
             this.alreadyRetrievedServices = MutableClassToInstanceMap.create();
             this.serviceProvider = serviceProvider;
         }
 
         @Override
-        public final <T extends RpcService> T getRpcService(Class<T> module) {
+        public final <T extends RpcService> T getRpcService(final Class<T> module) {
             return getSALService(RpcConsumerRegistry.class).getRpcService(module);
         }
 
         @Override
-        public final <T extends BindingAwareService> T getSALService(Class<T> service) {
-            checkNotNull(service,"Service class should not be null.");
-            T potential = alreadyRetrievedServices.getInstance(service);
+        public final <T extends BindingAwareService> T getSALService(final Class<T> service) {
+            T potential = alreadyRetrievedServices.getInstance(requireNonNull(service,
+                "Service class should not be null."));
             if (potential != null) {
                 return potential;
             }
             return tryToRetrieveSalService(service);
         }
 
-        private synchronized <T extends BindingAwareService> T tryToRetrieveSalService(Class<T> service) {
+        private synchronized <T extends BindingAwareService> T tryToRetrieveSalService(final Class<T> service) {
             final T potential = alreadyRetrievedServices.getInstance(service);
             if (potential != null) {
                 return potential;
@@ -111,26 +110,25 @@ public final class BindingContextUtils {
     }
 
     private static class SingleProviderContextImpl extends SingleConsumerContextImpl implements ProviderContext {
-
-        SingleProviderContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
+        SingleProviderContextImpl(final ClassToInstanceMap<BindingAwareService> serviceProvider) {
             super(serviceProvider);
         }
 
         @Override
         public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L>
-                registerRouteChangeListener(L listener) {
+                registerRouteChangeListener(final L listener) {
             return getSALService(RpcProviderRegistry.class).registerRouteChangeListener(listener);
         }
 
         @Override
-        public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type,
-                T implementation) throws IllegalStateException {
+        public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(final Class<T> type,
+                final T implementation) {
             return getSALService(RpcProviderRegistry.class).addRoutedRpcImplementation(type, implementation);
         }
 
         @Override
-        public <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
-                throws IllegalStateException {
+        public <T extends RpcService> RpcRegistration<T> addRpcImplementation(final Class<T> type,
+                final T implementation) {
             return getSALService(RpcProviderRegistry.class).addRpcImplementation(type, implementation);
         }
     }
index aaa9ad6..62043e2 100644 (file)
@@ -5,10 +5,10 @@
  * 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.common.actor;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import scala.concurrent.ExecutionContext;
 
 public class Dispatchers {
@@ -50,8 +50,7 @@ public class Dispatchers {
     }
 
     public Dispatchers(final akka.dispatch.Dispatchers dispatchers) {
-        Preconditions.checkNotNull(dispatchers, "dispatchers should not be null");
-        this.dispatchers = dispatchers;
+        this.dispatchers = requireNonNull(dispatchers, "dispatchers should not be null");
     }
 
     public ExecutionContext getDispatcher(final DispatcherType dispatcherType) {
index a4e0b70..0bf1a2f 100644 (file)
@@ -5,12 +5,10 @@
  * 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.node.utils;
 
-import com.google.common.base.Preconditions;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import static java.util.Objects.requireNonNull;
+
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -21,30 +19,26 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
  */
 public class NormalizedNodeNavigator {
 
-    private final org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeVisitor visitor;
+    private final NormalizedNodeVisitor visitor;
 
-    public NormalizedNodeNavigator(
-            org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeVisitor visitor) {
-        Preconditions.checkNotNull(visitor, "visitor should not be null");
-        this.visitor = visitor;
+    public NormalizedNodeNavigator(final NormalizedNodeVisitor visitor) {
+        this.visitor = requireNonNull(visitor, "visitor should not be null");
     }
 
-    public void navigate(String parentPath, NormalizedNode<?, ?> normalizedNode) {
+    public void navigate(String parentPath, final NormalizedNode<?, ?> normalizedNode) {
         if (parentPath == null) {
             parentPath = "";
         }
         navigateNormalizedNode(0, parentPath, normalizedNode);
     }
 
-    private void navigateDataContainerNode(int level, final String parentPath,
+    private void navigateDataContainerNode(final int level, final String parentPath,
             final DataContainerNode<?> dataContainerNode) {
         visitor.visitNode(level, parentPath, dataContainerNode);
 
         String newParentPath = parentPath + "/" + dataContainerNode.getIdentifier().toString();
 
-        final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> value = dataContainerNode
-                .getValue();
-        for (NormalizedNode<?, ?> node : value) {
+        for (NormalizedNode<?, ?> node : dataContainerNode.getValue()) {
             if (node instanceof MixinNode && node instanceof NormalizedNodeContainer) {
                 navigateNormalizedNodeContainerMixin(level, newParentPath, (NormalizedNodeContainer<?, ?, ?>) node);
             } else {
@@ -54,14 +48,13 @@ public class NormalizedNodeNavigator {
 
     }
 
-    private void navigateNormalizedNodeContainerMixin(int level, final String parentPath,
-            NormalizedNodeContainer<?, ?, ?> node) {
+    private void navigateNormalizedNodeContainerMixin(final int level, final String parentPath,
+            final NormalizedNodeContainer<?, ?, ?> node) {
         visitor.visitNode(level, parentPath, node);
 
         String newParentPath = parentPath + "/" + node.getIdentifier().toString();
 
-        final Iterable<? extends NormalizedNode<?, ?>> value = node.getValue();
-        for (NormalizedNode<?, ?> normalizedNode : value) {
+        for (NormalizedNode<?, ?> normalizedNode : node.getValue()) {
             if (normalizedNode instanceof MixinNode && normalizedNode instanceof NormalizedNodeContainer) {
                 navigateNormalizedNodeContainerMixin(level + 1, newParentPath,
                         (NormalizedNodeContainer<?, ?, ?>) normalizedNode);
@@ -72,7 +65,8 @@ public class NormalizedNodeNavigator {
 
     }
 
-    private void navigateNormalizedNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode) {
+    private void navigateNormalizedNode(final int level, final String parentPath,
+            final NormalizedNode<?, ?> normalizedNode) {
         if (normalizedNode instanceof DataContainerNode) {
 
             final DataContainerNode<?> dataContainerNode = (DataContainerNode<?>) normalizedNode;
index 161a450..863fd0c 100755 (executable)
@@ -7,7 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore.node.utils.stream;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.DataOutput;
 import java.io.IOException;
@@ -47,7 +50,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     private boolean inSimple;
 
     AbstractNormalizedNodeDataOutput(final DataOutput output) {
-        this.output = Preconditions.checkNotNull(output);
+        this.output = requireNonNull(output);
     }
 
     private void ensureHeaderWritten() throws IOException {
@@ -162,7 +165,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startLeafNode(final NodeIdentifier name) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting a new leaf node");
         startNode(name.getNodeType(), NodeTypes.LEAF_NODE);
         inSimple = true;
@@ -170,7 +173,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startLeafSet(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting a new leaf set");
 
         lastLeafSetQName = name.getNodeType();
@@ -179,7 +182,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startOrderedLeafSet(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting a new ordered leaf set");
 
         lastLeafSetQName = name.getNodeType();
@@ -202,7 +205,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
 
         LOG.trace("Starting a new container node");
 
@@ -211,7 +214,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startYangModeledAnyXmlNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
 
         LOG.trace("Starting a new yang modeled anyXml node");
 
@@ -220,7 +223,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting a new unkeyed list");
 
         startNode(name.getNodeType(), NodeTypes.UNKEYED_LIST);
@@ -228,7 +231,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting a new unkeyed list item");
 
         startNode(name.getNodeType(), NodeTypes.UNKEYED_LIST_ITEM);
@@ -236,7 +239,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startMapNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting a new map node");
 
         startNode(name.getNodeType(), NodeTypes.MAP_NODE);
@@ -245,7 +248,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     @Override
     public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint)
             throws IOException {
-        Preconditions.checkNotNull(identifier, "Node identifier should not be null");
+        requireNonNull(identifier, "Node identifier should not be null");
         LOG.trace("Starting a new map entry node");
         startNode(identifier.getNodeType(), NodeTypes.MAP_ENTRY_NODE);
 
@@ -254,7 +257,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting a new ordered map node");
 
         startNode(name.getNodeType(), NodeTypes.ORDERED_MAP_NODE);
@@ -262,7 +265,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startChoiceNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting a new choice node");
 
         startNode(name.getNodeType(), NodeTypes.CHOICE_NODE);
@@ -270,7 +273,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startAugmentationNode(final AugmentationIdentifier identifier) throws IOException {
-        Preconditions.checkNotNull(identifier, "Node identifier should not be null");
+        requireNonNull(identifier, "Node identifier should not be null");
         LOG.trace("Starting a new augmentation node");
 
         output.writeByte(NodeTypes.AUGMENTATION_NODE);
@@ -279,7 +282,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     @Override
     public void startAnyxmlNode(final NodeIdentifier name) throws IOException {
-        Preconditions.checkNotNull(name, "Node identifier should not be null");
+        requireNonNull(name, "Node identifier should not be null");
         LOG.trace("Starting any xml node");
         startNode(name.getNodeType(), NodeTypes.ANY_XML_NODE);
         inSimple = true;
@@ -324,8 +327,8 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     private void startNode(final QName qname, final byte nodeType) throws IOException {
-        Preconditions.checkNotNull(qname, "QName of node identifier should not be null.");
-        Preconditions.checkState(!inSimple, "Attempted to start a child in a simple node");
+        requireNonNull(qname, "QName of node identifier should not be null.");
+        checkState(!inSimple, "Attempted to start a child in a simple node");
 
         ensureHeaderWritten();
 
@@ -338,9 +341,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     private void writeObjSet(final Set<?> set) throws IOException {
         output.writeInt(set.size());
         for (Object o : set) {
-            Preconditions.checkArgument(o instanceof String, "Expected value type to be String but was %s (%s)",
-                o.getClass(), o);
-
+            checkArgument(o instanceof String, "Expected value type to be String but was %s (%s)", o.getClass(), o);
             writeString((String) o);
         }
     }
index b136ed7..9df2fd4 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.messaging;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -26,7 +27,7 @@ class AbortSlicing implements Serializable {
     private final Identifier identifier;
 
     AbortSlicing(final Identifier identifier) {
-        this.identifier = Preconditions.checkNotNull(identifier);
+        this.identifier = requireNonNull(identifier);
     }
 
     Identifier getIdentifier() {
@@ -53,17 +54,17 @@ class AbortSlicing implements Serializable {
         public Proxy() {
         }
 
-        Proxy(AbortSlicing abortSlicing) {
+        Proxy(final AbortSlicing abortSlicing) {
             this.abortSlicing = abortSlicing;
         }
 
         @Override
-        public void writeExternal(ObjectOutput out) throws IOException {
+        public void writeExternal(final ObjectOutput out) throws IOException {
             out.writeObject(abortSlicing.identifier);
         }
 
         @Override
-        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
             abortSlicing = new AbortSlicing((Identifier) in.readObject());
         }
 
index ae711df..50e0460 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.messaging;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.serialization.JavaSerializer;
 import akka.serialization.Serialization;
-import com.google.common.base.Preconditions;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.Externalizable;
 import java.io.IOException;
@@ -34,14 +35,14 @@ public class MessageSlice implements Serializable {
     private final int lastSliceHashCode;
     private final ActorRef replyTo;
 
-    MessageSlice(Identifier identifier, byte[] data, int sliceIndex, int totalSlices, int lastSliceHashCode,
-            final ActorRef replyTo) {
-        this.identifier = Preconditions.checkNotNull(identifier);
-        this.data = Preconditions.checkNotNull(data);
+    MessageSlice(final Identifier identifier, final byte[] data, final int sliceIndex, final int totalSlices,
+            final int lastSliceHashCode, final ActorRef replyTo) {
+        this.identifier = requireNonNull(identifier);
+        this.data = requireNonNull(data);
         this.sliceIndex = sliceIndex;
         this.totalSlices = totalSlices;
         this.lastSliceHashCode = lastSliceHashCode;
-        this.replyTo = Preconditions.checkNotNull(replyTo);
+        this.replyTo = requireNonNull(replyTo);
     }
 
     public Identifier getIdentifier() {
@@ -93,12 +94,12 @@ public class MessageSlice implements Serializable {
         public Proxy() {
         }
 
-        Proxy(MessageSlice messageSlice) {
+        Proxy(final MessageSlice messageSlice) {
             this.messageSlice = messageSlice;
         }
 
         @Override
-        public void writeExternal(ObjectOutput out) throws IOException {
+        public void writeExternal(final ObjectOutput out) throws IOException {
             out.writeObject(messageSlice.identifier);
             out.writeInt(messageSlice.sliceIndex);
             out.writeInt(messageSlice.totalSlices);
@@ -108,7 +109,7 @@ public class MessageSlice implements Serializable {
         }
 
         @Override
-        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
             Identifier identifier = (Identifier) in.readObject();
             int sliceIndex = in.readInt();
             int totalSlices = in.readInt();
index f81cbb0..0cc3668 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.messaging;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -34,7 +35,7 @@ final class MessageSliceIdentifier implements Identifier {
     }
 
     private MessageSliceIdentifier(final Identifier clientIdentifier, final long slicerId, final long messageId) {
-        this.clientIdentifier = Preconditions.checkNotNull(clientIdentifier);
+        this.clientIdentifier = requireNonNull(clientIdentifier);
         this.messageId = messageId;
         this.slicerId = slicerId;
     }
@@ -58,7 +59,7 @@ final class MessageSliceIdentifier implements Identifier {
     }
 
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
@@ -93,18 +94,18 @@ final class MessageSliceIdentifier implements Identifier {
         public Proxy() {
         }
 
-        Proxy(MessageSliceIdentifier messageSliceId) {
+        Proxy(final MessageSliceIdentifier messageSliceId) {
             this.messageSliceId = messageSliceId;
         }
 
         @Override
-        public void writeExternal(ObjectOutput out) throws IOException {
+        public void writeExternal(final ObjectOutput out) throws IOException {
             out.writeObject(messageSliceId.clientIdentifier);
             WritableObjects.writeLongs(out, messageSliceId.slicerId, messageSliceId.messageId);
         }
 
         @Override
-        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
             final Identifier clientIdentifier = (Identifier) in.readObject();
             final byte header = WritableObjects.readLongHeader(in);
             final long slicerId =  WritableObjects.readFirstLong(in, header);
index bfcfded..e820c4b 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.messaging;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.serialization.JavaSerializer;
 import akka.serialization.Serialization;
-import com.google.common.base.Preconditions;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -34,9 +35,9 @@ public final class MessageSliceReply implements Serializable {
 
     private MessageSliceReply(final Identifier identifier, final int sliceIndex, final MessageSliceException failure,
             final ActorRef sendTo) {
-        this.identifier = Preconditions.checkNotNull(identifier);
+        this.identifier = requireNonNull(identifier);
         this.sliceIndex = sliceIndex;
-        this.sendTo = Preconditions.checkNotNull(sendTo);
+        this.sendTo = requireNonNull(sendTo);
         this.failure = failure;
     }
 
index 6bae647..9ba69fb 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.cluster.messaging;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
-import com.google.common.base.Preconditions;
 import java.io.Serializable;
 import java.util.function.Consumer;
 import org.opendaylight.controller.cluster.io.FileBackedOutputStream;
@@ -174,23 +176,23 @@ public final class SliceOptions {
         public SliceOptions build() {
             sealed = true;
 
-            Preconditions.checkNotNull(identifier, "identifier must be set");
-            Preconditions.checkNotNull(replyTo, "replyTo must be set");
-            Preconditions.checkNotNull(onFailureCallback, "onFailureCallback must be set");
-            Preconditions.checkState(fileBackedStream == null || message == null,
+            requireNonNull(identifier, "identifier must be set");
+            requireNonNull(replyTo, "replyTo must be set");
+            requireNonNull(onFailureCallback, "onFailureCallback must be set");
+            checkState(fileBackedStream == null || message == null,
                     "Only one of message and fileBackedStream can be set");
-            Preconditions.checkState(!(fileBackedStream == null && message == null),
+            checkState(!(fileBackedStream == null && message == null),
                     "One of message and fileBackedStream must be set");
-            Preconditions.checkState(sendToRef == null || sendToSelection == null,
+            checkState(sendToRef == null || sendToSelection == null,
                     "Only one of sendToRef and sendToSelection can be set");
-            Preconditions.checkState(!(sendToRef == null && sendToSelection == null),
+            checkState(!(sendToRef == null && sendToSelection == null),
                     "One of sendToRef and sendToSelection must be set");
 
             return new SliceOptions(this);
         }
 
         protected void checkSealed() {
-            Preconditions.checkState(!sealed, "Builder is already sealed - further modifications are not allowed");
+            checkState(!sealed, "Builder is already sealed - further modifications are not allowed");
         }
     }
 }
index 89f9dd1..bb4ad65 100644 (file)
@@ -5,14 +5,13 @@
  * 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.notifications;
 
 import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.serialization.Serialization;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
 import java.util.Map;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
 
@@ -26,11 +25,11 @@ import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
 public class RoleChangeNotifier extends AbstractUntypedActor implements AutoCloseable {
 
     private final String memberId;
-    private final Map<ActorPath, ActorRef> registeredListeners = Maps.newHashMap();
+    private final Map<ActorPath, ActorRef> registeredListeners = new HashMap<>();
     private RoleChangeNotification latestRoleChangeNotification = null;
     private LeaderStateChanged latestLeaderStateChanged;
 
-    public RoleChangeNotifier(String memberId) {
+    public RoleChangeNotifier(final String memberId) {
         this.memberId = memberId;
     }
 
@@ -46,7 +45,7 @@ public class RoleChangeNotifier extends AbstractUntypedActor implements AutoClos
     }
 
     @Override
-    protected void handleReceive(Object message) {
+    protected void handleReceive(final Object message) {
         if (message instanceof RegisterRoleChangeListener) {
             // register listeners for this shard
 
index bc393dd..38ef5d8 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.common.api.data;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.opendaylight.yangtools.concepts.Path;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
@@ -41,12 +42,12 @@ public class DataValidationFailedException extends TransactionCommitFailedExcept
                                                              final String message, final Throwable cause) {
         super(message, cause, RpcResultBuilder.newError(ErrorType.APPLICATION, "invalid-value", message, null,
                                                         path != null ? path.toString() : null, cause));
-        this.pathType = Preconditions.checkNotNull(pathType, "path type must not be null");
-        this.path = Preconditions.checkNotNull(path,"path must not be null.");
+        this.pathType = requireNonNull(pathType, "path type must not be null");
+        this.path = requireNonNull(path,"path must not be null.");
     }
 
-    public  <P extends Path<P>> DataValidationFailedException(final Class<P> pathType,final P path,
-                                                              final String message) {
+    public <P extends Path<P>> DataValidationFailedException(final Class<P> pathType,final P path,
+                                                             final String message) {
         this(pathType, path, message, null);
     }
 
index 1d661eb..2e66571 100644 (file)
@@ -5,11 +5,13 @@
  * 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.databroker;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.Futures;
 import java.util.ArrayList;
@@ -67,7 +69,7 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
             final Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory> storeTxFactories,
             final AbstractDOMTransactionFactory<?> commitImpl) {
         super(identifier, storeTxFactories);
-        this.commitImpl = Preconditions.checkNotNull(commitImpl, "commitImpl must not be null.");
+        this.commitImpl = requireNonNull(commitImpl, "commitImpl must not be null.");
     }
 
     @Override
@@ -80,10 +82,9 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
 
     private static void checkInstanceIdentifierReferencesData(final YangInstanceIdentifier path,
             final NormalizedNode<?, ?> data) {
-        Preconditions.checkArgument(data != null, "Attempted to store null data at %s", path);
+        checkArgument(data != null, "Attempted to store null data at %s", path);
         final PathArgument lastArg = path.getLastPathArgument();
-        Preconditions.checkArgument(
-                lastArg == data.getIdentifier() || lastArg != null && lastArg.equals(data.getIdentifier()),
+        checkArgument(lastArg == data.getIdentifier() || lastArg != null && lastArg.equals(data.getIdentifier()),
                 "Instance identifier references %s but data identifier is %s", lastArg, data);
     }
 
@@ -147,7 +148,7 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
     }
 
     private void checkRunning(final AbstractDOMTransactionFactory<?> impl) {
-        Preconditions.checkState(impl != null, "Transaction %s is no longer running", getIdentifier());
+        checkState(impl != null, "Transaction %s is no longer running", getIdentifier());
     }
 
     @Override
index ea6948f..9ee43f2 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.databroker;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreTransaction;
 
@@ -22,7 +23,7 @@ abstract class AbstractShardedTransaction implements DOMStoreTransaction {
     private final ClientTransaction tx;
 
     AbstractShardedTransaction(final ClientTransaction tx) {
-        this.tx = Preconditions.checkNotNull(tx);
+        this.tx = requireNonNull(tx);
     }
 
     @Override
index 1199fbf..cdcae3d 100644 (file)
@@ -7,12 +7,13 @@
  */
 package org.opendaylight.controller.cluster.databroker;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
 import static org.opendaylight.mdsal.dom.broker.TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER;
 import static org.opendaylight.mdsal.dom.broker.TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER;
 import static org.opendaylight.mdsal.dom.broker.TransactionCommitFailedExceptionMapper.PRE_COMMIT_MAPPER;
 
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.AbstractFuture;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
@@ -68,8 +69,8 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker {
     public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
             final Executor listenableFutureExecutor, final DurationStatisticsTracker commitStatsTracker) {
         super(datastores);
-        this.clientFutureCallbackExecutor = Preconditions.checkNotNull(listenableFutureExecutor);
-        this.commitStatsTracker = Preconditions.checkNotNull(commitStatsTracker);
+        this.clientFutureCallbackExecutor = requireNonNull(listenableFutureExecutor);
+        this.commitStatsTracker = requireNonNull(commitStatsTracker);
     }
 
     public DurationStatisticsTracker getCommitStatsTracker() {
@@ -77,11 +78,11 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker {
     }
 
     @Override
-    protected FluentFuture<? extends CommitInfo> commit(
-            final DOMDataTreeWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
+    protected FluentFuture<? extends CommitInfo> commit(final DOMDataTreeWriteTransaction transaction,
+            final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
 
-        Preconditions.checkArgument(transaction != null, "Transaction must not be null.");
-        Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
+        checkArgument(transaction != null, "Transaction must not be null.");
+        checkArgument(cohorts != null, "Cohorts must not be null.");
         LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier());
 
         if (cohorts.isEmpty()) {
@@ -262,7 +263,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker {
         private final Executor listenerExecutor;
 
         AsyncNotifyingSettableFuture(final Executor listenerExecutor) {
-            this.listenerExecutor = Preconditions.checkNotNull(listenerExecutor);
+            this.listenerExecutor = requireNonNull(listenerExecutor);
         }
 
         @Override
@@ -303,8 +304,8 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker {
             private final Executor executor;
 
             DelegatingRunnable(final Runnable delegate, final Executor executor) {
-                this.delegate = Preconditions.checkNotNull(delegate);
-                this.executor = Preconditions.checkNotNull(executor);
+                this.delegate = requireNonNull(delegate);
+                this.executor = requireNonNull(executor);
             }
 
             @Override
index 1f1ea7f..537aa46 100644 (file)
@@ -8,7 +8,9 @@
 
 package org.opendaylight.controller.cluster.databroker;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -65,12 +67,12 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
             final AbstractDOMBroker broker, final DOMTransactionChainListener listener) {
         super(chains);
         this.chainId = chainId;
-        this.broker = Preconditions.checkNotNull(broker);
-        this.listener = Preconditions.checkNotNull(listener);
+        this.broker = requireNonNull(broker);
+        this.listener = requireNonNull(listener);
     }
 
     private void checkNotFailed() {
-        Preconditions.checkState(state != State.FAILED, "Transaction chain has failed");
+        checkState(state != State.FAILED, "Transaction chain has failed");
     }
 
     @Override
index 5111a32..4f19381 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.databroker;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
@@ -23,7 +24,7 @@ final class DOMStoreThreePhaseCommitCohortAdaptor extends ForwardingObject imple
 
     DOMStoreThreePhaseCommitCohortAdaptor(
         final org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort delegate) {
-        this.delegate = Preconditions.checkNotNull(delegate);
+        this.delegate = requireNonNull(delegate);
     }
 
     @Override
index 80fbf03..1246c2f 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -49,8 +51,8 @@ public abstract class AbstractClientHandle<T extends AbstractProxyTransaction> e
 
     // Hidden to prevent outside instantiation
     AbstractClientHandle(final AbstractClientHistory parent, final TransactionIdentifier transactionId) {
-        this.transactionId = Preconditions.checkNotNull(transactionId);
-        this.parent = Preconditions.checkNotNull(parent);
+        this.transactionId = requireNonNull(transactionId);
+        this.parent = requireNonNull(parent);
     }
 
     @Override
@@ -114,7 +116,7 @@ public abstract class AbstractClientHandle<T extends AbstractProxyTransaction> e
 
     private State<T> getState() {
         final State<T> local = state;
-        Preconditions.checkState(local != null, "Transaction %s is closed", transactionId);
+        checkState(local != null, "Transaction %s is closed", transactionId);
         return local;
     }
 
index 789309c..b2f66d5 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
@@ -28,8 +29,8 @@ abstract class AbstractTransactionCommitCohort implements DOMStoreThreePhaseComm
     private final TransactionIdentifier txId;
 
     AbstractTransactionCommitCohort(final AbstractClientHistory parent, final TransactionIdentifier txId) {
-        this.parent = Preconditions.checkNotNull(parent);
-        this.txId = Preconditions.checkNotNull(txId);
+        this.parent = requireNonNull(parent);
+        this.txId = requireNonNull(txId);
     }
 
     final void complete() {
index 26e346e..52bf1d9 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Maps;
 import java.util.Collection;
@@ -46,7 +47,7 @@ final class BouncingReconnectForwarder extends ReconnectForwarder {
     private BouncingReconnectForwarder(final ConnectedClientConnection<?> successor,
             final Map<LocalHistoryIdentifier, ProxyReconnectCohort> cohorts) {
         super(successor);
-        this.cohorts = Preconditions.checkNotNull(cohorts);
+        this.cohorts = requireNonNull(cohorts);
     }
 
     static ReconnectForwarder forCohorts(final ConnectedClientConnection<?> successor,
index 41d2cb8..933d4bb 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import java.util.Arrays;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -24,7 +26,7 @@ final class ClientTransactionCursor implements DOMDataTreeWriteCursor {
     private final ClientTransaction parent;
 
     ClientTransactionCursor(final ClientTransaction parent) {
-        this.parent = Preconditions.checkNotNull(parent);
+        this.parent = requireNonNull(parent);
     }
 
     @Override
@@ -45,7 +47,7 @@ final class ClientTransactionCursor implements DOMDataTreeWriteCursor {
     @Override
     public void exit() {
         final YangInstanceIdentifier currentParent = current.getParent();
-        Preconditions.checkState(currentParent != null);
+        checkState(currentParent != null);
         current = currentParent;
     }
 
index 1d5d4a7..9b21b98 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 
@@ -23,7 +24,7 @@ final class DirectTransactionCommitCohort extends AbstractTransactionCommitCohor
     DirectTransactionCommitCohort(final AbstractClientHistory parent, final TransactionIdentifier txId,
         final AbstractProxyTransaction proxy) {
         super(parent, txId);
-        this.proxy = Preconditions.checkNotNull(proxy);
+        this.proxy = requireNonNull(proxy);
     }
 
     @Override
index db91424..7d9d74d 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
 
 /**
  * Request the ClientIdentifier from a particular actor. Response is an instance of {@link DataStoreClient}.
@@ -19,7 +20,7 @@ final class GetClientRequest {
     private final ActorRef replyTo;
 
     GetClientRequest(final ActorRef replyTo) {
-        this.replyTo = Preconditions.checkNotNull(replyTo);
+        this.replyTo = requireNonNull(replyTo);
     }
 
     ActorRef getReplyTo() {
index 143cc8b..6edbf6c 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.cluster.databroker.actors.dds;
 
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Optional;
 import java.util.function.Consumer;
@@ -109,7 +108,7 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction {
             final Optional<NormalizedNode<?, ?>> result = readOnlyView().readNode(path);
             if (callback != null) {
                 // XXX: FB does not see that callback is final, on stack and has be check for non-null.
-                final Consumer<Response<?, ?>> fbIsStupid = Preconditions.checkNotNull(callback);
+                final Consumer<Response<?, ?>> fbIsStupid = requireNonNull(callback);
                 executeInActor(() -> fbIsStupid.accept(new ReadTransactionSuccess(request.getTarget(),
                     request.getSequence(), result)));
             }
@@ -119,7 +118,7 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction {
             final boolean result = readOnlyView().readNode(path).isPresent();
             if (callback != null) {
                 // XXX: FB does not see that callback is final, on stack and has be check for non-null.
-                final Consumer<Response<?, ?>> fbIsStupid = Preconditions.checkNotNull(callback);
+                final Consumer<Response<?, ?>> fbIsStupid = requireNonNull(callback);
                 executeInActor(() -> fbIsStupid.accept(new ExistsTransactionSuccess(request.getTarget(),
                     request.getSequence(), result)));
             }
index e136d50..01fc35c 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Range;
 import com.google.common.collect.RangeSet;
@@ -60,10 +61,10 @@ abstract class AbstractFrontendHistory implements Identifiable<LocalHistoryIdent
 
     AbstractFrontendHistory(final String persistenceId, final ShardDataTree tree,
         final Map<UnsignedLong, Boolean> closedTransactions, final RangeSet<UnsignedLong> purgedTransactions) {
-        this.persistenceId = Preconditions.checkNotNull(persistenceId);
-        this.tree = Preconditions.checkNotNull(tree);
-        this.closedTransactions = Preconditions.checkNotNull(closedTransactions);
-        this.purgedTransactions = Preconditions.checkNotNull(purgedTransactions);
+        this.persistenceId = requireNonNull(persistenceId);
+        this.tree = requireNonNull(tree);
+        this.closedTransactions = requireNonNull(closedTransactions);
+        this.purgedTransactions = requireNonNull(purgedTransactions);
     }
 
     final String persistenceId() {
index 9412d47..bec1a38 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.persisted.AbortTransactionPayload;
 import org.opendaylight.yangtools.concepts.Identifiable;
@@ -29,9 +31,9 @@ abstract class AbstractShardDataTreeTransaction<T extends DataTreeSnapshot>
 
     AbstractShardDataTreeTransaction(final ShardDataTreeTransactionParent parent, final TransactionIdentifier id,
         final T snapshot) {
-        this.parent = Preconditions.checkNotNull(parent);
-        this.snapshot = Preconditions.checkNotNull(snapshot);
-        this.id = Preconditions.checkNotNull(id);
+        this.parent = requireNonNull(parent);
+        this.snapshot = requireNonNull(snapshot);
+        this.id = requireNonNull(id);
     }
 
     @Override
@@ -66,7 +68,7 @@ abstract class AbstractShardDataTreeTransaction<T extends DataTreeSnapshot>
     }
 
     final void abort(final Runnable callback) {
-        Preconditions.checkState(close(), "Transaction is already closed");
+        checkState(close(), "Transaction is already closed");
         parent.abortTransaction(this, callback);
     }
 
index 2cb4dee..1f87fd4 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.primitives.UnsignedLong;
 import com.google.common.util.concurrent.FutureCallback;
 import java.util.Optional;
@@ -27,9 +28,9 @@ final class ChainedCommitCohort extends ShardDataTreeCohort {
 
     ChainedCommitCohort(final ShardDataTreeTransactionChain chain, final ReadWriteShardDataTreeTransaction transaction,
             final ShardDataTreeCohort delegate) {
-        this.transaction = Preconditions.checkNotNull(transaction);
-        this.delegate = Preconditions.checkNotNull(delegate);
-        this.chain = Preconditions.checkNotNull(chain);
+        this.transaction = requireNonNull(transaction);
+        this.delegate = requireNonNull(delegate);
+        this.chain = requireNonNull(chain);
     }
 
     @Override
index 38d23f6..be162d9 100644 (file)
@@ -5,15 +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;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.cluster.Cluster;
 import akka.cluster.ClusterEvent;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 
 public class ClusterWrapperImpl implements ClusterWrapper {
@@ -21,12 +22,10 @@ public class ClusterWrapperImpl implements ClusterWrapper {
     private final MemberName currentMemberName;
     private final Address selfAddress;
 
-    public ClusterWrapperImpl(ActorSystem actorSystem) {
-        Preconditions.checkNotNull(actorSystem, "actorSystem should not be null");
+    public ClusterWrapperImpl(final ActorSystem actorSystem) {
+        cluster = Cluster.get(requireNonNull(actorSystem, "actorSystem should not be null"));
 
-        cluster = Cluster.get(actorSystem);
-
-        Preconditions.checkState(cluster.getSelfRoles().size() > 0,
+        checkState(cluster.getSelfRoles().size() > 0,
             "No akka roles were specified.\n"
             + "One way to specify the member name is to pass a property on the command line like so\n"
             + "   -Dakka.cluster.roles.0=member-3\n"
@@ -37,10 +36,8 @@ public class ClusterWrapperImpl implements ClusterWrapper {
     }
 
     @Override
-    public void subscribeToMemberEvents(ActorRef actorRef) {
-        Preconditions.checkNotNull(actorRef, "actorRef should not be null");
-
-        cluster.subscribe(actorRef, ClusterEvent.initialStateAsEvents(),
+    public void subscribeToMemberEvents(final ActorRef actorRef) {
+        cluster.subscribe(requireNonNull(actorRef, "actorRef should not be null"), ClusterEvent.initialStateAsEvents(),
             ClusterEvent.MemberEvent.class,
             ClusterEvent.UnreachableMember.class,
             ClusterEvent.ReachableMember.class);
index 80ba952..6c0c13b 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
 import com.google.common.primitives.UnsignedLong;
 import com.google.common.util.concurrent.FutureCallback;
 import java.util.List;
@@ -35,13 +37,13 @@ final class CohortEntry {
 
     private CohortEntry(final ReadWriteShardDataTreeTransaction transaction, final short clientVersion) {
         this.cohort = null;
-        this.transaction = Preconditions.checkNotNull(transaction);
+        this.transaction = requireNonNull(transaction);
         this.transactionId = transaction.getIdentifier();
         this.clientVersion = clientVersion;
     }
 
     private CohortEntry(final ShardDataTreeCohort cohort, final short clientVersion) {
-        this.cohort = Preconditions.checkNotNull(cohort);
+        this.cohort = requireNonNull(cohort);
         this.transactionId = cohort.getIdentifier();
         this.transaction = null;
         this.clientVersion = clientVersion;
@@ -120,7 +122,7 @@ final class CohortEntry {
     }
 
     void ready(final Optional<SortedSet<String>> participatingShardNames, final CohortDecorator cohortDecorator) {
-        Preconditions.checkState(cohort == null, "cohort was already set");
+        checkState(cohort == null, "cohort was already set");
 
         cohort = transaction.ready(participatingShardNames);
 
index 5e1add1..9a238e9 100644 (file)
@@ -5,9 +5,11 @@
  * 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;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.Status;
 import akka.actor.Status.Failure;
@@ -17,7 +19,6 @@ import akka.dispatch.OnComplete;
 import akka.dispatch.Recover;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.AbstractMap.SimpleImmutableEntry;
@@ -109,11 +110,11 @@ class CompositeDataTreeCohort {
 
     CompositeDataTreeCohort(final DataTreeCohortActorRegistry registry, final TransactionIdentifier transactionID,
         final SchemaContext schema, final Executor callbackExecutor, final Timeout timeout) {
-        this.registry = Preconditions.checkNotNull(registry);
-        this.txId = Preconditions.checkNotNull(transactionID);
-        this.schema = Preconditions.checkNotNull(schema);
-        this.callbackExecutor = Preconditions.checkNotNull(callbackExecutor);
-        this.timeout = Preconditions.checkNotNull(timeout);
+        this.registry = requireNonNull(registry);
+        this.txId = requireNonNull(transactionID);
+        this.schema = requireNonNull(schema);
+        this.callbackExecutor = requireNonNull(callbackExecutor);
+        this.timeout = requireNonNull(timeout);
     }
 
     void reset() {
@@ -282,7 +283,7 @@ class CompositeDataTreeCohort {
     }
 
     void changeStateFrom(final State expected, final State followup) {
-        Preconditions.checkState(state == expected);
+        checkState(state == expected);
         state = followup;
     }
 }
index 7e79c3e..a8a0124 100644 (file)
@@ -5,11 +5,11 @@
  * 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;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCandidate;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
@@ -19,9 +19,9 @@ final class DOMDataTreeCandidateTO implements DOMDataTreeCandidate {
     private final DOMDataTreeIdentifier rootPath;
     private final DataTreeCandidateNode rootNode;
 
-    private DOMDataTreeCandidateTO(DOMDataTreeIdentifier rootPath, DataTreeCandidateNode rootNode) {
-        this.rootPath = Preconditions.checkNotNull(rootPath);
-        this.rootNode = Preconditions.checkNotNull(rootNode);
+    private DOMDataTreeCandidateTO(final DOMDataTreeIdentifier rootPath, final DataTreeCandidateNode rootNode) {
+        this.rootPath = requireNonNull(rootPath);
+        this.rootNode = requireNonNull(rootNode);
     }
 
     @Override
@@ -34,7 +34,7 @@ final class DOMDataTreeCandidateTO implements DOMDataTreeCandidate {
         return rootNode;
     }
 
-    static DOMDataTreeCandidate create(DOMDataTreeIdentifier path, DataTreeCandidateNode node) {
+    static DOMDataTreeCandidate create(final DOMDataTreeIdentifier path, final DataTreeCandidateNode node) {
         return new DOMDataTreeCandidateTO(path, node);
     }
 
index c72de94..8df53b2 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.Props;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChangedReply;
@@ -32,8 +33,8 @@ final class DataTreeChangeListenerActor extends AbstractUntypedActor {
 
     private DataTreeChangeListenerActor(final DOMDataTreeChangeListener listener,
             final YangInstanceIdentifier registeredPath) {
-        this.listener = Preconditions.checkNotNull(listener);
-        this.registeredPath = Preconditions.checkNotNull(registeredPath);
+        this.listener = requireNonNull(listener);
+        this.registeredPath = requireNonNull(registeredPath);
     }
 
     @Override
index 2859671..3ff6a9f 100644 (file)
@@ -5,14 +5,14 @@
  * 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;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.PoisonPill;
 import akka.actor.Status;
 import akka.util.Timeout;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Multimap;
 import java.util.ArrayList;
@@ -97,11 +97,10 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
     }
 
     abstract static class CohortRegistryCommand {
-
         private final ActorRef cohort;
 
         CohortRegistryCommand(final ActorRef cohort) {
-            this.cohort = Preconditions.checkNotNull(cohort);
+            this.cohort = requireNonNull(cohort);
         }
 
         ActorRef getCohort() {
@@ -110,40 +109,34 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree<ActorRef> {
     }
 
     static class RegisterCohort extends CohortRegistryCommand {
-
         private final DOMDataTreeIdentifier path;
 
         RegisterCohort(final DOMDataTreeIdentifier path, final ActorRef cohort) {
             super(cohort);
             this.path = path;
-
         }
 
         public DOMDataTreeIdentifier getPath() {
             return path;
         }
-
     }
 
     static class RemoveCohort extends CohortRegistryCommand {
-
         RemoveCohort(final ActorRef cohort) {
             super(cohort);
         }
-
     }
 
     private static class CanCommitMessageBuilder {
-
+        private final Multimap<ActorRef, DOMDataTreeCandidate> actorToCandidates = ArrayListMultimap.create();
         private final TransactionIdentifier txId;
         private final DataTreeCandidate candidate;
         private final SchemaContext schema;
-        private final Multimap<ActorRef, DOMDataTreeCandidate> actorToCandidates = ArrayListMultimap.create();
 
         CanCommitMessageBuilder(final TransactionIdentifier txId, final DataTreeCandidate candidate,
                 final SchemaContext schema) {
-            this.txId = Preconditions.checkNotNull(txId);
-            this.candidate = Preconditions.checkNotNull(candidate);
+            this.txId = requireNonNull(txId);
+            this.candidate = requireNonNull(candidate);
             this.schema = schema;
         }
 
index 1a46e3d..7d3d1b1 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import akka.util.Timeout;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
@@ -280,8 +282,7 @@ public class DatastoreContext implements ClientActorConfig {
     }
 
     private void setSnapshotDataThresholdPercentage(final int shardSnapshotDataThresholdPercentage) {
-        Preconditions.checkArgument(shardSnapshotDataThresholdPercentage >= 0
-                && shardSnapshotDataThresholdPercentage <= 100);
+        checkArgument(shardSnapshotDataThresholdPercentage >= 0 && shardSnapshotDataThresholdPercentage <= 100);
         raftConfig.setSnapshotDataThresholdPercentage(shardSnapshotDataThresholdPercentage);
     }
 
@@ -491,7 +492,7 @@ public class DatastoreContext implements ClientActorConfig {
         }
 
         public Builder logicalStoreType(final LogicalDatastoreType logicalStoreType) {
-            datastoreContext.logicalStoreType = Preconditions.checkNotNull(logicalStoreType);
+            datastoreContext.logicalStoreType = requireNonNull(logicalStoreType);
 
             // Retain compatible naming
             switch (logicalStoreType) {
@@ -514,7 +515,7 @@ public class DatastoreContext implements ClientActorConfig {
         }
 
         public Builder dataStoreName(final String dataStoreName) {
-            datastoreContext.dataStoreName = Preconditions.checkNotNull(dataStoreName);
+            datastoreContext.dataStoreName = requireNonNull(dataStoreName);
             datastoreContext.dataStoreMXBeanType = "Distributed" + WordUtils.capitalize(dataStoreName) + "Datastore";
             return this;
         }
index db9acae..995401c 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -41,7 +42,7 @@ public final class DatastoreSnapshotRestore {
     }
 
     private DatastoreSnapshotRestore(final String restoreDirectoryPath) {
-        this.restoreDirectoryPath = Preconditions.checkNotNull(restoreDirectoryPath);
+        this.restoreDirectoryPath = requireNonNull(restoreDirectoryPath);
     }
 
     // synchronize this method so that, in case of concurrent access to getAndRemove(),
index 9f9d169..afb5773 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -38,9 +39,9 @@ class DebugThreePhaseCommitCohort extends AbstractThreePhaseCommitCohort<Object>
 
     DebugThreePhaseCommitCohort(final TransactionIdentifier transactionId,
             final AbstractThreePhaseCommitCohort<?> delegate, final Throwable debugContext) {
-        this.delegate = Preconditions.checkNotNull(delegate);
-        this.debugContext = Preconditions.checkNotNull(debugContext);
-        this.transactionId = Preconditions.checkNotNull(transactionId);
+        this.delegate = requireNonNull(delegate);
+        this.debugContext = requireNonNull(debugContext);
+        this.transactionId = requireNonNull(transactionId);
     }
 
     private <V> ListenableFuture<V> addFutureCallback(final ListenableFuture<V> future) {
index 4142760..73b5623 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
-import com.google.common.base.Preconditions;
 import java.util.Collection;
 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
 import org.opendaylight.controller.cluster.datastore.messages.OnInitialData;
@@ -29,11 +30,11 @@ final class ForwardingDataTreeChangeListener implements DOMDataTreeChangeListene
     private final ActorSelection actor;
 
     ForwardingDataTreeChangeListener(final ActorSelection actor) {
-        this.actor = Preconditions.checkNotNull(actor, "actor should not be null");
+        this.actor = requireNonNull(actor, "actor should not be null");
     }
 
     @Override
-    public void onDataTreeChanged(Collection<DataTreeCandidate> changes) {
+    public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
         LOG.debug("Sending DataTreeChanged to {}", actor);
         actor.tell(new DataTreeChanged(changes), ActorRef.noSender());
     }
index db0fcf5..eedabdd 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.Range;
 import com.google.common.collect.RangeSet;
 import com.google.common.collect.TreeRangeSet;
@@ -32,7 +34,7 @@ final class FrontendHistoryMetadataBuilder implements Builder<FrontendHistoryMet
     private boolean closed;
 
     FrontendHistoryMetadataBuilder(final LocalHistoryIdentifier identifier) {
-        this.identifier = Preconditions.checkNotNull(identifier);
+        this.identifier = requireNonNull(identifier);
         this.purgedTransactions = TreeRangeSet.create();
         this.closedTransactions = new HashMap<>(2);
     }
@@ -56,7 +58,7 @@ final class FrontendHistoryMetadataBuilder implements Builder<FrontendHistoryMet
     }
 
     void onHistoryClosed() {
-        Preconditions.checkState(identifier.getHistoryId() != 0);
+        checkState(identifier.getHistoryId() != 0);
         closed = true;
     }
 
index efb0fdc..0bf23e7 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Maps;
 import java.util.HashMap;
@@ -38,7 +38,7 @@ final class FrontendMetadata extends ShardDataTreeMetadata<FrontendShardDataTree
     private final String shardName;
 
     FrontendMetadata(final String shardName) {
-        this.shardName = Preconditions.checkNotNull(shardName);
+        this.shardName = requireNonNull(shardName);
     }
 
     @Override
index 6bfd280..de46d9d 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Verify;
 import java.util.ArrayDeque;
 import java.util.Optional;
@@ -51,8 +52,8 @@ abstract class FrontendTransaction implements Identifiable<TransactionIdentifier
     private RequestException previousFailure;
 
     FrontendTransaction(final AbstractFrontendHistory history, final TransactionIdentifier id) {
-        this.history = Preconditions.checkNotNull(history);
-        this.id = Preconditions.checkNotNull(id);
+        this.history = requireNonNull(history);
+        this.id = requireNonNull(id);
     }
 
     @Override
index b6fb127..af57577 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.Props;
-import com.google.common.base.Preconditions;
 
 /**
  * Base class for factories instantiating delegates which are local to the
@@ -24,7 +25,7 @@ abstract class LeaderLocalDelegateFactory<M> {
     private final Shard shard;
 
     protected LeaderLocalDelegateFactory(final Shard shard) {
-        this.shard = Preconditions.checkNotNull(shard);
+        this.shard = requireNonNull(shard);
     }
 
     protected final ActorRef getSelf() {
@@ -47,11 +48,11 @@ abstract class LeaderLocalDelegateFactory<M> {
         return shard.getContext().actorOf(props);
     }
 
-    protected final ActorSelection selectActor(ActorRef ref) {
+    protected final ActorSelection selectActor(final ActorRef ref) {
         return shard.getContext().system().actorSelection(ref.path());
     }
 
-    protected final ActorSelection selectActor(ActorPath path) {
+    protected final ActorSelection selectActor(final ActorPath path) {
         return shard.getContext().system().actorSelection(path);
     }
 
index 17e861a..b723903 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.RangeSet;
 import com.google.common.collect.TreeRangeSet;
@@ -20,7 +21,6 @@ import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifie
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
-
 /**
  * Chained transaction specialization of {@link AbstractFrontendHistory}. It prevents concurrent open transactions.
  *
@@ -33,7 +33,7 @@ final class LocalFrontendHistory extends AbstractFrontendHistory {
             final ShardDataTreeTransactionChain chain, final Map<UnsignedLong, Boolean> closedTransactions,
             final RangeSet<UnsignedLong> purgedTransactions) {
         super(persistenceId, tree, closedTransactions, purgedTransactions);
-        this.chain = Preconditions.checkNotNull(chain);
+        this.chain = requireNonNull(chain);
     }
 
     static LocalFrontendHistory create(final String persistenceId, final ShardDataTree tree,
index da6d6d1..fdba29c 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorSelection;
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -38,7 +39,7 @@ abstract class LocalTransactionContext extends AbstractTransactionContext {
     LocalTransactionContext(final DOMStoreTransaction txDelegate, final TransactionIdentifier identifier,
             final LocalTransactionReadySupport readySupport) {
         super(identifier);
-        this.txDelegate = Preconditions.checkNotNull(txDelegate);
+        this.txDelegate = requireNonNull(txDelegate);
         this.readySupport = readySupport;
     }
 
index e1fee6d..3f0c98c 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
@@ -26,12 +28,12 @@ public class OperationLimiter  {
     private final int maxPermits;
 
     OperationLimiter(final TransactionIdentifier identifier, final int maxPermits, final long acquireTimeoutSeconds) {
-        this.identifier = Preconditions.checkNotNull(identifier);
+        this.identifier = requireNonNull(identifier);
 
-        Preconditions.checkArgument(acquireTimeoutSeconds >= 0);
+        checkArgument(acquireTimeoutSeconds >= 0);
         this.acquireTimeout = TimeUnit.SECONDS.toNanos(acquireTimeoutSeconds);
 
-        Preconditions.checkArgument(maxPermits >= 0);
+        checkArgument(maxPermits >= 0);
         this.maxPermits = maxPermits;
         this.semaphore = new Semaphore(maxPermits);
     }
@@ -60,7 +62,7 @@ public class OperationLimiter  {
         release(1);
     }
 
-    void release(int permits) {
+    void release(final int permits) {
         this.semaphore.release(permits);
     }
 
index a93d46f..7be7239 100644 (file)
@@ -8,11 +8,12 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorSelection;
 import akka.dispatch.OnComplete;
 import akka.pattern.AskTimeoutException;
 import akka.util.Timeout;
-import com.google.common.base.Preconditions;
 import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.exceptions.NoShardLeaderException;
@@ -61,7 +62,7 @@ final class RemoteTransactionContextSupport {
 
     RemoteTransactionContextSupport(final TransactionContextWrapper transactionContextWrapper,
             final TransactionProxy parent, final String shardName) {
-        this.parent = Preconditions.checkNotNull(parent);
+        this.parent = requireNonNull(parent);
         this.shardName = shardName;
         this.transactionContextWrapper = transactionContextWrapper;
 
index a7b89e1..f634aec 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkState;
 import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
@@ -19,7 +21,6 @@ import akka.actor.Status.Failure;
 import akka.serialization.JavaSerializer;
 import akka.serialization.Serialization;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Ticker;
 import com.google.common.base.Verify;
 import com.google.common.collect.ImmutableList;
@@ -1101,7 +1102,7 @@ public class Shard extends RaftActor {
         }
 
         protected void checkSealed() {
-            Preconditions.checkState(!sealed, "Builder isalready sealed - further modifications are not allowed");
+            checkState(!sealed, "Builder isalready sealed - further modifications are not allowed");
         }
 
         @SuppressWarnings("unchecked")
@@ -1129,7 +1130,7 @@ public class Shard extends RaftActor {
 
         public T schemaContextProvider(final SchemaContextProvider newSchemaContextProvider) {
             checkSealed();
-            this.schemaContextProvider = Preconditions.checkNotNull(newSchemaContextProvider);
+            this.schemaContextProvider = requireNonNull(newSchemaContextProvider);
             return self();
         }
 
@@ -1182,10 +1183,10 @@ public class Shard extends RaftActor {
         }
 
         protected void verify() {
-            Preconditions.checkNotNull(id, "id should not be null");
-            Preconditions.checkNotNull(peerAddresses, "peerAddresses should not be null");
-            Preconditions.checkNotNull(datastoreContext, "dataStoreContext should not be null");
-            Preconditions.checkNotNull(schemaContextProvider, "schemaContextProvider should not be null");
+            requireNonNull(id, "id should not be null");
+            requireNonNull(peerAddresses, "peerAddresses should not be null");
+            requireNonNull(datastoreContext, "dataStoreContext should not be null");
+            requireNonNull(schemaContextProvider, "schemaContextProvider should not be null");
         }
 
         public Props props() {
index ad99fce..d9520c5 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.Status.Failure;
 import akka.serialization.Serialization;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.primitives.UnsignedLong;
 import com.google.common.util.concurrent.FutureCallback;
 import java.util.ArrayDeque;
@@ -70,7 +71,7 @@ final class ShardCommitCoordinator {
     ShardCommitCoordinator(final ShardDataTree dataTree, final Logger log, final String name) {
         this.log = log;
         this.name = name;
-        this.dataTree = Preconditions.checkNotNull(dataTree);
+        this.dataTree = requireNonNull(dataTree);
     }
 
     int getCohortCacheSize() {
index 6e4ee7d..221ff9c 100644 (file)
@@ -7,13 +7,16 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Verify.verify;
+import static com.google.common.base.Verify.verifyNotNull;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.util.Timeout;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Stopwatch;
-import com.google.common.base.Verify;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
@@ -99,7 +102,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         long lastAccess;
 
         CommitEntry(final SimpleShardDataTreeCohort cohort, final long now) {
-            this.cohort = Preconditions.checkNotNull(cohort);
+            this.cohort = requireNonNull(cohort);
             lastAccess = now;
         }
 
@@ -155,12 +158,12 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
             final ShardDataTreeChangeListenerPublisher treeChangeListenerPublisher,
             final String logContext,
             final ShardDataTreeMetadata<?>... metadata) {
-        this.dataTree = Preconditions.checkNotNull(dataTree);
+        this.dataTree = requireNonNull(dataTree);
         updateSchemaContext(schemaContext);
 
-        this.shard = Preconditions.checkNotNull(shard);
-        this.treeChangeListenerPublisher = Preconditions.checkNotNull(treeChangeListenerPublisher);
-        this.logContext = Preconditions.checkNotNull(logContext);
+        this.shard = requireNonNull(shard);
+        this.treeChangeListenerPublisher = requireNonNull(treeChangeListenerPublisher);
+        this.logContext = requireNonNull(logContext);
         this.metadata = ImmutableList.copyOf(metadata);
         tip = dataTree;
     }
@@ -206,7 +209,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
 
     void updateSchemaContext(final SchemaContext newSchemaContext) {
         dataTree.setSchemaContext(newSchemaContext);
-        this.schemaContext = Preconditions.checkNotNull(newSchemaContext);
+        this.schemaContext = requireNonNull(newSchemaContext);
         this.dataSchemaContext = DataSchemaContextTree.from(newSchemaContext);
     }
 
@@ -411,7 +414,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
                         ((CommitTransactionPayload) payload).getCandidate();
                 applyReplicatedCandidate(e.getKey(), e.getValue());
             } else {
-                Verify.verify(identifier instanceof TransactionIdentifier);
+                verify(identifier instanceof TransactionIdentifier);
                 payloadReplicationComplete((TransactionIdentifier) identifier);
             }
         } else if (payload instanceof AbortTransactionPayload) {
@@ -527,8 +530,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
             final boolean closed) {
         final ShardDataTreeTransactionChain ret = new ShardDataTreeTransactionChain(historyId, this);
         final ShardDataTreeTransactionChain existing = transactionChains.putIfAbsent(historyId, ret);
-        Preconditions.checkState(existing == null, "Attempted to recreate chain %s, but %s already exists", historyId,
-                existing);
+        checkState(existing == null, "Attempted to recreate chain %s, but %s already exists", historyId, existing);
         return ret;
     }
 
@@ -930,10 +932,10 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     @SuppressWarnings("checkstyle:IllegalCatch")
     void startPreCommit(final SimpleShardDataTreeCohort cohort) {
         final CommitEntry entry = pendingTransactions.peek();
-        Preconditions.checkState(entry != null, "Attempted to pre-commit of %s when no transactions pending", cohort);
+        checkState(entry != null, "Attempted to pre-commit of %s when no transactions pending", cohort);
 
         final SimpleShardDataTreeCohort current = entry.cohort;
-        Verify.verify(cohort.equals(current), "Attempted to pre-commit %s while %s is pending", cohort, current);
+        verify(cohort.equals(current), "Attempted to pre-commit %s while %s is pending", cohort, current);
 
         final TransactionIdentifier currentId = current.getIdentifier();
         LOG.debug("{}: Preparing transaction {}", logContext, currentId);
@@ -951,7 +953,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
             @Override
             public void onSuccess(final Void noop) {
                 // Set the tip of the data tree.
-                tip = Verify.verifyNotNull(candidate);
+                tip = verifyNotNull(candidate);
 
                 entry.lastAccess = readTime();
 
@@ -1013,7 +1015,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
 
     void startCommit(final SimpleShardDataTreeCohort cohort, final DataTreeCandidate candidate) {
         final CommitEntry entry = pendingCommits.peek();
-        Preconditions.checkState(entry != null, "Attempted to start commit of %s when no transactions pending", cohort);
+        checkState(entry != null, "Attempted to start commit of %s when no transactions pending", cohort);
 
         final SimpleShardDataTreeCohort current = entry.cohort;
         if (!cohort.equals(current)) {
@@ -1253,7 +1255,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
 
     @SuppressWarnings("checkstyle:IllegalCatch")
     private void rebaseTransactions(final Iterator<CommitEntry> iter, final @NonNull DataTreeTip newTip) {
-        tip = Preconditions.checkNotNull(newTip);
+        tip = requireNonNull(newTip);
         while (iter.hasNext()) {
             final SimpleShardDataTreeCohort cohort = iter.next().cohort;
             if (cohort.getState() == State.CAN_COMMIT_COMPLETE) {
index 9406eab..7917ae0 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.util.Optional;
 import java.util.SortedSet;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
@@ -34,13 +36,13 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
     private boolean closed;
 
     ShardDataTreeTransactionChain(final LocalHistoryIdentifier localHistoryIdentifier, final ShardDataTree dataTree) {
-        this.chainId = Preconditions.checkNotNull(localHistoryIdentifier);
-        this.dataTree = Preconditions.checkNotNull(dataTree);
+        this.chainId = requireNonNull(localHistoryIdentifier);
+        this.dataTree = requireNonNull(dataTree);
     }
 
     private DataTreeSnapshot getSnapshot() {
-        Preconditions.checkState(!closed, "TransactionChain %s has been closed", this);
-        Preconditions.checkState(openTransaction == null, "Transaction %s is open", openTransaction);
+        checkState(!closed, "TransactionChain %s has been closed", this);
+        checkState(openTransaction == null, "Transaction %s is open", openTransaction);
 
         if (previousTx == null) {
             LOG.debug("Opening an unchained snapshot in {}", chainId);
@@ -74,8 +76,8 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
     @Override
     void abortFromTransactionActor(final AbstractShardDataTreeTransaction<?> transaction) {
         if (transaction instanceof ReadWriteShardDataTreeTransaction) {
-            Preconditions.checkState(openTransaction != null,
-                    "Attempted to abort transaction %s while none is outstanding", transaction);
+            checkState(openTransaction != null, "Attempted to abort transaction %s while none is outstanding",
+                    transaction);
             LOG.debug("Aborted open transaction {}", transaction);
             openTransaction = null;
         }
@@ -90,8 +92,8 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
     @Override
     ShardDataTreeCohort finishTransaction(final ReadWriteShardDataTreeTransaction transaction,
             final Optional<SortedSet<String>> participatingShardNames) {
-        Preconditions.checkState(openTransaction != null,
-                "Attempted to finish transaction %s while none is outstanding", transaction);
+        checkState(openTransaction != null, "Attempted to finish transaction %s while none is outstanding",
+                transaction);
 
         // dataTree is finalizing ready the transaction, we just record it for the next
         // transaction in chain
index fc3bfda..3b0105b 100644 (file)
@@ -5,11 +5,11 @@
  * 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;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
 import org.opendaylight.controller.cluster.datastore.messages.DataExists;
 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
@@ -22,14 +22,14 @@ import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 public class ShardReadTransaction extends ShardTransaction {
     private final AbstractShardDataTreeTransaction<?> transaction;
 
-    public ShardReadTransaction(AbstractShardDataTreeTransaction<?> transaction, ActorRef shardActor,
-            ShardStats shardStats) {
+    public ShardReadTransaction(final AbstractShardDataTreeTransaction<?> transaction, final ActorRef shardActor,
+            final ShardStats shardStats) {
         super(shardActor, shardStats, transaction.getIdentifier());
-        this.transaction = Preconditions.checkNotNull(transaction);
+        this.transaction = requireNonNull(transaction);
     }
 
     @Override
-    public void handleReceive(Object message) {
+    public void handleReceive(final Object message) {
         if (ReadData.isSerializedType(message)) {
             readData(transaction, ReadData.fromSerializable(message));
         } else if (DataExists.isSerializedType(message)) {
index 7ece110..aeaad48 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import java.io.File;
 import org.opendaylight.controller.cluster.datastore.persisted.ShardDataTreeSnapshot;
 import org.opendaylight.controller.cluster.datastore.persisted.ShardSnapshotState;
@@ -44,7 +46,7 @@ abstract class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
 
         WithSnapshot(final ShardDataTree store, final String shardName, final Logger log, final Snapshot snapshot) {
             super(store, shardName, log);
-            this.restoreFromSnapshot = Preconditions.checkNotNull(snapshot);
+            this.restoreFromSnapshot = requireNonNull(snapshot);
         }
 
         @Override
@@ -60,9 +62,9 @@ abstract class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
     private boolean open;
 
     ShardRecoveryCoordinator(final ShardDataTree store, final String shardName, final Logger log) {
-        this.store = Preconditions.checkNotNull(store);
-        this.shardName = Preconditions.checkNotNull(shardName);
-        this.log = Preconditions.checkNotNull(log);
+        this.store = requireNonNull(store);
+        this.shardName = requireNonNull(shardName);
+        this.log = requireNonNull(log);
     }
 
     static ShardRecoveryCoordinator create(final ShardDataTree store, final String shardName, final Logger log) {
@@ -83,7 +85,7 @@ abstract class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
     @Override
     @SuppressWarnings("checkstyle:IllegalCatch")
     public void appendRecoveredLogEntry(final Payload payload) {
-        Preconditions.checkState(open, "call startLogRecovery before calling appendRecoveredLogEntry");
+        checkState(open, "call startLogRecovery before calling appendRecoveredLogEntry");
 
         try {
             store.applyRecoveryPayload(payload);
@@ -99,7 +101,7 @@ abstract class ShardRecoveryCoordinator implements RaftActorRecoveryCohort {
      */
     @Override
     public void applyCurrentLogRecoveryBatch() {
-        Preconditions.checkState(open, "call startLogRecovery before calling applyCurrentLogRecoveryBatch");
+        checkState(open, "call startLogRecovery before calling applyCurrentLogRecoveryBatch");
         open = false;
     }
 
index e936d43..126e28d 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorContext;
 import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
 import com.google.common.io.ByteSource;
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -43,8 +44,8 @@ final class ShardSnapshotCohort implements RaftActorSnapshotCohort {
 
     private ShardSnapshotCohort(final LocalHistoryIdentifier applyHistoryId, final ActorRef snapshotActor,
             final ShardDataTree store, final Logger log, final String logId) {
-        this.snapshotActor = Preconditions.checkNotNull(snapshotActor);
-        this.store = Preconditions.checkNotNull(store);
+        this.snapshotActor = requireNonNull(snapshotActor);
+        this.store = requireNonNull(store);
         this.log = log;
         this.logId = logId;
     }
index 87dd5e3..9742640 100644 (file)
@@ -5,15 +5,15 @@
  * 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;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.PoisonPill;
 import akka.actor.Props;
 import akka.actor.ReceiveTimeout;
 import akka.japi.Creator;
-import com.google.common.base.Preconditions;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActorWithMetering;
@@ -41,7 +41,7 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         super("shard-tx");
         this.shardActor = shardActor;
         this.shardStats = shardStats;
-        this.transactionId = Preconditions.checkNotNull(transactionId);
+        this.transactionId = requireNonNull(transactionId);
     }
 
     public static Props props(final TransactionType type, final AbstractShardDataTreeTransaction<?> transaction,
@@ -130,7 +130,7 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
 
         ShardTransactionCreator(final TransactionType type, final AbstractShardDataTreeTransaction<?> transaction,
                 final ActorRef shardActor, final DatastoreContext datastoreContext, final ShardStats shardStats) {
-            this.transaction = Preconditions.checkNotNull(transaction);
+            this.transaction = requireNonNull(transaction);
             this.shardActor = shardActor;
             this.shardStats = shardStats;
             this.datastoreContext = datastoreContext;
index 9505894..a96be9f 100644 (file)
@@ -13,7 +13,6 @@ import static java.util.Objects.requireNonNull;
 import akka.actor.ActorSelection;
 import akka.dispatch.OnComplete;
 import com.google.common.base.Supplier;
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -213,7 +212,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
     }
 
     private Future<Iterable<Object>> invokeCohorts(final MessageSupplier messageSupplier) {
-        List<Future<Object>> futureList = Lists.newArrayListWithCapacity(cohorts.size());
+        List<Future<Object>> futureList = new ArrayList<>(cohorts.size());
         for (CohortInfo cohort : cohorts) {
             Object message = messageSupplier.newMessage(transactionId, cohort.getActorVersion());
 
index c3b81d7..7c36adb 100644 (file)
@@ -7,10 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorSelection;
 import akka.dispatch.Futures;
 import akka.dispatch.OnComplete;
-import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -61,7 +63,7 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
 
         Pending(final TransactionIdentifier transaction, final Future<?> previousFuture) {
             this.previousFuture = previousFuture;
-            this.transaction = Preconditions.checkNotNull(transaction);
+            this.transaction = requireNonNull(transaction);
         }
 
         @Override
@@ -292,11 +294,11 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
     protected <T> void onTransactionReady(final TransactionIdentifier transaction,
             final Collection<Future<T>> cohortFutures) {
         final State localState = currentState;
-        Preconditions.checkState(localState instanceof Allocated, "Readying transaction %s while state is %s",
-                transaction, localState);
+        checkState(localState instanceof Allocated, "Readying transaction %s while state is %s", transaction,
+            localState);
         final TransactionIdentifier currentTx = ((Allocated)localState).getIdentifier();
-        Preconditions.checkState(transaction.equals(currentTx), "Readying transaction %s while %s is allocated",
-                transaction, currentTx);
+        checkState(transaction.equals(currentTx), "Readying transaction %s while %s is allocated", transaction,
+            currentTx);
 
         // Transaction ready and we are not waiting for futures -- go to idle
         if (cohortFutures.isEmpty()) {
@@ -322,7 +324,7 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
     }
 
     @Override
-    protected void onTransactionContextCreated(TransactionIdentifier transactionId) {
+    protected void onTransactionContextCreated(final TransactionIdentifier transactionId) {
         Promise<Object> promise = priorReadOnlyTxPromises.remove(transactionId);
         if (promise != null) {
             promise.success(null);