2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 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 java.util.Properties;
24 import org.onap.policy.common.utils.properties.SpecPropertyConfiguration;
25 import org.onap.policy.common.utils.properties.exception.PropertyException;
28 * Properties used by the pooling feature, specific to a controller.
30 public class PoolingProperties extends SpecPropertyConfiguration {
33 * Feature properties all begin with this prefix.
35 public static final String PREFIX = "pooling.";
38 * These properties REQUIRE a controller name, thus they use the "{$}" form.
40 public static final String POOLING_TOPIC = PREFIX + "{$}.topic";
43 * These properties allow the controller name to be left out, thus they use
44 * the "{prefix?suffix}" form.
46 public static final String FEATURE_ENABLED = PREFIX + "{?.}enabled";
47 public static final String OFFLINE_LIMIT = PREFIX + "{?.}offline.queue.limit";
48 public static final String OFFLINE_AGE_MS = PREFIX + "{?.}offline.queue.age.milliseconds";
49 public static final String START_HEARTBEAT_MS = PREFIX + "{?.}start.heartbeat.milliseconds";
50 public static final String REACTIVATE_MS = PREFIX + "{?.}reactivate.milliseconds";
51 public static final String IDENTIFICATION_MS = PREFIX + "{?.}identification.milliseconds";
52 public static final String ACTIVE_HEARTBEAT_MS = PREFIX + "{?.}active.heartbeat.milliseconds";
53 public static final String INTER_HEARTBEAT_MS = PREFIX + "{?.}inter.heartbeat.milliseconds";
56 * Properties from which this was constructed.
58 private Properties source;
61 * Topic used for inter-host communication.
63 @Property(name = POOLING_TOPIC)
64 private String poolingTopic;
67 * Maximum number of events to retain in the queue while waiting for
68 * buckets to be assigned.
70 @Property(name = OFFLINE_LIMIT, defaultValue = "1000")
71 private int offlineLimit;
74 * Maximum age, in milliseconds, of events to be retained in the queue.
75 * Events older than this are discarded.
77 @Property(name = OFFLINE_AGE_MS, defaultValue = "60000")
78 private long offlineAgeMs;
81 * Time, in milliseconds, to wait for this host's heart beat during the
84 @Property(name = START_HEARTBEAT_MS, defaultValue = "50000")
85 private long startHeartbeatMs;
88 * Time, in milliseconds, to wait before attempting to re-active this
89 * host when it has no bucket assignments.
91 @Property(name = REACTIVATE_MS, defaultValue = "50000")
92 private long reactivateMs;
95 * Time, in milliseconds, to wait for all Identification messages to
96 * arrive during the query state.
98 @Property(name = IDENTIFICATION_MS, defaultValue = "50000")
99 private long identificationMs;
102 * Time, in milliseconds, to wait for heart beats from this host, or its
103 * predecessor, during the active state.
105 @Property(name = ACTIVE_HEARTBEAT_MS, defaultValue = "50000")
106 private long activeHeartbeatMs;
109 * Time, in milliseconds, to wait between heart beat generations during
112 @Property(name = INTER_HEARTBEAT_MS, defaultValue = "15000")
113 private long interHeartbeatMs;
116 * @param controllerName the name of the controller
117 * @param props set of properties used to configure this
118 * @throws PropertyException if an error occurs
121 public PoolingProperties(String controllerName, Properties props) throws PropertyException {
122 super(controllerName, props);
127 public Properties getSource() {
131 public String getPoolingTopic() {
135 public int getOfflineLimit() {
139 public long getOfflineAgeMs() {
143 public long getStartHeartbeatMs() {
144 return startHeartbeatMs;
147 public long getReactivateMs() {
151 public long getIdentificationMs() {
152 return identificationMs;
155 public long getActiveHeartbeatMs() {
156 return activeHeartbeatMs;
159 public long getInterHeartbeatMs() {
160 return interHeartbeatMs;