Skip to content

Commit f18e66a

Browse files
author
shabtaisharon
authored
Merge pull request #310 from RachelTucker/clarify_units
Clarify units in client building
2 parents 4ea2806 + d67babe commit f18e66a

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

ds3-sdk/src/main/java/com/spectralogic/ds3client/ConnectionDetailsImpl.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ static class Builder implements com.spectralogic.ds3client.utils.Builder<Connect
3333
private boolean https = false;
3434
private URI proxy = null;
3535
private int retries = 5;
36-
private int bufferSize = 1024 * 1024;
37-
private int connectionTimeout = 5 * 1000;
38-
private int socketTimeout = 60 * 60 * 1000;
36+
private int bufferSizeInBytes = 1024 * 1024;
37+
private int connectionTimeoutInMillis = 5 * 1000;
38+
private int socketTimeoutInMillis = 60 * 60 * 1000;
3939
private boolean certificateVerification;
4040

4141
private Builder(final String endpoint, final Credentials credentials) {
@@ -58,13 +58,13 @@ public Builder withRedirectRetries(final int retries) {
5858
return this;
5959
}
6060

61-
public Builder withBufferSize(final int bufferSize) {
62-
this.bufferSize = bufferSize;
61+
public Builder withBufferSize(final int bufferSizeInBytes) {
62+
this.bufferSizeInBytes = bufferSizeInBytes;
6363
return this;
6464
}
6565

66-
public Builder withConnectionTimeout(final int connectionTimeout) {
67-
this.connectionTimeout = connectionTimeout;
66+
public Builder withConnectionTimeout(final int connectionTimeoutInMillis) {
67+
this.connectionTimeoutInMillis = connectionTimeoutInMillis;
6868
return this;
6969
}
7070

@@ -73,8 +73,8 @@ public Builder withCertificateVerification(final boolean certificateVerification
7373
return this;
7474
}
7575

76-
public Builder withSocketTimeout(final int socketTimeout) {
77-
this.socketTimeout = socketTimeout;
76+
public Builder withSocketTimeout(final int socketTimeoutInMillis) {
77+
this.socketTimeoutInMillis = socketTimeoutInMillis;
7878
return this;
7979
}
8080

@@ -115,9 +115,9 @@ private static String buildAuthority(final JobNode node, final ConnectionDetails
115115
private final boolean https;
116116
private final URI proxy;
117117
private final int retries;
118-
private final int bufferSize;
119-
private final int connectionTimeout;
120-
private final int socketTimeout;
118+
private final int bufferSizeInBytes;
119+
private final int connectionTimeoutInMillis;
120+
private final int socketTimeoutInMillis;
121121
private final boolean certificateVerification;
122122

123123
static Builder builder(final String uriEndpoint, final Credentials credentials) {
@@ -130,10 +130,10 @@ private ConnectionDetailsImpl(final Builder builder) {
130130
this.https = builder.https;
131131
this.proxy = builder.proxy;
132132
this.retries = builder.retries;
133-
this.bufferSize = builder.bufferSize;
134-
this.connectionTimeout = builder.connectionTimeout;
133+
this.bufferSizeInBytes = builder.bufferSizeInBytes;
134+
this.connectionTimeoutInMillis = builder.connectionTimeoutInMillis;
135135
this.certificateVerification = builder.certificateVerification;
136-
this.socketTimeout = builder.socketTimeout;
136+
this.socketTimeoutInMillis = builder.socketTimeoutInMillis;
137137
}
138138

139139
@Override
@@ -163,17 +163,17 @@ public int getRetries() {
163163

164164
@Override
165165
public int getBufferSize() {
166-
return bufferSize;
166+
return bufferSizeInBytes;
167167
}
168168

169169
@Override
170170
public int getConnectionTimeout() {
171-
return connectionTimeout;
171+
return connectionTimeoutInMillis;
172172
}
173173

174174
@Override
175175
public int getSocketTimeout() {
176-
return socketTimeout;
176+
return socketTimeoutInMillis;
177177
}
178178

179179
@Override

ds3-sdk/src/main/java/com/spectralogic/ds3client/Ds3ClientBuilder.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public class Ds3ClientBuilder implements Builder<Ds3Client> {
4747
private boolean certificateVerification = true;
4848
private URI proxy = null;
4949
private int retries = 5;
50-
private int connectionTimeout = 5 * 1000;
51-
private int bufferSize = 1024 * 1024;
52-
private int socketTimeout = 1000 * 60 * 60;
50+
private int connectionTimeoutInMillis = 5 * 1000;
51+
private int bufferSizeInBytes = 1024 * 1024;
52+
private int socketTimeoutInMillis = 1000 * 60 * 60;
5353

5454
private Ds3ClientBuilder(final String endpoint, final Credentials credentials) throws IllegalArgumentException {
5555
if (Guard.isStringNullOrEmpty(endpoint)) {
@@ -115,11 +115,11 @@ public Ds3ClientBuilder withHttps(final boolean secure) {
115115
}
116116

117117
/**
118-
* @param bufferSize The size of the buffer to be used when writing content out to DS3.
118+
* @param bufferSizeInBytes The size of the buffer to be used when writing content out to DS3.
119119
* @return The current builder.
120120
*/
121-
public Ds3ClientBuilder withBufferSize(final int bufferSize) {
122-
this.bufferSize = bufferSize;
121+
public Ds3ClientBuilder withBufferSize(final int bufferSizeInBytes) {
122+
this.bufferSizeInBytes = bufferSizeInBytes;
123123
return this;
124124
}
125125

@@ -173,8 +173,8 @@ public Ds3ClientBuilder withRedirectRetries(final int retries) {
173173
*
174174
* Default: 5 minutes
175175
*/
176-
public Ds3ClientBuilder withConnectionTimeout(final int timeout) {
177-
this.connectionTimeout = timeout;
176+
public Ds3ClientBuilder withConnectionTimeout(final int timeoutInMillis) {
177+
this.connectionTimeoutInMillis = timeoutInMillis;
178178
return this;
179179
}
180180

@@ -183,8 +183,8 @@ public Ds3ClientBuilder withConnectionTimeout(final int timeout) {
183183
*
184184
* Default: 60 minutes
185185
*/
186-
public Ds3ClientBuilder withSocketTimeout(final int timeout) {
187-
this.socketTimeout = timeout;
186+
public Ds3ClientBuilder withSocketTimeout(final int timeoutInMillis) {
187+
this.socketTimeoutInMillis = timeoutInMillis;
188188
return this;
189189
}
190190

@@ -201,9 +201,9 @@ public Ds3Client build() {
201201
.withHttps(this.https)
202202
.withCertificateVerification(this.certificateVerification)
203203
.withRedirectRetries(this.retries)
204-
.withBufferSize(this.bufferSize)
205-
.withConnectionTimeout(this.connectionTimeout)
206-
.withSocketTimeout(this.socketTimeout);
204+
.withBufferSize(this.bufferSizeInBytes)
205+
.withConnectionTimeout(this.connectionTimeoutInMillis)
206+
.withSocketTimeout(this.socketTimeoutInMillis);
207207

208208
final NetworkClient netClient = new NetworkClientImpl(connBuilder.build());
209209
return new Ds3ClientImpl(netClient);

0 commit comments

Comments
 (0)