/** * Returns a new {@code CallOptions} with {@code executor} to be used instead of the default * executor specified with {@link ManagedChannelBuilder#executor}. */ public CallOptions withExecutor(Executor executor) { CallOptions newOptions = new CallOptions(this); newOptions.executor = executor; return newOptions; }
/** * Enables <a href="https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md"> * 'wait for ready'</a> feature for the call. 'Fail fast' is the default option for gRPC calls * and 'wait for ready' is the opposite to it. */ public CallOptions withWaitForReady() { CallOptions newOptions = new CallOptions(this); newOptions.waitForReady = true; return newOptions; }
/** * Enables <a href="https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md"> * 'wait for ready'</a> feature for the call. 'Fail fast' is the default option for gRPC calls * and 'wait for ready' is the opposite to it. */ public CallOptions withWaitForReady() { CallOptions newOptions = new CallOptions(this); newOptions.waitForReady = true; return newOptions; }
/** * Disables 'wait for ready' feature for the call. * This method should be rarely used because the default is without 'wait for ready'. */ public CallOptions withoutWaitForReady() { CallOptions newOptions = new CallOptions(this); newOptions.waitForReady = false; return newOptions; }
/** * Disables 'wait for ready' feature for the call. * This method should be rarely used because the default is without 'wait for ready'. */ public CallOptions withoutWaitForReady() { CallOptions newOptions = new CallOptions(this); newOptions.waitForReady = false; return newOptions; }
/** * Returns a new {@code CallOptions} with the given call credentials. */ public CallOptions withCallCredentials(@Nullable CallCredentials credentials) { CallOptions newOptions = new CallOptions(this); newOptions.credentials = credentials; return newOptions; }
/** * Returns a new {@code CallOptions} with the given absolute deadline. * * <p>This is mostly used for propagating an existing deadline. {@link #withDeadlineAfter} is the * recommended way of setting a new deadline, * * @param deadline the deadline or {@code null} for unsetting the deadline. */ public CallOptions withDeadline(@Nullable Deadline deadline) { CallOptions newOptions = new CallOptions(this); newOptions.deadline = deadline; return newOptions; }
/** * Returns a new {@code CallOptions} with {@code executor} to be used instead of the default * executor specified with {@link ManagedChannelBuilder#executor}. */ public CallOptions withExecutor(@Nullable Executor executor) { CallOptions newOptions = new CallOptions(this); newOptions.executor = executor; return newOptions; }
/** * Returns a new {@code CallOptions} with the given call credentials. */ public CallOptions withCallCredentials(@Nullable CallCredentials credentials) { CallOptions newOptions = new CallOptions(this); newOptions.credentials = credentials; return newOptions; }
/** * Returns a new {@code CallOptions} with the given absolute deadline. * * <p>This is mostly used for propagating an existing deadline. {@link #withDeadlineAfter} is the * recommended way of setting a new deadline, * * @param deadline the deadline or {@code null} for unsetting the deadline. */ public CallOptions withDeadline(@Nullable Deadline deadline) { CallOptions newOptions = new CallOptions(this); newOptions.deadline = deadline; return newOptions; }
/** * Sets the maximum allowed message size acceptable from the remote peer. If unset, this will * default to the value set on the {@link ManagedChannelBuilder#maxInboundMessageSize(int)}. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563") public CallOptions withMaxInboundMessageSize(int maxSize) { checkArgument(maxSize >= 0, "invalid maxsize %s", maxSize); CallOptions newOptions = new CallOptions(this); newOptions.maxInboundMessageSize = maxSize; return newOptions; }
/** * Sets the compression to use for the call. The compressor must be a valid name known in the * {@link CompressorRegistry}. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704") public CallOptions withCompression(@Nullable String compressorName) { CallOptions newOptions = new CallOptions(this); newOptions.compressorName = compressorName; return newOptions; }
/** * Sets the compression to use for the call. The compressor must be a valid name known in the * {@link CompressorRegistry}. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704") public CallOptions withCompression(@Nullable String compressorName) { CallOptions newOptions = new CallOptions(this); newOptions.compressorName = compressorName; return newOptions; }
/** * Sets the maximum allowed message size acceptable sent to the remote peer. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563") public CallOptions withMaxOutboundMessageSize(int maxSize) { checkArgument(maxSize >= 0, "invalid maxsize %s", maxSize); CallOptions newOptions = new CallOptions(this); newOptions.maxOutboundMessageSize = maxSize; return newOptions; }
/** * Returns a new {@code CallOptions} with a {@code ClientStreamTracerFactory} in addition to * the existing factories. * * <p>This method doesn't replace existing factories, or try to de-duplicate factories. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861") public CallOptions withStreamTracerFactory(ClientStreamTracer.Factory factory) { CallOptions newOptions = new CallOptions(this); ArrayList<ClientStreamTracer.Factory> newList = new ArrayList<ClientStreamTracer.Factory>(streamTracerFactories.size() + 1); newList.addAll(streamTracerFactories); newList.add(factory); newOptions.streamTracerFactories = Collections.unmodifiableList(newList); return newOptions; }
/** * Returns a new {@code CallOptions} with a {@code ClientStreamTracerFactory} in addition to * the existing factories. * * <p>This method doesn't replace existing factories, or try to de-duplicate factories. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861") public CallOptions withStreamTracerFactory(ClientStreamTracer.Factory factory) { CallOptions newOptions = new CallOptions(this); ArrayList<ClientStreamTracer.Factory> newList = new ArrayList<ClientStreamTracer.Factory>(streamTracerFactories.size() + 1); newList.addAll(streamTracerFactories); newList.add(factory); newOptions.streamTracerFactories = Collections.unmodifiableList(newList); return newOptions; }
/** * Override the HTTP/2 authority the channel claims to be connecting to. <em>This is not * generally safe.</em> Overriding allows advanced users to re-use a single Channel for multiple * services, even if those services are hosted on different domain names. That assumes the * server is virtually hosting multiple domains and is guaranteed to continue doing so. It is * rare for a service provider to make such a guarantee. <em>At this time, there is no security * verification of the overridden value, such as making sure the authority matches the server's * TLS certificate.</em> */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1767") public CallOptions withAuthority(@Nullable String authority) { CallOptions newOptions = new CallOptions(this); newOptions.authority = authority; return newOptions; }
/** * Override the HTTP/2 authority the channel claims to be connecting to. <em>This is not * generally safe.</em> Overriding allows advanced users to re-use a single Channel for multiple * services, even if those services are hosted on different domain names. That assumes the * server is virtually hosting multiple domains and is guaranteed to continue doing so. It is * rare for a service provider to make such a guarantee. <em>At this time, there is no security * verification of the overridden value, such as making sure the authority matches the server's * TLS certificate.</em> */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1767") public CallOptions withAuthority(@Nullable String authority) { CallOptions newOptions = new CallOptions(this); newOptions.authority = authority; return newOptions; }
/** * Sets the maximum allowed message size acceptable sent to the remote peer. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563") public CallOptions withMaxOutboundMessageSize(int maxSize) { checkArgument(maxSize >= 0, "invalid maxsize %s", maxSize); CallOptions newOptions = new CallOptions(this); newOptions.maxOutboundMessageSize = maxSize; return newOptions; }
/** * Sets the maximum allowed message size acceptable from the remote peer. If unset, this will * default to the value set on the {@link ManagedChannelBuilder#maxInboundMessageSize(int)}. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563") public CallOptions withMaxInboundMessageSize(int maxSize) { checkArgument(maxSize >= 0, "invalid maxsize %s", maxSize); CallOptions newOptions = new CallOptions(this); newOptions.maxInboundMessageSize = maxSize; return newOptions; }