public void cancel() { boolean decoding; synchronized(this) { if(finished) return; finished = true; decoding = tryDecode; // If already decoding, must wait for decoder to check in before completing shutdown. } if(!decoding) parent.finishedEncoding(this); // Else must wait. }
/** Called after checking datastore for a datastore-only request. */ public void onFinishedCheckingDatastoreNoFetch(ClientContext context) { synchronized(this) { if(tryDecode) return; if(succeeded) return; if(finished) return; if(failed) return; failed = true; finished = true; } parent.finishedEncoding(this); }
public void cancel() { synchronized(this) { cancelled = true; if(tryDecode) return; succeeded = true; } parent.finishedEncoding(this); }
/** Called when a segment has finished encoding. It is possible that it has simply restarted; * it is not guaranteed to have encoded all blocks etc. But we still need the callback in case * e.g. we are in the process of failing, and can't proceed until all the encode jobs have * finished. */ void finishedEncoding(SplitFileFetcherSegmentStorage segment) { if(logMINOR) Logger.minor(this, "Successfully decoded "+segment+" for "+this+" for "+fetcher); if(!allFinished()) return; finishedEncoding(); }
/** Called when a cross-segment has finished decoding. It doesn't necessarily have a "finished" * state, except if it was cancelled. */ void finishedEncoding(SplitFileFetcherCrossSegmentStorage segment) { if(logMINOR) Logger.minor(this, "Successfully decoded "+segment+" for "+this+" for "+fetcher); if(!allFinished()) return; finishedEncoding(); }
tryDecode = false; parent.finishedEncoding(SplitFileFetcherCrossSegmentStorage.this);
parent.finishedEncoding(SplitFileFetcherSegmentStorage.this); } finally { if(lock != null) lock.unlock(false, MemoryLimitedJobRunner.THREAD_PRIORITY);
parent.finishedEncoding(this);