api: expose if waitForReady has been set on CallOptions
diff --git a/api/src/main/java/io/grpc/CallOptions.java b/api/src/main/java/io/grpc/CallOptions.java
index 3753f7c..17b065e 100644
--- a/api/src/main/java/io/grpc/CallOptions.java
+++ b/api/src/main/java/io/grpc/CallOptions.java
@@ -69,7 +69,8 @@
/**
* Opposite to fail fast.
*/
- private boolean waitForReady;
+ @Nullable
+ private Boolean waitForReady;
@Nullable
private Integer maxInboundMessageSize;
@@ -154,7 +155,7 @@
*/
public CallOptions withWaitForReady() {
CallOptions newOptions = new CallOptions(this);
- newOptions.waitForReady = true;
+ newOptions.waitForReady = Boolean.TRUE;
return newOptions;
}
@@ -164,7 +165,7 @@
*/
public CallOptions withoutWaitForReady() {
CallOptions newOptions = new CallOptions(this);
- newOptions.waitForReady = false;
+ newOptions.waitForReady = Boolean.FALSE;
return newOptions;
}
@@ -369,6 +370,10 @@
* calls and 'wait for ready' is the opposite to it.
*/
public boolean isWaitForReady() {
+ return Boolean.TRUE.equals(waitForReady);
+ }
+
+ Boolean getWaitForReady() {
return waitForReady;
}
diff --git a/api/src/main/java/io/grpc/InternalCallOptions.java b/api/src/main/java/io/grpc/InternalCallOptions.java
new file mode 100644
index 0000000..92546f0
--- /dev/null
+++ b/api/src/main/java/io/grpc/InternalCallOptions.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2019 The gRPC Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.grpc;
+
+/**
+ * Internal accessor for {@link CallOptions}.
+ */
+@Internal
+public final class InternalCallOptions {
+ private InternalCallOptions() {}
+
+ /**
+ * Gets the waitForReady bit or {@code null} if it was never set.
+ */
+ public static Boolean getWaitForReady(CallOptions callOptions) {
+ return callOptions.getWaitForReady();
+ }
+}