本文整理汇总了Java中io.undertow.server.handlers.BlockingHandler类的典型用法代码示例。如果您正苦于以下问题:Java BlockingHandler类的具体用法?Java BlockingHandler怎么用?Java BlockingHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockingHandler类属于io.undertow.server.handlers包,在下文中一共展示了BlockingHandler类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: wrapWithMiddleware
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
private static HttpHandler wrapWithMiddleware(HttpHandler handler) {
/*
* Undertow has I/O threads for handling inbound connections and non blocking IO.
* If you are doing any blocking you should use the BlockingHandler. This
* will push work into a separate Executor with customized thread pool
* which is made for blocking work. I am blocking immediately here because I am lazy.
* Don't block if you don't need to. Remember you can configure only certain routes block.
* When looking at logs you can tell if you are blocking or not by the thread name.
* I/O non blocking thread - [XNIO-1 I/O-{threadnum}] - You should NOT be blocking here.
* Blocking task threads - [XNIO-1 task-{threadnum}] This pool is made for blocking.
*/
return MiddlewareBuilder.begin(BlockingHandler::new)
.next(CustomHandlers::gzip)
.next(CustomHandlers::accessLog)
.next(CustomHandlers::statusCodeMetrics)
.next(MiddlewareServer::exceptionHandler)
.complete(handler);
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:19,代码来源:MiddlewareServer.java
示例2: HttpProtocolReceiver
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
public HttpProtocolReceiver(final UPID localAddress,
final Class<?> messageBaseClass,
final ManagedEventBus eventBus)
{
this.localAddress = localAddress;
this.messageBaseClass = messageBaseClass;
this.eventBus = eventBus;
final PathHandler pathHandler = new PathHandler();
pathHandler.addPrefixPath(localAddress.getId(), new CanonicalPathHandler(new BlockingHandler(this)));
this.shutdownHandler = new GracefulShutdownHandler(pathHandler);
this.httpServer = Undertow.builder()
.setIoThreads(2)
.setWorkerThreads(16)
.addHttpListener(localAddress.getPort(), localAddress.getHost())
.setHandler(shutdownHandler)
.build();
}
开发者ID:groupon,项目名称:jesos,代码行数:21,代码来源:HttpProtocolReceiver.java
示例3: buildGracefulShutdownHandler
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
/**
* buildGracefulShutdownHandler
*
* @param paths
* @return
*/
private static GracefulShutdownHandler buildGracefulShutdownHandler(PathHandler paths) {
return new GracefulShutdownHandler(
new RequestLimitingHandler(new RequestLimit(configuration.getRequestLimit()),
new AllowedMethodsHandler(
new BlockingHandler(
new GzipEncodingHandler(
new ErrorHandler(
new HttpContinueAcceptingHandler(paths)
), configuration.isForceGzipEncoding()
)
), // allowed methods
HttpString.tryFromString(RequestContext.METHOD.GET.name()),
HttpString.tryFromString(RequestContext.METHOD.POST.name()),
HttpString.tryFromString(RequestContext.METHOD.PUT.name()),
HttpString.tryFromString(RequestContext.METHOD.DELETE.name()),
HttpString.tryFromString(RequestContext.METHOD.PATCH.name()),
HttpString.tryFromString(RequestContext.METHOD.OPTIONS.name())
)
)
);
}
开发者ID:SoftInstigate,项目名称:restheart,代码行数:28,代码来源:Bootstrapper.java
示例4: wrapWithMiddleware
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
private static HttpHandler wrapWithMiddleware(HttpHandler handler) {
return MiddlewareBuilder.begin(BlockingHandler::new)
.next(CustomHandlers::gzip)
.next(ex -> CustomHandlers.accessLog(ex, log))
.next(CustomHandlers::statusCodeMetrics)
.next(WebpackServer::exceptionHandler)
.complete(handler);
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:9,代码来源:WebpackServer.java
示例5: common
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
public static HttpHandler common(HttpHandler root) {
return MiddlewareBuilder.begin(handler -> CustomHandlers.securityHeaders(handler, ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN))
.next(CustomHandlers::gzip)
.next(BlockingHandler::new)
.next(CustomHandlers::accessLog)
.next(CustomHandlers::statusCodeMetrics)
.complete(root);
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:9,代码来源:Middleware.java
示例6: wrapWithMiddleware
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
private static HttpHandler wrapWithMiddleware(HttpHandler next) {
return MiddlewareBuilder.begin(PageRoutes::redirector)
.next(handler -> CustomHandlers.securityHeaders(handler, ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN))
.next(StubbornJavaWebApp::contentSecurityPolicy)
.next(CustomHandlers::gzip)
.next(BlockingHandler::new)
.next(ex -> CustomHandlers.accessLog(ex, logger))
.next(CustomHandlers::statusCodeMetrics)
.next(StubbornJavaWebApp::exceptionHandler)
.complete(next);
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:12,代码来源:StubbornJavaWebApp.java
示例7: start
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
public void start()
{
undertow = builder.setHandler(new BlockingHandler(pathHandler)).build();
undertow.start();
}
开发者ID:jbossws,项目名称:jaxws-undertow-httpspi,代码行数:6,代码来源:UndertowServer.java
示例8: associateIdentity
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
private static HttpHandler associateIdentity(HttpHandler domainHandler, final Builder builder) {
domainHandler = new ElytronIdentityHandler(domainHandler);
return new BlockingHandler(domainHandler);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:6,代码来源:ManagementHttpServer.java
示例9: start
import io.undertow.server.handlers.BlockingHandler; //导入依赖的package包/类
private void start() {
Undertow server = Undertow.builder()
.addHttpListener(this.port, this.host, new BlockingHandler(new MyHttpHandler())).build();
server.start();
}
开发者ID:alex321v,项目名称:iln,代码行数:8,代码来源:HttpServerClient.java
注:本文中的io.undertow.server.handlers.BlockingHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论