/** Called when a ClientPutState transitions to a new state. If this is the current state, then we update * it, but it might also be a subsidiary state, in which case we ignore it. */ @Override public void onTransition(ClientPutState oldState, ClientPutState newState, ClientContext context) { if(newState == null) throw new NullPointerException(); synchronized (this) { if (currentState == oldState) { currentState = newState; return; } } if(persistent()) context.jobRunner.setCheckpointASAP(); Logger.normal(this, "onTransition: cur=" + currentState + ", old=" + oldState + ", new=" + newState); }
/** * Called when we have metadata for all the PutHandler's. * This does *not* necessarily mean we can immediately insert the final metadata, since * if these metadata's are too big, they will need to be inserted separately. See * resolveAndStartBase(). * @param container * @param context */ private void gotAllMetadata(ClientContext context) { if (containerMode) throw new IllegalStateException(); if(logMINOR) Logger.minor(this, "Got all metadata"); baseMetadata = makeMetadata(rootDir); context.jobRunner.setCheckpointASAP(); resolveAndStartBase(context); }
/** * Called when the current state creates a new state and we switch to that. For example, a * SingleFileFetcher might switch to a SplitFileFetcher. Sometimes this will be called with oldState * not equal to our currentState; this means that a subsidiary request has changed state, so we * ignore it. */ @Override public void onTransition(ClientGetState oldState, ClientGetState newState, ClientContext context) { synchronized(this) { if(currentState == oldState) { currentState = newState; if(logMINOR) Logger.minor(this, "Transition: "+oldState+" -> "+newState+" on "+this+" persistent = "+persistent()+" instance = "+super.toString(), new Exception("debug")); } else { if(logMINOR) Logger.minor(this, "Ignoring transition: "+oldState+" -> "+newState+" because current = "+currentState+" on "+this+" persistent = "+persistent(), new Exception("debug")); return; } } if(persistent()) context.jobRunner.setCheckpointASAP(); }
@Override public void restartedAfterDataCorruption() { if(hasFinished()) return; Logger.error(this, "Restarting download "+this+" after data corruption"); // We need to fetch more blocks. Some of them may even be in the datastore. getter.unregister(context, getPriorityClass()); getter.schedule(context, false); context.jobRunner.setCheckpointASAP(); }
server.core.clientContext.jobRunner.setCheckpointASAP();
context.getJobRunner(persistent()).setCheckpointASAP(); clientCallback.onSuccess(result, ClientGetter.this);
e.expectedSize = expectedSize; context.getJobRunner(persistent()).setCheckpointASAP();
context.getJobRunner(persistent()).setCheckpointASAP(); clientCallback.onSuccess(result, ClientGetter.this);