summaryrefslogtreecommitdiffstats
path: root/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java
diff options
context:
space:
mode:
Diffstat (limited to 'common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java')
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java59
1 files changed, 29 insertions, 30 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java
index 39ef8555ad..e8711f4d12 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,8 +28,9 @@ public class Timeouts {
private int connectPoolTimeoutMs = DEFAULT_TIMEOUT_MS;
public static final Timeouts DEFAULT;
+
static {
- DEFAULT = new Timeouts();
+ DEFAULT = new Timeouts();
}
private Timeouts() {
@@ -49,30 +50,30 @@ public class Timeouts {
public int getConnectTimeoutMs() {
return connectTimeoutMs;
}
-
+
public void setConnectTimeoutMs(int connectTimeoutMs) {
validate(connectTimeoutMs);
this.connectTimeoutMs = connectTimeoutMs;
}
-
+
public int getReadTimeoutMs() {
return readTimeoutMs;
}
-
+
public void setReadTimeoutMs(int readTimeoutMs) {
validate(readTimeoutMs);
this.readTimeoutMs = readTimeoutMs;
}
-
+
public int getConnectPoolTimeoutMs() {
return connectPoolTimeoutMs;
}
-
+
public void setConnectPoolTimeoutMs(int connectPoolTimeoutMs) {
validate(connectPoolTimeoutMs);
this.connectPoolTimeoutMs = connectPoolTimeoutMs;
}
-
+
@Override
public int hashCode() {
final int prime = 31;
@@ -82,40 +83,38 @@ public class Timeouts {
result = prime * result + readTimeoutMs;
return result;
}
-
+
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
Timeouts other = (Timeouts) obj;
- if (connectPoolTimeoutMs != other.connectPoolTimeoutMs)
- return false;
- if (connectTimeoutMs != other.connectTimeoutMs)
+ if (connectPoolTimeoutMs != other.connectPoolTimeoutMs) {
return false;
- if (readTimeoutMs != other.readTimeoutMs)
+ }
+ if (connectTimeoutMs != other.connectTimeoutMs) {
return false;
- return true;
+ }
+ return readTimeoutMs == other.readTimeoutMs;
}
-
+
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("Timeouts [connectTimeoutMs=");
- builder.append(connectTimeoutMs);
- builder.append(", readTimeoutMs=");
- builder.append(readTimeoutMs);
- builder.append(", connectPoolTimeoutMs=");
- builder.append(connectPoolTimeoutMs);
- builder.append("]");
- return builder.toString();
+ return "Timeouts [connectTimeoutMs=" + connectTimeoutMs
+ + ", readTimeoutMs=" + readTimeoutMs
+ + ", connectPoolTimeoutMs=" + connectPoolTimeoutMs
+ + "]";
}
-
+
private void validate(int timeout) {
- if(timeout <= 0) {
+ if (timeout <= 0) {
throw new IllegalArgumentException("Timeout values cannot be less than zero");
}
}