FULL PRODUCT VERSION :
ADDITIONAL OS VERSION INFORMATION :
really doesn't matter :P
A DESCRIPTION OF THE PROBLEM :
implementation of FutureTask#isDone is as follows :
public boolean isDone() {
return state != NEW;
}
while it should be as follows :
public boolean isDone(){
return state != NEW && state != COMPLETING && state != INTERRUPTING;
}
or (less code, but less readable):
public boolean isDone(){
return state > COMPLETING && state != INTERRUPTING;
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
open sources, go to FutureTask#isDone implementation, read javadoc of Future interface, look at them.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
either
public boolean isDone(){
return state != NEW && state != COMPLETING && state != INTERRUPTING;
}
or:
public boolean isDone(){
return state > COMPLETING && state != INTERRUPTING;
}
ACTUAL -
public boolean isDone() {
return state != NEW;
}
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Write your own RunnableFuture implementation with long javadoc explaining.