// Variables will be updated on exit of method, and the only thing that is
// set is the returnBucket and the result. Not locking not only prevents
// nested locking resulting in deadlocks, it also prevents long locks due to
// doing massive encrypted I/Os while holding a lock.
PipedOutputStream dataOutput = new PipedOutputStream();
PipedInputStream dataInput = new PipedInputStream();
OutputStream output = null;
DecompressorThreadManager decompressorManager = null;
ClientGetWorkerThread worker = null;
Bucket finalResult = null;
FetchResult result = null;
long maxLen = -1;
synchronized(this) {
if(expectedSize > 0) {
maxLen = expectedSize;
}
}
if(ctx.filterData && maxLen >= 0) {
maxLen = expectedSize * 2 + 1024;
}
if(maxLen == -1) {
maxLen = Math.max(ctx.maxTempLength, ctx.maxOutputLength);
}
FetchException ex = null; // set on failure
try {
if(returnBucket == null) finalResult = context.getBucketFactory(persistent()).makeBucket(maxLen);
else finalResult = returnBucket;
if(logMINOR) Logger.minor(this, "Writing final data to "+finalResult+" return bucket is "+returnBucket);
dataOutput .connect(dataInput);
result = new FetchResult(clientMetadata, finalResult);
// Decompress
if(decompressors != null) {
if(logMINOR) Logger.minor(this, "Decompressing...");