2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.plugins.context.locking.curator;
23 import org.onap.policy.apex.context.parameters.LockManagerParameters;
26 * Bean class for Curator locking parameters.
28 * @author Liam Fallon (liam.fallon@ericsson.com)
30 public class CuratorLockManagerParameters extends LockManagerParameters {
32 /** The default address used to connect to the Zookeeper server. */
33 public static final String DEFAULT_ZOOKEEPER_ADDRESS = "localhost:2181";
35 /** The default sleep time to use when connecting to the Zookeeper server. */
36 public static final int DEFAULT_ZOOKEEPER_CONNECT_SLEEP_TIME = 1000;
38 /** The default number of times to retry failed connections to the Zookeeper server. */
39 public static final int DEFAULT_ZOOKEEPER_CONNECT_RETRIES = 3;
42 private String zookeeperAddress = DEFAULT_ZOOKEEPER_ADDRESS;
43 private int zookeeperConnectSleepTime = DEFAULT_ZOOKEEPER_CONNECT_SLEEP_TIME;
44 private int zookeeperContextRetries = DEFAULT_ZOOKEEPER_CONNECT_RETRIES;
50 public CuratorLockManagerParameters() {
55 * Gets the zookeeper address.
57 * @return the zookeeper address
59 public String getZookeeperAddress() {
60 return zookeeperAddress;
64 * Sets the zookeeper address.
66 * @param zookeeperAddress the zookeeper address
68 public void setZookeeperAddress(final String zookeeperAddress) {
69 this.zookeeperAddress = zookeeperAddress;
73 * Gets the zookeeper connect sleep time.
75 * @return the zookeeper connect sleep time
77 public int getZookeeperConnectSleepTime() {
78 return zookeeperConnectSleepTime;
82 * Sets the zookeeper connect sleep time.
84 * @param zookeeperConnectSleepTime the zookeeper connect sleep time
86 public void setZookeeperConnectSleepTime(final int zookeeperConnectSleepTime) {
87 this.zookeeperConnectSleepTime = zookeeperConnectSleepTime;
91 * Gets the zookeeper context retries.
93 * @return the zookeeper context retries
95 public int getZookeeperContextRetries() {
96 return zookeeperContextRetries;
100 * Sets the zookeeper context retries.
102 * @param zookeeperContextRetries the zookeeper context retries
104 public void setZookeeperContextRetries(final int zookeeperContextRetries) {
105 this.zookeeperContextRetries = zookeeperContextRetries;
111 * @see org.onap.policy.apex.context.parameters.LockManagerParameters#toString()
114 public String toString() {
115 return "CuratorLockManagerParameters [zookeeperAddress=" + zookeeperAddress + ", zookeeperConnectSleepTime="
116 + zookeeperConnectSleepTime + ", zookeeperContextRetries=" + zookeeperContextRetries + "]";