X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-interactions%2Fmodel-actors%2FactorServiceProvider%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontrolloop%2Factorserviceprovider%2Fimpl%2FOperationPartial.java;h=c19ad6c319c9d5de425b1f2b710430ec14d0ab6f;hb=49f07db935d114b72a44e446867b16262dd552aa;hp=7ad0cd82eef5a892409340d8b5a4549618d67b63;hpb=b7097d21c25a48c9d209548ac8afdc09b1679457;p=policy%2Fmodels.git diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java index 7ad0cd82e..c19ad6c31 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -165,7 +165,7 @@ public abstract class OperationPartial implements Operation { * @return the property value */ @SuppressWarnings("unchecked") - protected T getRequiredProperty(String name, String propertyType) { + public T getRequiredProperty(String name, String propertyType) { T value = (T) properties.get(name); if (value == null) { throw new IllegalStateException("missing " + propertyType); @@ -217,7 +217,6 @@ public abstract class OperationPartial implements Operation { /** * Starts the operation attempt, without doing any retries. * - * @param params operation parameters * @param attempt attempt number, typically starting with 1 * @return a future that will return the result of a single operation attempt */ @@ -225,9 +224,9 @@ public abstract class OperationPartial implements Operation { logger.info("{}: start operation attempt {} for {}", getFullName(), attempt, params.getRequestId()); - final Executor executor = params.getExecutor(); - final OperationOutcome outcome = makeOutcome(); - final CallbackManager callbacks = new CallbackManager(); + final var executor = params.getExecutor(); + final var outcome = makeOutcome(); + final var callbacks = new CallbackManager(); // this operation attempt gets its own controller final PipelineControllerFuture controller = new PipelineControllerFuture<>(); @@ -382,7 +381,7 @@ public abstract class OperationPartial implements Operation { } else { /* - * retries were specified and we've already tried them all - change to + * retries were specified, and we've already tried them all - change to * FAILURE_RETRIES */ logger.info("operation {} retries exhausted for {}", getFullName(), params.getRequestId()); @@ -594,14 +593,13 @@ public abstract class OperationPartial implements Operation { * @return an array of futures, possibly zero-length. If the array is of size one, * then that one item should be returned instead of the controller */ + @SuppressWarnings("unchecked") private CompletableFuture[] attachFutures(PipelineControllerFuture controller, List>> futureMakers, UnaryOperator> adorn) { if (futureMakers.isEmpty()) { - @SuppressWarnings("unchecked") - CompletableFuture[] result = new CompletableFuture[0]; - return result; + return new CompletableFuture[0]; } // the last, unadorned future that is created @@ -631,8 +629,7 @@ public abstract class OperationPartial implements Operation { } } - @SuppressWarnings("unchecked") - CompletableFuture[] result = new CompletableFuture[futures.size()]; + var result = new CompletableFuture[futures.size()]; if (result.length == 1) { // special case - return the unadorned future @@ -747,7 +744,7 @@ public abstract class OperationPartial implements Operation { * executing */ final PipelineControllerFuture controller = new PipelineControllerFuture<>(); - final Executor executor = params.getExecutor(); + final var executor = params.getExecutor(); // @formatter:off controller.wrap(nextTask) @@ -830,7 +827,7 @@ public abstract class OperationPartial implements Operation { outcome.setEnd(null); // pass a copy to the callback - OperationOutcome outcome2 = new OperationOutcome(outcome); + var outcome2 = new OperationOutcome(outcome); outcome2.setFinalOutcome(false); params.callbackStarted(outcome2); }