/** A block failed. Count it and notify our clients. */ public void failedBlock(boolean dontNotify, ClientContext context) { synchronized(this) { failedBlocks++; latestFailure = CurrentTimeUTC.get(); } if(!dontNotify) notifyClients(context); }
/** A block failed fatally. Count it and notify our clients. */ public void fatallyFailedBlock(ClientContext context) { synchronized(this) { fatallyFailedBlocks++; latestFailure = CurrentTimeUTC.get(); } notifyClients(context); }
/** The set of blocks has been finalised, total will not change any * more. Notify clients. * @param context The ClientContext object including essential but * non-persistent objects such as the schedulers. */ public void blockSetFinalized(ClientContext context) { synchronized(this) { if(blockSetFinalized) return; blockSetFinalized = true; } if(logMINOR) Logger.minor(this, "Finalized set of blocks for "+this, new Exception("debug")); notifyClients(context); }
@Override public void setSplitfileBlocks(int requiredBlocks, int remainingBlocks) { parent.addMustSucceedBlocks(requiredBlocks); parent.addBlocks(remainingBlocks); parent.notifyClients(context); }
/** We completed a block. Count it and notify clients unless dontNotify. */ public void completedBlock(boolean dontNotify, ClientContext context) { if(logMINOR) Logger.minor(this, "Completed block ("+dontNotify+ "): total="+totalBlocks+" success="+successfulBlocks+" failed="+failedBlocks+" fatally="+fatallyFailedBlocks+" finalised="+blockSetFinalized+" required="+minSuccessBlocks+" on "+this); synchronized(this) { if(cancelled) return; successfulBlocks++; latestSuccess = CurrentTimeUTC.get(); } if(dontNotify) return; notifyClients(context); }
SimpleSingleFileFetcher(ClientKey key, int maxRetries, FetchContext ctx, ClientRequester parent, GetCompletionCallback rcb, boolean isEssential, boolean dontAdd, long l, ClientContext context, boolean deleteFetchContext, boolean realTimeFlag) { super(key, maxRetries, ctx, parent, deleteFetchContext, realTimeFlag); this.rcb = rcb; this.token = l; if(!dontAdd) { if(isEssential) parent.addMustSucceedBlocks(1); else parent.addBlock(); parent.notifyClients(context); } }
@Override public boolean preRegister(ClientContext context, boolean toNetwork) { if(!toNetwork) return false; // Notify clients of all the work we've done checking the datastore. if(parent.localRequestOnly()) { storage.finishedCheckingDatastoreOnLocalRequest(context); return true; } else { storage.setHasCheckedStore(context); } parent.toNetwork(); parent.parent.notifyClients(context); return false; }