Created
July 28, 2011 02:53
-
-
Save gustavopinto/1110871 to your computer and use it in GitHub Desktop.
jme: sync-juc -> com.jme.util.GameTask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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