@Test public void serviceStopWithInflightRequests() throws Throwable { long c = 100; this.host.waitForServiceAvailable(ExampleService.FACTORY_LINK); List<Service> services = this.host.doThroughputServiceStart(c, MinimalTestService.class, this.host.buildMinimalTestState(), EnumSet.of(ServiceOption.PERSISTENCE), null); ExampleServiceState body = new ExampleServiceState(); body.name = UUID.randomUUID().toString(); body.documentExpirationTimeMicros = 1; for (Service s : services) { this.host.send(Operation.createPatch(s.getUri()).setBody(body)); } c = 10; CompletionHandler ch = this.host.getSuccessOrFailureCompletion(); this.host.setTimeoutSeconds(20); this.host.toggleNegativeTestMode(true); this.host.testStart(c * 4 * services.size()); for (Service s : services) { for (int i = 0; i < c; i++) { this.host.send(Operation.createPatch(s.getUri()).setBody(body).setCompletion(ch)); if (i >= 0) { this.host.send(Operation.createDelete(s.getUri()).setBody(body) .setCompletion(ch)); } else { this.host.send(Operation.createDelete(s.getUri()).setBody(body) .setCompletion(ch) .forceRemote()); } this.host.send(Operation.createPut(s.getUri()).setBody(body).setCompletion(ch)); this.host.send(Operation.createGet(s.getUri()).setCompletion(ch)); } } this.host.testWait(); this.host.toggleNegativeTestMode(false); }
@Override public URI getUri() { if (this.context.host == null) { return null; } return UriUtils.buildUri(this.context.host, this.context.selfLink); }
StatefulService implements Service { @Override public URI getUri() { if (this.context.host == null) { return null; } return UriUtils.buildUri(this.context.host, this.context.selfLink); } }
StatefulService implements Service { @Override public URI getUri() { if (this.context.host == null) { return null; } return UriUtils.buildUri(this.context.host, this.context.selfLink); } StatefulService(Class<? extends ServiceDocument> stateType);  StatefulService(Class<? extends ServiceDocument> stateType,
            EnumSet<ServiceOption> options); }
StatefulService implements Service { @Override public URI getUri() { if (this.context.host == null) { return null; } return UriUtils.buildUri(this.context.host, this.context.selfLink); } StatefulService(Class<? extends ServiceDocument> stateType);  StatefulService(Class<? extends ServiceDocument> stateType,
            EnumSet<ServiceOption> options); @Override OperationProcessingChain getOperationProcessingChain(); @Override Service.ProcessingStage getProcessingStage(); @Override void handleCreate(Operation post); @Override void handleStart(Operation post); @Override void authorizeRequest(Operation op); @Override boolean queueRequest(Operation op); @Override void handleRequest(Operation request); @Override void handleRequest(Operation request, OperationProcessingStage opProcessingStage); void handlePost(Operation post); void handleDelete(Operation delete); @Override void handleStop(Operation delete); void handlePatch(Operation patch); void handleOptions(Operation options); void handlePut(Operation put); void handleGet(Operation get); @Override Operation dequeueRequest(); @Override void setStat(String name, double newValue); @Override void setStat(ServiceStat s, double newValue); @Override void adjustStat(ServiceStat s, double delta); @Override void adjustStat(String name, double delta); @Override ServiceStat getStat(String name); ServiceStat getStat(String name, boolean create); @Override String getSelfLink(); @Override URI getUri(); @Override ServiceHost getHost(); @Override boolean hasOption(Service.ServiceOption cap); @Override void toggleOption(ServiceOption option, boolean enable); @Override void setSelfLink(String path); @Override void setHost(ServiceHost serviceHost); @Override void setOperationProcessingChain(OperationProcessingChain opProcessingChain); @Override void setProcessingStage(ProcessingStage stage); @Override Service getUtilityService(String uriPath, boolean allocate); @Override void sendRequest(Operation op); ServiceDocumentDescription getStateDescription(); @Override ServiceStats getStats(); @Override ServiceDocument getDocumentTemplate(); void logSevere(Throwable e); void logSevere(String fmt, Object... args); void logSevere(Supplier<String> messageSupplier); void logInfo(String fmt, Object... args); void logInfo(Supplier<String> messageSupplier); void logFine(String fmt, Object... args); void logFine(Supplier<String> messageSupplier); void logWarning(String fmt, Object... args); void logWarning(Supplier<String> messageSupplier); void log(Level level, String fmt, Object... args); void log(Level level, Supplier<String> messageSupplier); @Override void handleMaintenance(Operation post); void handlePeriodicMaintenance(Operation post); void handleNodeGroupMaintenance(Operation post); @Override ServiceDocument setInitialState(Object state, Long version); @Override String getPeerNodeSelectorPath(); @Override void setPeerNodeSelectorPath(String link); @Override String getDocumentIndexPath(); @Override void setDocumentIndexPath(String link); @Override EnumSet<ServiceOption> getOptions(); @Override void setState(Operation op, ServiceDocument newState); @SuppressWarnings("unchecked") @Override T getState(Operation op); void setAvailable(boolean isAvailable); boolean isAvailable(); @Override void setMaintenanceIntervalMicros(long micros); @Override void setCacheClearDelayMicros(long micros); @Override long getMaintenanceIntervalMicros(); @Override long getCacheClearDelayMicros(); @Override Class<? extends ServiceDocument> getStateType(); @Override void handleConfigurationRequest(Operation request); @Override final void setAuthorizationContext(Operation op, AuthorizationContext ctx); final Signer getTokenSigner(); @Override final AuthorizationContext getSystemAuthorizationContext(); final AuthorizationContext getAuthorizationContextForSubject(String subject); }
