From fba31123336fabe30c0cd57c9b230f7b02ee76aa Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 25 Feb 2020 18:33:47 -0500 Subject: [PATCH] Eliminate a couple more xxxAsync calls in Actors Eliminated a few more xxxAsync calls in Actors. Now, the remaining xxxAsync calls are necessary so that the callbacks are executed using the executor specified via the "params". Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn Change-Id: Ia4ff758f71f8bbe014ae5b1a58d8439c0d4ea2ed --- .../actorserviceprovider/impl/OperationPartial.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 ff1b46264..24c7ec866 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 @@ -68,6 +68,14 @@ import org.slf4j.LoggerFactory; * returned by overridden methods will do the same. Of course, if a class overrides * {@link #doOperation(int, OperationOutcome) doOperation()}, then there's little that can * be done to cancel that particular operation. + *

+ * In general tasks in a pipeline are executed by the same thread. However, the following + * should always be executed via the executor specified in "params": + *

*/ public abstract class OperationPartial implements Operation { private static final Logger logger = LoggerFactory.getLogger(OperationPartial.class); @@ -558,8 +566,7 @@ public abstract class OperationPartial implements Operation { * canceled. Similarly, when this future completes, any incomplete futures * will be canceled */ - public CompletableFuture anyOf( - List>> futureMakers) { + public CompletableFuture anyOf(List>> futureMakers) { PipelineControllerFuture controller = new PipelineControllerFuture<>(); @@ -610,8 +617,7 @@ public abstract class OperationPartial implements Operation { * canceled. Similarly, when this future completes, any incomplete futures * will be canceled */ - public CompletableFuture allOf( - List>> futureMakers) { + public CompletableFuture allOf(List>> futureMakers) { PipelineControllerFuture controller = new PipelineControllerFuture<>(); Queue outcomes = new LinkedList<>(); @@ -809,7 +815,7 @@ public abstract class OperationPartial implements Operation { // @formatter:off controller.wrap(nextTask) - .thenComposeAsync(nextTaskOnSuccess(controller, queue), executor) + .thenCompose(nextTaskOnSuccess(controller, queue)) .whenCompleteAsync(controller.delayedComplete(), executor); // @formatter:on @@ -843,7 +849,7 @@ public abstract class OperationPartial implements Operation { // @formatter:off return controller .wrap(nextTask) - .thenComposeAsync(nextTaskOnSuccess(controller, taskQueue), params.getExecutor()); + .thenCompose(nextTaskOnSuccess(controller, taskQueue)); // @formatter:on }; } -- 2.16.6