Source:
<code>public final hudson.remoting.Future<RSP> callAsync(final Channel channel) throws IOException { response=null; lastIoId = channel.lastIoId(); channel.pendingCalls.put(id,this); channel.send(this); return new hudson.remoting.Future<RSP>() { private volatile boolean cancelled; public boolean cancel(boolean mayInterruptIfRunning) { if (cancelled || isDone()) { return false; } cancelled = true; if (mayInterruptIfRunning) { try { channel.send(new Cancel(id)); } catch (IOException x) { return false; } } return true; } public boolean isCancelled() { return cancelled; } public boolean isDone() { return isCancelled() || response!=null; } public RSP get() throws InterruptedException, ExecutionException { synchronized(Request.this) { try { while(response==null && !channel.isInClosed()) { if (isCancelled()) { throw new CancellationException(); } <START> Request.this.wait(30*1000); END> } if (response==null) { throw new ExecutionException(new IOException("Channel closed")); } } catch (InterruptedException e) { try { channel.send(new Cancel(id)); } catch (IOException e1) { } throw e; } if(response.exception!=null) throw new ExecutionException(response.exception); return response.returnValue; } } public RSP get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { synchronized (Request.this) { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (response == null && (end - now > 0L) && !channel.isInClosed()) { if (isCancelled()) { throw new CancellationException(); } Request.this.wait(Math.min(30*1000,Math.max(1, TimeUnit.NANOSECONDS.toMillis(end - now)))); now = System.nanoTime(); } if (response == null && end > now) { throw new ExecutionException(new IOException("Channel closed")); } if (response == null) throw new TimeoutException(); if (response.exception != null) throw new ExecutionException(response.exception); return response.returnValue; } } }; }</code><technical_language>Waits w/o timeout evil, hardcoded timeout is applicable in case of network-robust instances</technical_language>

Target:
public final hudson.remoting.Future<RSP> callAsync(final Channel channel) throws IOException { response=null; lastIoId = channel.lastIoId(); channel.pendingCalls.put(id,this); channel.send(this); return new hudson.remoting.Future<RSP>() { private volatile boolean cancelled; public boolean cancel(boolean mayInterruptIfRunning) { if (cancelled || isDone()) { return false; } cancelled = true; if (mayInterruptIfRunning) { try { channel.send(new Cancel(id)); } catch (IOException x) { return false; } } return true; } public boolean isCancelled() { return cancelled; } public boolean isDone() { return isCancelled() || response!=null; } public RSP get() throws InterruptedException, ExecutionException { synchronized(Request.this) { try { while(response==null) { if (isCancelled()) { throw new CancellationException(); } if (channel.isInClosed()) { throw new ExecutionException(new RequestAbortedException(null)); } Request.this.wait(30*1000); } } catch (InterruptedException e) { try { channel.send(new Cancel(id)); } catch (IOException e1) { } throw e; } if(response.exception!=null) throw new ExecutionException(response.exception); return response.returnValue; } } public RSP get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { synchronized (Request.this) { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (response == null && (end - now > 0L)) { if (isCancelled()) { throw new CancellationException(); } if (channel.isInClosed()) { throw new ExecutionException(new RequestAbortedException(null)); } Request.this.wait(Math.min(30*1000,Math.max(1, TimeUnit.NANOSECONDS.toMillis(end - now)))); now = System.nanoTime(); } if (response == null) throw new TimeoutException(); if (response.exception != null) throw new ExecutionException(response.exception); return response.returnValue; } } }; }