当前位置: 首页>>代码示例>>Java>>正文


Java SameThreadExecutor类代码示例

本文整理汇总了Java中io.undertow.util.SameThreadExecutor的典型用法代码示例。如果您正苦于以下问题:Java SameThreadExecutor类的具体用法?Java SameThreadExecutor怎么用?Java SameThreadExecutor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SameThreadExecutor类属于io.undertow.util包,在下文中一共展示了SameThreadExecutor类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AsyncContextImpl

import io.undertow.util.SameThreadExecutor; //导入依赖的package包/类
public AsyncContextImpl(final HttpServerExchange exchange, final ServletRequest servletRequest, final ServletResponse servletResponse, final ServletRequestContext servletRequestContext, boolean requestSupplied, final AsyncContextImpl previousAsyncContext) {
    this.exchange = exchange;
    this.servletRequest = servletRequest;
    this.servletResponse = servletResponse;
    this.servletRequestContext = servletRequestContext;
    this.requestSupplied = requestSupplied;
    this.previousAsyncContext = previousAsyncContext;
    initiatingThread = Thread.currentThread();
    exchange.dispatch(SameThreadExecutor.INSTANCE, new Runnable() {
        @Override
        public void run() {
            exchange.setDispatchExecutor(null);
            initialRequestDone();
        }
    });
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:AsyncContextImpl.java

示例2: parse

import io.undertow.util.SameThreadExecutor; //导入依赖的package包/类
@Override
public void parse(HttpHandler handler) throws Exception {
    if (exchange.getAttachment(FORM_DATA) != null) {
        handler.handleRequest(exchange);
        return;
    }
    this.handler = handler;
    StreamSourceChannel channel = exchange.getRequestChannel();
    if (channel == null) {
        throw new IOException(UndertowMessages.MESSAGES.requestChannelAlreadyProvided());
    } else {
        doParse(channel);
        if (state != 4) {
            channel.getReadSetter().set(this);
            channel.resumeReads();
        } else {
            exchange.dispatch(SameThreadExecutor.INSTANCE, handler);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:FormEncodedDataDefinition.java

示例3: handleRequest

import io.undertow.util.SameThreadExecutor; //导入依赖的package包/类
public void handleRequest(final HttpServerExchange exchange, final HttpHandler next) throws Exception {
    long oldVal, newVal;
    do {
        oldVal = state;
        final long current = oldVal & MASK_CURRENT;
        final long max = (oldVal & MASK_MAX) >> 32L;
        if (current >= max) {
            exchange.dispatch(SameThreadExecutor.INSTANCE, new Runnable() {
                @Override
                public void run() {
                    if (!queue.offer(new SuspendedRequest(exchange, next))) {
                        Connectors.executeRootHandler(failureHandler, exchange);
                    }
                }
            });
            return;
        }
        newVal = oldVal + 1;
    } while (!stateUpdater.compareAndSet(this, oldVal, newVal));
    exchange.addExchangeCompleteListener(COMPLETION_LISTENER);
    next.handleRequest(exchange);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:RequestLimit.java

示例4: handleEvent

import io.undertow.util.SameThreadExecutor; //导入依赖的package包/类
@Override
public void handleEvent(final StreamSourceChannel channel) {
    try {
        doParse(channel);
        if (state == 4) {
            exchange.dispatch(SameThreadExecutor.INSTANCE, handler);
        }
    } catch (IOException e) {
        IoUtils.safeClose(channel);
        UndertowLogger.REQUEST_LOGGER.ioExceptionReadingFromChannel(e);
        exchange.endExchange();

    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:FormEncodedDataDefinition.java

示例5: handleRequest

import io.undertow.util.SameThreadExecutor; //导入依赖的package包/类
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
    if(!exchange.isRequestComplete()) {
        exchange.dispatch(SameThreadExecutor.INSTANCE, new Runnable() {
            @Override
            public void run() {
                new StringReadChannelListener(exchange.getConnection().getBufferPool()) {
                    @Override
                    protected void stringDone(String string) {
                        exchange.putAttachment(DATA, string);
                        Connectors.executeRootHandler(next, exchange);
                    }

                    @Override
                    protected void error(IOException e) {
                        UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
                        exchange.setResponseCode(500);
                        exchange.endExchange();
                    }
                }.setup(exchange.getRequestChannel());
            }
        });

    } else {
        next.handleRequest(exchange);
    }


}
 
开发者ID:undertow-io,项目名称:undertow.js,代码行数:30,代码来源:StringReadHandler.java

示例6: completed

import io.undertow.util.SameThreadExecutor; //导入依赖的package包/类
@Override
public void completed(final HttpServerExchange exchange, final ProxyConnection connection) {
    exchange.putAttachment(CONNECTION, connection);
    exchange.dispatch(SameThreadExecutor.INSTANCE, new ProxyAction(connection, exchange, requestHeaders, rewriteHostHeader, reuseXForwarded));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:ProxyHandler.java


注:本文中的io.undertow.util.SameThreadExecutor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。