I followed directions in this issue 
<https://github.com/grpc/grpc-java/issues/1495> 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);
  } 

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/d4cd128d-2cee-4e6c-aa4f-b7783caa64ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to