2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.policy.controlloop.actorserviceprovider.impl;
 
  24 import java.util.concurrent.Executor;
 
  26 import org.onap.policy.controlloop.actorserviceprovider.Operator;
 
  29  * Partial implementation of an operator.
 
  31 public abstract class OperatorPartial extends StartConfigPartial<Map<String, Object>> implements Operator {
 
  34      * Executor to be used for tasks that may perform blocking I/O. The default executor
 
  35      * simply launches a new thread for each command that is submitted to it.
 
  37      * The "get" method may be overridden by junit tests.
 
  40     private final Executor blockingExecutor = command -> {
 
  41         Thread thread = new Thread(command);
 
  42         thread.setDaemon(true);
 
  47     private final String actorName;
 
  50     private final String name;
 
  53      * Constructs the object.
 
  55      * @param actorName name of the actor with which this operator is associated
 
  56      * @param name operation name
 
  58     public OperatorPartial(String actorName, String name) {
 
  59         super(actorName + "." + name);
 
  60         this.actorName = actorName;
 
  65      * This method does nothing.
 
  68     protected void doConfigure(Map<String, Object> parameters) {
 
  73      * This method does nothing.
 
  76     protected void doStart() {
 
  81      * This method does nothing.
 
  84     protected void doStop() {
 
  89      * This method does nothing.
 
  92     protected void doShutdown() {