Skip to content

Instantly share code, notes, and snippets.

@nsivabalan
Created July 14, 2020 14:57
Show Gist options
  • Save nsivabalan/a27405861b79f2b2b6a3b09b60e27169 to your computer and use it in GitHub Desktop.
Save nsivabalan/a27405861b79f2b2b6a3b09b60e27169 to your computer and use it in GitHub Desktop.
public class UberCallOptions {
private boolean isRetryEnabled = false;
private int retryCount = 0;
private long timeout = 30000;
private String callType = "GRPC";
.
.
.
public UberCallOptions() {
}
public void setRetryEnabled() {
isRetryEnabled = true;
}
public boolean isRetryEnabled() {
return isRetryEnabled;
}
public int getRetryCount() {
return retryCount;
}
public String getCallType() {
return callType;
}
public void setCallType(String callType) {
this.callType = callType;
}
public long getTimeoutInMs() {
return timeout;
}
public void setTimeoutInMs(long timeoutInMs) {
this.timeout = timeoutInMs;
}
public CallOptions getCallOptions() {
return this.callOptions;
}
public UberCallOptions withExecutor(@Nullable Executor executor) {
this.callOptions = this.callOptions.withExecutor(executor);
return this;
}
public UberCallOptions withDeadline(Deadline deadline) {
this.callOptions = this.callOptions.withDeadline(deadline);
return this;
}
public UberCallOptions withDeadlineAfter(long duration, TimeUnit timeUnit) {
this.callOptions = this.callOptions.withDeadlineAfter(duration, timeUnit);
return this;
}
@Override
public String toString() {
return "UberCallOptions{"
+ "callOptions="
+ callOptions
+ ", isRetryEnabled="
+ isRetryEnabled
+ ", retryCount="
+ retryCount
+ '}';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment