Fix CS warnings in cds-access-client and enable enforcement
[controller.git] / opendaylight / md-sal / cds-access-client / src / main / java / org / opendaylight / controller / cluster / access / client / ClientActorBehavior.java
index 3cdda596ade0739a679add4b55c1ade989d3aec3..43b621c05c15105939bec26fc921274114e87108 100644 (file)
@@ -34,12 +34,13 @@ public abstract class ClientActorBehavior extends RecoveredClientActorBehavior<C
         implements Identifiable<ClientIdentifier> {
     private static final Logger LOG = LoggerFactory.getLogger(ClientActorBehavior.class);
 
-    protected ClientActorBehavior(final @Nonnull ClientActorContext context) {
+    protected ClientActorBehavior(@Nonnull final ClientActorContext context) {
         super(context);
     }
 
     @Override
-    public final @Nonnull ClientIdentifier getIdentifier() {
+    @Nonnull
+    public final ClientIdentifier getIdentifier() {
         return context().getIdentifier();
     }
 
@@ -83,13 +84,12 @@ public abstract class ClientActorBehavior extends RecoveredClientActorBehavior<C
     }
 
     // This method is executing in the actor context, hence we can safely interact with the queue
-    private ClientActorBehavior doSendRequest(final long sequence, final TransactionRequest<?> request,
-            final RequestCallback callback) {
+    private ClientActorBehavior doSendRequest(final TransactionRequest<?> request, final RequestCallback callback) {
         // Get or allocate queue for the request
         final SequencedQueue queue = context().queueFor(request.getTarget().getHistoryId().getCookie());
 
         // Note this is a tri-state return and can be null
-        final Optional<FiniteDuration> result = queue.enqueueRequest(sequence, request, callback);
+        final Optional<FiniteDuration> result = queue.enqueueRequest(request, callback);
         if (result == null) {
             // Happy path: we are done here
             return this;
@@ -146,6 +146,7 @@ public abstract class ClientActorBehavior extends RecoveredClientActorBehavior<C
             needBackend = queue.runTimeout();
         } catch (NoProgressException e) {
             // Uh-oh, no progress. The queue has already killed itself, now we need to remove it
+            LOG.debug("{}: No progress made - removing queue", persistenceId(), e);
             context().removeQueue(queue);
             return this;
         }
@@ -158,10 +159,9 @@ public abstract class ClientActorBehavior extends RecoveredClientActorBehavior<C
     }
 
     /**
-     * Halt And Catch Fire.
-     *
-     * Halt processing on this client. Implementations need to ensure they initiate state flush procedures. No attempt
-     * to use this instance should be made after this method returns. Any such use may result in undefined behavior.
+     * Halt And Catch Fire. Halt processing on this client. Implementations need to ensure they initiate state flush
+     * procedures. No attempt to use this instance should be made after this method returns. Any such use may result
+     * in undefined behavior.
      *
      * @param cause Failure cause
      */
@@ -170,17 +170,19 @@ public abstract class ClientActorBehavior extends RecoveredClientActorBehavior<C
     /**
      * Override this method to handle any command which is not handled by the base behavior.
      *
-     * @param command
+     * @param command the command to process
      * @return Next behavior to use, null if this actor should shut down.
      */
-    protected abstract @Nullable ClientActorBehavior onCommand(@Nonnull Object command);
+    @Nullable
+    protected abstract ClientActorBehavior onCommand(@Nonnull Object command);
 
     /**
      * Override this method to provide a backend resolver instance.
      *
-     * @return
+     * @return a backend resolver instance
      */
-    protected abstract @Nonnull BackendInfoResolver<?> resolver();
+    @Nonnull
+    protected abstract BackendInfoResolver<?> resolver();
 
     /**
      * Send a request to the backend and invoke a specified callback when it finishes. This method is safe to invoke
@@ -189,7 +191,7 @@ public abstract class ClientActorBehavior extends RecoveredClientActorBehavior<C
      * @param request Request to send
      * @param callback Callback to invoke
      */
-    public final void sendRequest(final long sequence, final TransactionRequest<?> request, final RequestCallback callback) {
-        context().executeInActor(cb -> cb.doSendRequest(sequence, request, callback));
+    public final void sendRequest(final TransactionRequest<?> request, final RequestCallback callback) {
+        context().executeInActor(cb -> cb.doSendRequest(request, callback));
     }
 }