summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-02-25 18:33:47 -0500
committerJim Hahn <jrh3@att.com>2020-02-25 18:36:19 -0500
commitfba31123336fabe30c0cd57c9b230f7b02ee76aa (patch)
tree6b599247ade0c98e5a880229380304ad91a5a31c /models-interactions/model-actors/actorServiceProvider/src
parent5ba32a480a3b898bdfae9ed87dfbbc75fa7bd7e1 (diff)
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 <jrh3@att.com> Change-Id: Ia4ff758f71f8bbe014ae5b1a58d8439c0d4ea2ed
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src')
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java18
1 files 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.
+ * <p/>
+ * 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":
+ * <ul>
+ * <li>start callback</li>
+ * <li>completion callback</li>
+ * <li>controller completion (i.e., delayedComplete())</li>
+ * </ul>
*/
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<OperationOutcome> anyOf(
- List<Supplier<CompletableFuture<OperationOutcome>>> futureMakers) {
+ public CompletableFuture<OperationOutcome> anyOf(List<Supplier<CompletableFuture<OperationOutcome>>> futureMakers) {
PipelineControllerFuture<OperationOutcome> 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<OperationOutcome> allOf(
- List<Supplier<CompletableFuture<OperationOutcome>>> futureMakers) {
+ public CompletableFuture<OperationOutcome> allOf(List<Supplier<CompletableFuture<OperationOutcome>>> futureMakers) {
PipelineControllerFuture<OperationOutcome> controller = new PipelineControllerFuture<>();
Queue<OperationOutcome> 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
};
}