3

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?

Ed K
  • 189
  • 2
  • 9

1 Answers1

1

No, because it uses higher synchronization primitive

java.util.concurrent.locks.AbstractQueuedSynchronizer
Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
octo
  • 665
  • 3
  • 8