private void handleStopCompletion(Operation op) { if (checkServiceStopped(op, true)) { return; } getHost().stopService(this); op.complete(); }
/** * The normal path, if no transactions are detected. * * TODO: depends on (DCP-1160) */ private void handleGetSimple(Operation get) { ServiceDocument d = get.getLinkedState(); if (d == null) { if (checkServiceStopped(get, false)) { return; } if (this.context.version > 0) { if (!hasOption(ServiceOption.PERSISTENCE)) { // A non-persistent service whose expiration time has just passed // but has not yet been stopped might actually get to this point. getHost().retryOnDemandLoadConflict(get, this); return; } throw new IllegalStateException("Version is non zero but no state was found"); } d = new ServiceDocument(); d.documentSelfLink = this.context.selfLink; d.documentKind = Utils.buildKind(this.context.stateType); } get.setBodyNoCloning(d).complete(); }
private boolean handleDeleteCompletion(Operation op) { if (op.isFromReplication() && hasOption(ServiceOption.OWNER_SELECTION)) { if (!op.isCommit()) { return false; } } if (checkServiceStopped(op, true)) { return true; } // DELETE completion runs when a DELETE was issued by a client, not local host shutdown. // It needs to stop the service now, since the handleDelete() and handleStop() handlers // have already run. getHost().markAsPendingDelete(this); getHost().stopService(this); return false; }
public boolean queueRequest(Operation op) { if (checkServiceStopped(op, false)) { return true;
/** * Handles loading state and associating it with an in-bound operation * * @param request * @return True if state needs to be loaded and parent should postpone processing */ private boolean handleRequestLoadingAndLinkingState(Operation request) { if (hasOption(Service.ServiceOption.INSTRUMENTATION)) { request.setHandlerInvokeTime(System.nanoTime() / 1000); adjustStat(ServiceStatUtils.getPerActionRequestCountName(request.getAction()), 1.0); } if (checkServiceStopped(request, false)) { return true; } if (request.isFromReplication()) { // Replicated operations always have the state, from entry node or the owner // as the body. No need to load local state. ServiceDocument state = request.getBody(this.context.stateType); request.linkState(state); // signal service has been accessed to delay stopping getHost().getCachedServiceState(this, request); return false; } loadAndLinkState(request); return true; }
if (checkServiceStopped(op, false)) { return true;