Skip to content

Instantly share code, notes, and snippets.

@gustavopinto
Created July 28, 2011 02:53
Show Gist options
  • Select an option

  • Save gustavopinto/1110871 to your computer and use it in GitHub Desktop.

Select an option

Save gustavopinto/1110871 to your computer and use it in GitHub Desktop.
jme: sync-juc -> com.jme.util.GameTask
public synchronized V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
if ((result == null) && (exc == null)) {
unit.timedWait(this, timeout);
}
if (exc != null) throw exc;
if (result == null) throw new TimeoutException("Object not returned in time allocated.");
return result;
}
public V get() throws InterruptedException, ExecutionException {
stateLock.lock();
try {
while (!isDone()) {
finishedCondition.await();
}
if (exception != null) {
throw exception;
}
return result;
} finally {
stateLock.unlock();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment