@Override public void onFailure(final InsertException e, ClientPutState c, ClientContext context) { if(persistent) { try { context.jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { inserter.cb.onFailure(e, inserter, context); return true; } }, NativeThread.NORM_PRIORITY+1); } catch (PersistenceDisabledException e1) { // Can't do anything } } else { inserter.cb.onFailure(e, inserter, context); } }
final CountDownLatch done = new CountDownLatch(1); final AtomicBoolean success = new AtomicBoolean(); core.clientContext.jobRunner.queue(new PersistentJob() {
final CountDownLatch done = new CountDownLatch(1); final AtomicBoolean success = new AtomicBoolean(); core.clientContext.jobRunner.queue(new PersistentJob() {
@Override public void run() { try { context.jobRunner.queue(this, NativeThread.HIGH_PRIORITY-1); } catch (PersistenceDisabledException e) { outputHandler.queue(new EndListPersistentRequestsMessage(listRequestIdentifier)); } }
@Override public void callFailure(final SendableGet get, final LowLevelGetException e, int prio, boolean persistent) { if(!persistent) { get.onFailure(e, null, clientContext); } else { try { jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { get.onFailure(e, null, clientContext); return false; } @Override public String toString() { return "SendableGet onFailure"; } }, prio); } catch (PersistenceDisabledException e1) { Logger.error(this, "callFailure() on a persistent request but database disabled", new Exception("error")); } } }
private void handleCompatibilityMode(final SplitfileCompatibilityModeEvent ce, ClientContext context) { if(persistence == Persistence.FOREVER && context.jobRunner.hasLoaded()) { try { context.jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { innerHandleCompatibilityMode(ce, context); return false; } }, NativeThread.HIGH_PRIORITY); } catch (PersistenceDisabledException e) { // Not much we can do } } else { innerHandleCompatibilityMode(ce, context); } }
@Override public void callFailure(final SendableInsert insert, final LowLevelPutException e, int prio, boolean persistent) { if(!persistent) { insert.onFailure(e, null, clientContext); } else { try { jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { insert.onFailure(e, null, context); return false; } @Override public String toString() { return "SendableInsert onFailure"; } }, prio); } catch (PersistenceDisabledException e1) { Logger.error(this, "callFailure() on a persistent request but database disabled", new Exception("error")); } } }
/** * Start a request. Schedule a job on the database thread if it is persistent, otherwise start it * immediately. * @param getter The request to start. * @throws FetchException If the request is transient and failed to start. * @throws DatabaseDisabledException If the request is persistent and the database is disabled. */ public void start(final ClientGetter getter) throws FetchException, PersistenceDisabledException { if(getter.persistent()) { jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { try { getter.start(context); } catch (FetchException e) { getter.clientCallback.onFailure(e, getter); } return true; } }, NativeThread.NORM_PRIORITY); } else { getter.start(this); } }
/** * Start a new-style site insert. Schedule a job on the database thread if it is persistent, * otherwise start it immediately. * @param inserter The request to start. * @throws InsertException If the insert is transient and failed to start. * @throws DatabaseDisabledException If the insert is persistent and the database is disabled. */ public void start(final BaseManifestPutter inserter) throws InsertException, PersistenceDisabledException { if(inserter.persistent()) { jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { try { inserter.start(context); } catch (InsertException e) { inserter.cb.onFailure(e, inserter); } return true; } }, NativeThread.NORM_PRIORITY); } else { inserter.start(this); } }
private void fail(final InsertException ie, ClientContext context, Bucket bestCompressedData) { if(persistent) { try { context.jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { inserter.cb.onFailure(ie, inserter, context); return true; } }, NativeThread.NORM_PRIORITY+1); } catch (PersistenceDisabledException e1) { Logger.error(this, "Database disabled compressing data", new Exception("error")); if(bestCompressedData != null && bestCompressedData != origData) bestCompressedData.free(); } } else { inserter.cb.onFailure(ie, inserter, context); } }
/** * Start an insert. Queue a database job if it is a persistent insert, otherwise start it right now. * @param inserter The insert to start. * @param earlyEncode Whether to try to encode the data and insert the upper layers as soon as possible. * Normally we wait for each layer to complete before inserting the next one because an attacker may be * able to identify lower blocks once the top block has been inserted (e.g. if it's a known SSK). * @throws InsertException If the insert is transient and it fails to start. * @throws DatabaseDisabledException If the insert is persistent and the database is disabled (e.g. * because it is encrypted and the user hasn't entered the password yet). */ public void start(final ClientPutter inserter) throws InsertException, PersistenceDisabledException { if(inserter.persistent()) { jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { try { inserter.start(false, context); } catch (InsertException e) { inserter.client.onFailure(e, inserter); } return true; } }, NativeThread.NORM_PRIORITY); } else { inserter.start(false, this); } }
@Override public void onCancelled(ClientContext context) { if(logMINOR) Logger.minor(this, "Cancelled on "+this); synchronized(this) { finished = true; } if(persistent) { // This can be called from USKFetcher, in which case we want to run on the // PersistentJobRunner. try { context.jobRunner.queue(new PersistentJob() { @Override public boolean run(ClientContext context) { if(callback instanceof USKFetcherTagCallback) ((USKFetcherTagCallback)callback).setTag(USKFetcherTag.this, context); callback.onCancelled(context); return false; } }, NativeThread.HIGH_PRIORITY); } catch (PersistenceDisabledException e) { // Impossible. } } else { if(callback instanceof USKFetcherTagCallback) ((USKFetcherTagCallback)callback).setTag(USKFetcherTag.this, context); callback.onCancelled(context); } }
context.jobRunner.queue(new PersistentJob() {
private void finishComplete(ClientContext context) { try { context.jobRunner.queue(new PersistentJob() {
context.jobRunner.queue(new PersistentJob() {
handler.server.core.clientContext.jobRunner.queue(new PersistentJob() {
if(req == null) { try { node.clientCore.clientContext.jobRunner.queue(new PersistentJob() {
node.clientCore.clientContext.jobRunner.queue(new PersistentJob() {
oldCompletedIdentifiersList.delete(); final boolean writeAnyway = migrated; core.clientContext.jobRunner.queue(new PersistentJob() {
jobRunner.queue(new PersistentJob() {