2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018-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.drools.pooling;
23 import org.onap.policy.drools.pooling.message.BucketAssignments;
24 import org.onap.policy.drools.pooling.message.Message;
25 import org.onap.policy.drools.pooling.state.State;
26 import org.onap.policy.drools.pooling.state.StateTimerTask;
29 * Pooling manager for a single PolicyController.
31 public interface PoolingManager {
34 * Gets the properties used to configure the manager.
36 * @return pooling properties
38 PoolingProperties getProperties();
48 * Gets the name of the internal DMaaP topic used by this manager to communicate with
51 * @return the name of the internal DMaaP topic
56 * Starts distributing requests according to the given bucket assignments.
58 * @param assignments must <i>not</i> be {@code null}
60 void startDistributing(BucketAssignments assignments);
63 * Gets the current bucket assignments.
65 * @return the current bucket assignments, or {@code null} if no assignments have been
68 BucketAssignments getAssignments();
71 * Publishes a message to the internal topic on the administrative channel.
73 * @param msg message to be published
75 void publishAdmin(Message msg);
78 * Publishes a message to the internal topic on a particular channel.
80 * @param channel channel on which the message should be published
81 * @param msg message to be published
83 void publish(String channel, Message msg);
86 * Schedules a timer to fire after a delay.
88 * @param delayMs delay, in milliseconds
90 * @return a new scheduled task
92 CancellableScheduledTask schedule(long delayMs, StateTimerTask task);
95 * Schedules a timer to fire repeatedly.
97 * @param initialDelayMs initial delay, in milliseconds
98 * @param delayMs delay, in milliseconds
100 * @return a new scheduled task
102 CancellableScheduledTask scheduleWithFixedDelay(long initialDelayMs, long delayMs, StateTimerTask task);
105 * Transitions to the "start" state.
107 * @return the new state
112 * Transitions to the "query" state.
114 * @return the new state
119 * Transitions to the "active" state.
121 * @return the new state
126 * Transitions to the "inactive" state.
128 * @return the new state