deadline for grpc java

421 views
Skip to first unread message

shishi...@go-jek.com

unread,
Aug 10, 2016, 8:18:28 AM8/10/16
to grpc.io
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);
 
}

Carl Mastrangelo

unread,
Aug 10, 2016, 11:38:30 AM8/10/16
to grpc.io
Can you provide the exact stack trace, and version you are running with?
Reply all
Reply to author
Forward
0 new messages