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) { if (isCancelled()) { throw new CancellationException(); } Request.this.wait(); } } 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(); } <START> Request.this.wait(Math.max(1, (end - now) / 1000L)); <END> now = System.nanoTime(); } if (response == null) throw new TimeoutException(); if (response.exception != null) throw new ExecutionException(response.exception); return response.returnValue; } } }; }</code><technical_language>1ms=10^6ns</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(); } Request.this.wait(); } } 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(); } Request.this.wait(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; } } }; }