I followed directions in this
issue to add deadlines to a RPC. But I get a null pointer error.
java.lang.NullPointerException
at io.grpc.stub.AbstractStub.withDeadlineAfter(AbstractStub.java:117)
My code is
blockingStub.withDeadlineAfter(10, TimeUnit.DAYS).doSomething()
Can the callOptions here be null by any chance?
/**
* Returns a new stub with a deadline that is after the given {@code duration} from now.
*
* @see CallOptions#withDeadlineAfter
*/
public final S withDeadlineAfter(long duration, TimeUnit unit) {
return build(channel, callOptions.withDeadlineAfter(duration, unit));
}
I'm using the code generated by the protobuf java plugin and the constructor initializes callOptions to CallOptions.DEFAULT, so I'm not sure what's wrong here. Anyone else faced this issue? I'm using protobuf-gradle-plugin:0.7.6.
/**
* Constructor for use by subclasses, with the default {@code CallOptions}.
*
* @param channel the channel that this stub will use to do communications
*/
protected AbstractStub(Channel channel) {
this(channel, CallOptions.DEFAULT);
}