@Immutable public final class CallOptions extends Object
A field that is not set is null.
| Modifier and Type | Field and Description |
|---|---|
static CallOptions |
DEFAULT
A blank
CallOptions that all fields are not set. |
| Modifier and Type | Method and Description |
|---|---|
String |
getAuthority()
Override the HTTP/2 authority the channel claims to be connecting to.
|
Long |
getDeadlineNanoTime()
Returns the deadline in nanoseconds in the clock as per
System.nanoTime(). |
RequestKey |
getRequestKey()
Returns the request key for affinity-based routing.
|
String |
toString() |
CallOptions |
withAuthority(String authority)
Override the HTTP/2 authority the channel claims to be connecting to.
|
CallOptions |
withDeadlineAfter(long duration,
TimeUnit unit)
Returns a new
CallOptions with a deadline that is after the given duration from
now. |
CallOptions |
withDeadlineNanoTime(Long deadlineNanoTime)
Returns a new
CallOptions with the given absolute deadline in nanoseconds in the clock
as per System.nanoTime(). |
CallOptions |
withRequestKey(RequestKey requestKey)
Returns a new
CallOptions with a request key for affinity-based routing. |
public static final CallOptions DEFAULT
CallOptions that all fields are not set.@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/67") public CallOptions withAuthority(@Nullable String authority)
public CallOptions withDeadlineNanoTime(@Nullable Long deadlineNanoTime)
CallOptions with the given absolute deadline in nanoseconds in the clock
as per System.nanoTime().
This is mostly used for propagating an existing deadline. withDeadlineAfter(long, java.util.concurrent.TimeUnit) is the
recommended way of setting a new deadline,
deadlineNanoTime - the deadline in the clock as per System.nanoTime().
null for unsetting the deadline.public CallOptions withDeadlineAfter(long duration, TimeUnit unit)
CallOptions with a deadline that is after the given duration from
now.@Nullable public Long getDeadlineNanoTime()
System.nanoTime(). null
if the deadline is not set.@ExperimentalApi public CallOptions withRequestKey(@Nullable RequestKey requestKey)
CallOptions with a request key for affinity-based routing.@ExperimentalApi @Nullable public RequestKey getRequestKey()
@Nullable @ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/67") public String getAuthority()