@Override public Continuation apply(Object o) { //noinspection unchecked return Continuation.of(o, getDefaultNext()); } };
private boolean resume(final Runnable handler) { synchronized (stateLock) { if (state != SUSPENDED) { return false; } state = RESUMED; } try { responder.runtime.requestScope.runInScope(requestContext, handler); } finally { requestContext.release(); } return true; }
@Override public Stage.Continuation<DATA> apply(DATA request) { return Continuation.of(request); } }
/** * Start building a stage chain. * * @param rootStage root {@link ChainableStage chainable linear stage}. * @return linear accepting chain builder. */ public static <DATA> Stage.Builder<DATA> chain(ChainableStage<DATA> rootStage) { return new StageChainBuilder<DATA>(rootStage); }
@Override public void push(final ChainableStage<ContainerResponse> stage) { if (rootStage != null) { stage.setDefaultNext(rootStage); } rootStage = stage; }
@Override public void push(Function<ContainerResponse, ContainerResponse> responseTransformation) { rootStage = (rootStage == null) ? new Stages.LinkedStage<>(responseTransformation) : new Stages.LinkedStage<>(responseTransformation, rootStage); }
@Override public Stage<DATA> build(Stage<DATA> stage) { addTailStage(stage); return rootStage; }
/** * Create a terminal continuation from the processed data result. * * @param <DATA> processed data type. * @param result data processing result. * @return terminal continuation with no {@link Stage.Continuation#next() next} * stage in the processing chain and the supplied processing result. */ public static <DATA> Continuation<DATA> of(final DATA result) { return new Continuation<DATA>(result, null); }
/** * Releases the provided {@link RequestContext} to thread-local variable belonging to current request scope. * * @param context storage with request scoped objects. */ protected void release(RequestContext context) { context.release(); }
@Override public Continuation apply(Object o) { //noinspection unchecked return Continuation.of(o, getDefaultNext()); } };
private boolean resume(final Runnable handler) { synchronized (stateLock) { if (state != SUSPENDED) { return false; } state = RESUMED; } try { responder.runtime.requestScope.runInScope(requestContext, handler); } finally { requestContext.release(); } return true; }
/** * Start building a stage chain. * * @param transformation root transformation function. * @return linear accepting chain builder. */ public static <DATA> Stage.Builder<DATA> chain(Function<DATA, DATA> transformation) { return new StageChainBuilder<DATA>(transformation); }
@Override public void push(final ChainableStage<ContainerResponse> stage) { if (rootStage != null) { stage.setDefaultNext(rootStage); } rootStage = stage; }
@Override public void push(Function<ContainerResponse, ContainerResponse> responseTransformation) { rootStage = (rootStage == null) ? new Stages.LinkedStage<>(responseTransformation) : new Stages.LinkedStage<>(responseTransformation, rootStage); }
@Override public Stage.Builder<DATA> to(final ChainableStage<DATA> stage) { addTailStage(stage); lastStage = stage; return this; }
/** * Create a terminal continuation from the processed data result. * * @param <DATA> processed data type. * @param result data processing result. * @return terminal continuation with no {@link Stage.Continuation#next() next} * stage in the processing chain and the supplied processing result. */ public static <DATA> Continuation<DATA> of(final DATA result) { return new Continuation<DATA>(result, null); }
/** * Releases the provided {@link RequestContext} to thread-local variable belonging to current request scope. * * @param context storage with request scoped objects. */ protected void release(RequestContext context) { context.release(); }
/** * Start building a stage chain. * * @param transformation root transformation function. * @return linear accepting chain builder. */ public static <DATA> Stage.Builder<DATA> chain(Function<DATA, DATA> transformation) { return new StageChainBuilder<DATA>(transformation); }
@Override public Stage.Builder<DATA> to(final ChainableStage<DATA> stage) { addTailStage(stage); lastStage = stage; return this; }
/** * Start building a stage chain. * * @param rootStage root {@link ChainableStage chainable linear stage}. * @return linear accepting chain builder. */ public static <DATA> Stage.Builder<DATA> chain(ChainableStage<DATA> rootStage) { return new StageChainBuilder<DATA>(rootStage); }