StatefulService implements Service { @Override public URI getUri() { if (this.context.host == null) { return null; } return UriUtils.buildUri(this.context.host, this.context.selfLink); } StatefulService(Class<? extends ServiceDocument> stateType);  StatefulService(Class<? extends ServiceDocument> stateType,
            EnumSet<ServiceOption> options); @Override OperationProcessingChain getOperationProcessingChain(); @Override Service.ProcessingStage getProcessingStage(); @Override void handleCreate(Operation post); @Override void handleStart(Operation post); @Override void authorizeRequest(Operation op); @Override boolean queueRequest(Operation op); @Override void handleRequest(Operation request); @Override void handleRequest(Operation request, OperationProcessingStage opProcessingStage); void handlePost(Operation post); void handleDelete(Operation delete); @Override void handleStop(Operation delete); void handlePatch(Operation patch); void handleOptions(Operation options); void handlePut(Operation put); void handleGet(Operation get); @Override Operation dequeueRequest(); @Override void setStat(String name, double newValue); @Override void setStat(ServiceStat s, double newValue); @Override void adjustStat(ServiceStat s, double delta); @Override void adjustStat(String name, double delta); @Override ServiceStat getStat(String name); ServiceStat getStat(String name, boolean create); @Override String getSelfLink(); @Override URI getUri(); @Override ServiceHost getHost(); @Override boolean hasOption(Service.ServiceOption cap); @Override void toggleOption(ServiceOption option, boolean enable); @Override void setSelfLink(String path); @Override void setHost(ServiceHost serviceHost); @Override void setOperationProcessingChain(OperationProcessingChain opProcessingChain); @Override void setProcessingStage(ProcessingStage stage); @Override Service getUtilityService(String uriPath, boolean allocate); @Override void sendRequest(Operation op); ServiceDocumentDescription getStateDescription(); @Override ServiceStats getStats(); @Override ServiceDocument getDocumentTemplate(); void logSevere(Throwable e); void logSevere(String fmt, Object... args); void logSevere(Supplier<String> messageSupplier); void logInfo(String fmt, Object... args); void logInfo(Supplier<String> messageSupplier); void logFine(String fmt, Object... args); void logFine(Supplier<String> messageSupplier); void logWarning(String fmt, Object... args); void logWarning(Supplier<String> messageSupplier); void log(Level level, String fmt, Object... args); void log(Level level, Supplier<String> messageSupplier); @Override void handleMaintenance(Operation post); void handlePeriodicMaintenance(Operation post); void handleNodeGroupMaintenance(Operation post); @Override ServiceDocument setInitialState(Object state, Long version); @Override String getPeerNodeSelectorPath(); @Override void setPeerNodeSelectorPath(String link); @Override String getDocumentIndexPath(); @Override void setDocumentIndexPath(String link); @Override EnumSet<ServiceOption> getOptions(); @Override void setState(Operation op, ServiceDocument newState); @SuppressWarnings("unchecked") @Override T getState(Operation op); void setAvailable(boolean isAvailable); boolean isAvailable(); @Override void setMaintenanceIntervalMicros(long micros); @Override void setCacheClearDelayMicros(long micros); @Override long getMaintenanceIntervalMicros(); @Override long getCacheClearDelayMicros(); @Override Class<? extends ServiceDocument> getStateType(); @Override void handleConfigurationRequest(Operation request); @Override final void setAuthorizationContext(Operation op, AuthorizationContext ctx); final Signer getTokenSigner(); @Override final AuthorizationContext getSystemAuthorizationContext(); final AuthorizationContext getAuthorizationContextForSubject(String subject);  }