@Override public boolean run(ClientContext context) { try { ((SendableInsert) request).onFailure(e, token, context); } finally { sched.removeRunningInsert((SendableInsert)(request), token.getKey()); // Something might be waiting for a request to complete (e.g. if we have two requests for the same key), // so wake the starter thread. } sched.wakeStarter(); return false; }
@Override public boolean run(ClientContext context) { try { ((SendableInsert) request).onSuccess(token, key, context); } finally { sched.removeRunningInsert((SendableInsert)(request), token.getKey()); } // Something might be waiting for a request to complete (e.g. if we have two requests for the same key), // so wake the starter thread. sched.wakeStarter(); return false; }
@Override public boolean send(NodeClientCore core, RequestScheduler sched, ClientContext context, ChosenBlock req) { // Ignore keyNum, key, since this is a single block try { if(logMINOR) Logger.minor(this, "Starting request: "+this); // FIXME bulk flag core.realPut(block, req.canWriteClientCache, Node.FORK_ON_CACHEABLE_DEFAULT, Node.PREFER_INSERT_DEFAULT, Node.IGNORE_LOW_BACKOFF_DEFAULT, false); } catch (LowLevelPutException e) { onFailure(e, req.token, context); if(logMINOR) Logger.minor(this, "Request failed: "+this+" for "+e); return true; } finally { finished = true; } if(logMINOR) Logger.minor(this, "Request succeeded: "+this); onSuccess(req.token, null, context); sched.removeRunningInsert(SimpleSendableInsert.this, req.token.getKey()); return true; }
private boolean startRequest(ChosenBlock req, boolean logMINOR) { if((!req.isPersistent()) && req.isCancelled()) { req.onDumped(); return false; } if(req.key != null) { if(!sched.addToFetching(req.key)) { req.onDumped(); return false; } } else if(((ChosenBlockImpl)req).request instanceof SendableInsert) { if(!sched.addRunningInsert((SendableInsert)(((ChosenBlockImpl)req).request), req.token.getKey())) { req.onDumped(); return false; } } if(logMINOR) Logger.minor(this, "Running request "+req+" priority "+req.getPriority()); core.getExecutor().execute(new SenderThread(req, req.key), "RequestStarter$SenderThread for "+req); return true; }