Skip to content

Commit

Permalink
Merge pull request #310 from RachelTucker/clarify_units
Browse files Browse the repository at this point in the history
Clarify units in client building
  • Loading branch information
shabtaisharon authored Aug 2, 2016
2 parents 4ea2806 + d67babe commit f18e66a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ static class Builder implements com.spectralogic.ds3client.utils.Builder<Connect
private boolean https = false;
private URI proxy = null;
private int retries = 5;
private int bufferSize = 1024 * 1024;
private int connectionTimeout = 5 * 1000;
private int socketTimeout = 60 * 60 * 1000;
private int bufferSizeInBytes = 1024 * 1024;
private int connectionTimeoutInMillis = 5 * 1000;
private int socketTimeoutInMillis = 60 * 60 * 1000;
private boolean certificateVerification;

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

public Builder withBufferSize(final int bufferSize) {
this.bufferSize = bufferSize;
public Builder withBufferSize(final int bufferSizeInBytes) {
this.bufferSizeInBytes = bufferSizeInBytes;
return this;
}

public Builder withConnectionTimeout(final int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
public Builder withConnectionTimeout(final int connectionTimeoutInMillis) {
this.connectionTimeoutInMillis = connectionTimeoutInMillis;
return this;
}

Expand All @@ -73,8 +73,8 @@ public Builder withCertificateVerification(final boolean certificateVerification
return this;
}

public Builder withSocketTimeout(final int socketTimeout) {
this.socketTimeout = socketTimeout;
public Builder withSocketTimeout(final int socketTimeoutInMillis) {
this.socketTimeoutInMillis = socketTimeoutInMillis;
return this;
}

Expand Down Expand Up @@ -115,9 +115,9 @@ private static String buildAuthority(final JobNode node, final ConnectionDetails
private final boolean https;
private final URI proxy;
private final int retries;
private final int bufferSize;
private final int connectionTimeout;
private final int socketTimeout;
private final int bufferSizeInBytes;
private final int connectionTimeoutInMillis;
private final int socketTimeoutInMillis;
private final boolean certificateVerification;

static Builder builder(final String uriEndpoint, final Credentials credentials) {
Expand All @@ -130,10 +130,10 @@ private ConnectionDetailsImpl(final Builder builder) {
this.https = builder.https;
this.proxy = builder.proxy;
this.retries = builder.retries;
this.bufferSize = builder.bufferSize;
this.connectionTimeout = builder.connectionTimeout;
this.bufferSizeInBytes = builder.bufferSizeInBytes;
this.connectionTimeoutInMillis = builder.connectionTimeoutInMillis;
this.certificateVerification = builder.certificateVerification;
this.socketTimeout = builder.socketTimeout;
this.socketTimeoutInMillis = builder.socketTimeoutInMillis;
}

@Override
Expand Down Expand Up @@ -163,17 +163,17 @@ public int getRetries() {

@Override
public int getBufferSize() {
return bufferSize;
return bufferSizeInBytes;
}

@Override
public int getConnectionTimeout() {
return connectionTimeout;
return connectionTimeoutInMillis;
}

@Override
public int getSocketTimeout() {
return socketTimeout;
return socketTimeoutInMillis;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public class Ds3ClientBuilder implements Builder<Ds3Client> {
private boolean certificateVerification = true;
private URI proxy = null;
private int retries = 5;
private int connectionTimeout = 5 * 1000;
private int bufferSize = 1024 * 1024;
private int socketTimeout = 1000 * 60 * 60;
private int connectionTimeoutInMillis = 5 * 1000;
private int bufferSizeInBytes = 1024 * 1024;
private int socketTimeoutInMillis = 1000 * 60 * 60;

private Ds3ClientBuilder(final String endpoint, final Credentials credentials) throws IllegalArgumentException {
if (Guard.isStringNullOrEmpty(endpoint)) {
Expand Down Expand Up @@ -115,11 +115,11 @@ public Ds3ClientBuilder withHttps(final boolean secure) {
}

/**
* @param bufferSize The size of the buffer to be used when writing content out to DS3.
* @param bufferSizeInBytes The size of the buffer to be used when writing content out to DS3.
* @return The current builder.
*/
public Ds3ClientBuilder withBufferSize(final int bufferSize) {
this.bufferSize = bufferSize;
public Ds3ClientBuilder withBufferSize(final int bufferSizeInBytes) {
this.bufferSizeInBytes = bufferSizeInBytes;
return this;
}

Expand Down Expand Up @@ -173,8 +173,8 @@ public Ds3ClientBuilder withRedirectRetries(final int retries) {
*
* Default: 5 minutes
*/
public Ds3ClientBuilder withConnectionTimeout(final int timeout) {
this.connectionTimeout = timeout;
public Ds3ClientBuilder withConnectionTimeout(final int timeoutInMillis) {
this.connectionTimeoutInMillis = timeoutInMillis;
return this;
}

Expand All @@ -183,8 +183,8 @@ public Ds3ClientBuilder withConnectionTimeout(final int timeout) {
*
* Default: 60 minutes
*/
public Ds3ClientBuilder withSocketTimeout(final int timeout) {
this.socketTimeout = timeout;
public Ds3ClientBuilder withSocketTimeout(final int timeoutInMillis) {
this.socketTimeoutInMillis = timeoutInMillis;
return this;
}

Expand All @@ -201,9 +201,9 @@ public Ds3Client build() {
.withHttps(this.https)
.withCertificateVerification(this.certificateVerification)
.withRedirectRetries(this.retries)
.withBufferSize(this.bufferSize)
.withConnectionTimeout(this.connectionTimeout)
.withSocketTimeout(this.socketTimeout);
.withBufferSize(this.bufferSizeInBytes)
.withConnectionTimeout(this.connectionTimeoutInMillis)
.withSocketTimeout(this.socketTimeoutInMillis);

final NetworkClient netClient = new NetworkClientImpl(connBuilder.build());
return new Ds3ClientImpl(netClient);
Expand Down

0 comments on commit f18e66a

Please sign in to comment.