Do spurious wakeups affect Future.get()?
Pregunta
Is Future.get( timeout, unit ) susceptible to the same type of spurious wakeup as documented for Object.wait() and Condition.await() in Javadoc?
someType result;
Future<someType> future = executor.submit( new callableTask() );
result = future.get( 1000, TimeUnit.MILLISECONDS );
Presume that the thread does NOT end before the timeout, is it possible that it won't wait 1000ms? Seems like it has to wait the full timeout (and generate a timeout exception), otherwise what would the result be?
Solución
No, because it uses higher synchronization primitive
java.util.concurrent.locks.AbstractQueuedSynchronizer
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow