You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-user@hadoop.apache.org by Christian Schneider <cs...@gmail.com> on 2013/08/02 12:42:49 UTC

JobClient methods doesn't have a timeout. --> org.apache.hadoop.ipc.Client.call(...) blocks infinate

Hi,
it would be nice if we can specify a timeout for JobClient Calls.

If we call JobClient.getJob(...) and the connection breaks, it blocks
without getting a timeout.
This is because the org.apache.hadoop.ipc.Client.call(...) looks like this:

  public Writable call(RPC.RpcKind rpcKind, Writable rpcRequest,
      ConnectionId remoteId) throws InterruptedException, IOException {
  // omitted
    boolean interrupted = false;
    synchronized (call) {
      while (!call.done) {
        try {
          // no timeout here:
          call.wait();
        } catch (InterruptedException ie) {
          // save the fact that we were interrupted
          interrupted = true;
        }
      }
  // omitted
}

Now my "business logic" will not get notified if smth. with the connection
happens.

They only way for me will be to wrap the JobClient Calls into a runnable
and interrupt the thread after some time.


Or is there another way to do it?

Best Regards,
Christian.