}
@Override
public void onSuccess(FetchResult result, ClientGetter state) {
Logger.minor(this, "Succeeded: "+identifier);
Bucket data = result.asBucket();
synchronized(this) {
if(succeeded) {
Logger.error(this, "onSuccess called twice for "+this+" ("+identifier+ ')');
return; // We might be called twice; ignore it if so.
}
started = true;
if(!binaryBlob)
this.foundDataMimeType = result.getMimeType();
else
this.foundDataMimeType = BinaryBlob.MIME_TYPE;
// completionTime is set here rather than in finish() for two reasons:
// 1. It must be set inside the lock.
// 2. It must be set before AllData is sent so it is consistent.
completionTime = System.currentTimeMillis();
progressPending = null;
this.foundDataLength = data.size();
this.succeeded = true;
finished = true;
if(returnType == ReturnType.DIRECT)
returnBucketDirect = data;
}