@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 |
|---|---|
Attributes |
getAffinity()
Returns the attributes for affinity-based routing.
|
String |
getAuthority()
Override the HTTP/2 authority the channel claims to be connecting to.
|
String |
getCompressor()
Returns the compressor's name.
|
Deadline |
getDeadline()
Returns the deadline or
null if the deadline is not set. |
Long |
getDeadlineNanoTime()
Deprecated.
Use
getDeadline() instead. |
Executor |
getExecutor() |
String |
toString() |
CallOptions |
withAffinity(Attributes affinity)
Returns a new
CallOptions with attributes for affinity-based routing. |
CallOptions |
withAuthority(String authority)
Override the HTTP/2 authority the channel claims to be connecting to.
|
CallOptions |
withCompression(String compressorName)
Sets the compression to use for the call.
|
CallOptions |
withDeadline(Deadline deadline)
Returns a new
CallOptions with the given absolute deadline. |
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)
Deprecated.
Use
withDeadline(Deadline) instead. |
CallOptions |
withExecutor(Executor executor)
Returns a new
CallOptions with executor to be used instead of the default
executor specified with ManagedChannelBuilder.executor(java.util.concurrent.Executor). |
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)
@ExperimentalApi public CallOptions withCompression(@Nullable String compressorName)
CompressorRegistry.@ExperimentalApi public CallOptions withDeadline(@Nullable Deadline deadline)
CallOptions with the given absolute deadline.
This is mostly used for propagating an existing deadline. withDeadlineAfter(long, java.util.concurrent.TimeUnit) is the
recommended way of setting a new deadline,
deadline - the deadline or null for unsetting the deadline.@Deprecated public CallOptions withDeadlineNanoTime(@Nullable Long deadlineNanoTime)
withDeadline(Deadline) instead.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.@Deprecated public Long getDeadlineNanoTime()
getDeadline() instead.System.nanoTime(). null
if the deadline is not set.@ExperimentalApi @Nullable public Deadline getDeadline()
null if the deadline is not set.@ExperimentalApi public CallOptions withAffinity(Attributes affinity)
CallOptions with attributes for affinity-based routing.@ExperimentalApi public Attributes getAffinity()
@ExperimentalApi @Nullable public String getCompressor()
@Nullable @ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/67") public String getAuthority()
public CallOptions withExecutor(Executor executor)
CallOptions with executor to be used instead of the default
executor specified with ManagedChannelBuilder.executor(java.util.concurrent.Executor).