@Override
public void onSuccess(ClientPutState state, ClientContext context) {
onBlockSetFinished(state, context);
onFetchable(state);
boolean complete = true;
synchronized(this) {
if(finished) {
Logger.error(this, "Already finished but got onSuccess() for "+state+" on "+this);
return;
}
ListUtils.removeBySwapLast(waitingFor,state);
ListUtils.removeBySwapLast(waitingForBlockSet,state);
ListUtils.removeBySwapLast(waitingForFetchable,state);
if(!(waitingFor.isEmpty() && started)) {
complete = false;
}
if(state == generator) {
generator = null;
}
}
if(complete) {
Logger.minor(this, "Completing...");
complete(null, context);
}
}