當前位置: 首頁>>代碼示例>>Java>>正文


Java ConduitStreamSourceChannel類代碼示例

本文整理匯總了Java中org.xnio.conduits.ConduitStreamSourceChannel的典型用法代碼示例。如果您正苦於以下問題:Java ConduitStreamSourceChannel類的具體用法?Java ConduitStreamSourceChannel怎麽用?Java ConduitStreamSourceChannel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConduitStreamSourceChannel類屬於org.xnio.conduits包,在下文中一共展示了ConduitStreamSourceChannel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRequestChannel

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
/**
 * Get the inbound request.  If there is no request body, calling this method
 * may cause the next request to immediately be processed.  The {@link StreamSourceChannel#close()} or {@link StreamSourceChannel#shutdownReads()}
 * method must be called at some point after the request is processed to prevent resource leakage and to allow
 * the next request to proceed.  Any unread content will be discarded.
 *
 * @return the channel for the inbound request, or {@code null} if another party already acquired the channel
 */
public StreamSourceChannel getRequestChannel() {
    if (requestChannel != null) {
        return null;
    }
    if (anyAreSet(state, FLAG_REQUEST_TERMINATED)) {
        return requestChannel = new ReadDispatchChannel(new ConduitStreamSourceChannel(Configurable.EMPTY, new EmptyStreamSourceConduit(getIoThread())));
    }
    final ConduitWrapper<StreamSourceConduit>[] wrappers = this.requestWrappers;
    final ConduitStreamSourceChannel sourceChannel = connection.getSourceChannel();
    if (wrappers != null) {
        this.requestWrappers = null;
        final WrapperConduitFactory<StreamSourceConduit> factory = new WrapperConduitFactory<>(wrappers, requestWrapperCount, sourceChannel.getConduit(), this);
        sourceChannel.setConduit(factory.create());
    }
    return requestChannel = new ReadDispatchChannel(sourceChannel);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:HttpServerExchange.java

示例2: exchangeComplete

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
public void exchangeComplete(final HttpServerExchange exchange) {
    if (!exchange.isUpgrade() && exchange.isPersistent()) {
        startRequest();
        ConduitStreamSourceChannel channel = ((AjpServerConnection) exchange.getConnection()).getChannel().getSourceChannel();
        channel.getReadSetter().set(this);
        channel.wakeupReads();
    } else if(!exchange.isPersistent()) {
        safeClose(exchange.getConnection());
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:AjpReadListener.java

示例3: handleEvent

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
public void handleEvent(final ConduitStreamSourceChannel channel) {
    while (requestStateUpdater.get(this) != 0) {
        //if the CAS fails it is because another thread is in the process of changing state
        //we just immediately retry
        if (requestStateUpdater.compareAndSet(this, 1, 2)) {
            channel.suspendReads();
            requestStateUpdater.set(this, 1);
            return;
        }
    }
    handleEventWithNoRunningRequest(channel);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:HttpReadListener.java

示例4: handleFailedRead

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
private void handleFailedRead(ConduitStreamSourceChannel channel, int res) {
    if (res == 0) {
        channel.setReadListener(this);
        channel.resumeReads();
    } else if (res == -1) {
        IoUtils.safeClose(connection);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:HttpReadListener.java

示例5: SpdyServerConnection

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
public SpdyServerConnection(SpdyChannel channel, SpdySynStreamStreamSourceChannel requestChannel, OptionMap undertowOptions, int bufferSize) {
    this.channel = channel;
    this.requestChannel = requestChannel;
    this.undertowOptions = undertowOptions;
    this.bufferSize = bufferSize;
    responseChannel = requestChannel.getResponseChannel();
    originalSinkConduit = new StreamSinkChannelWrappingConduit(responseChannel);
    originalSourceConduit = new StreamSourceChannelWrappingConduit(requestChannel);
    this.conduitStreamSinkChannel = new ConduitStreamSinkChannel(responseChannel, originalSinkConduit);
    this.conduitStreamSourceChannel = new ConduitStreamSourceChannel(requestChannel, originalSourceConduit);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:SpdyServerConnection.java

示例6: requestDone

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
public void requestDone() {
    if(delegate instanceof ConduitStreamSourceChannel) {
        ((ConduitStreamSourceChannel)delegate).setReadListener(null);
        ((ConduitStreamSourceChannel)delegate).setCloseListener(null);
    } else {
        delegate.getReadSetter().set(null);
        delegate.getCloseSetter().set(null);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:HttpServerExchange.java

示例7: getReadSetter

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
public ChannelListener.Setter<? extends StreamSourceChannel> getReadSetter() {
    if (readSetter == null) {
        readSetter = new ChannelListener.SimpleSetter<>();
        if (!isFinished()) {
            if(delegate instanceof ConduitStreamSourceChannel) {
                ((ConduitStreamSourceChannel)delegate).setReadListener(new SetterDelegatingListener((ChannelListener.SimpleSetter)readSetter, this));
            } else {
                delegate.getReadSetter().set(new SetterDelegatingListener((ChannelListener.SimpleSetter)readSetter, this));
            }
        }
    }
    return readSetter;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:DetachableStreamSourceChannel.java

示例8: getCloseSetter

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
public ChannelListener.Setter<? extends StreamSourceChannel> getCloseSetter() {
    if (closeSetter == null) {
        closeSetter = new ChannelListener.SimpleSetter<>();
        if (!isFinished()) {
            if(delegate instanceof ConduitStreamSourceChannel) {
                ((ConduitStreamSourceChannel)delegate).setCloseListener(ChannelListeners.delegatingChannelListener(this, closeSetter));
            } else {
                delegate.getCloseSetter().set(ChannelListeners.delegatingChannelListener(this, closeSetter));
            }
        }
    }
    return closeSetter;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:DetachableStreamSourceChannel.java

示例9: doBeginRead

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
@Override
protected void doBeginRead() throws Exception {
    StreamConnection conn = connection();
    if (conn == null) {
        return;
    }
    ConduitStreamSourceChannel source = conn.getSourceChannel();
    if (!source.isReadResumed()) {
        source.resumeReads();
    }
}
 
開發者ID:xnio,項目名稱:netty-xnio-transport,代碼行數:12,代碼來源:AbstractXnioSocketChannel.java

示例10: getSourceChannel

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
@Override
public ConduitStreamSourceChannel getSourceChannel() {
    return new ConduitStreamSourceChannel(null, null);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:ServletInitialHandler.java

示例11: getSourceChannel

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
@Override
protected ConduitStreamSourceChannel getSourceChannel() {
    return channel.getSourceChannel();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:AbstractServerConnection.java

示例12: setupRequest

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
public static void setupRequest(final HttpServerExchange exchange) {
    final HeaderMap requestHeaders = exchange.getRequestHeaders();
    final String connectionHeader = requestHeaders.getFirst(Headers.CONNECTION);
    final String transferEncodingHeader = requestHeaders.getLast(Headers.TRANSFER_ENCODING);
    final String contentLengthHeader = requestHeaders.getFirst(Headers.CONTENT_LENGTH);

    final HttpServerConnection connection = (HttpServerConnection) exchange.getConnection();
    //if we are already using the pipelineing buffer add it to the exchange
    PipeliningBufferingStreamSinkConduit pipeliningBuffer = connection.getPipelineBuffer();
    if (pipeliningBuffer != null) {
        pipeliningBuffer.setupPipelineBuffer(exchange);
    }
    ConduitStreamSourceChannel sourceChannel = connection.getChannel().getSourceChannel();
    sourceChannel.setConduit(connection.getReadDataStreamSourceConduit());

    boolean persistentConnection = persistentConnection(exchange, connectionHeader);

    if (transferEncodingHeader == null && contentLengthHeader == null) {
        if (persistentConnection
                && connection.getExtraBytes() != null
                && pipeliningBuffer == null
                && connection.getUndertowOptions().get(UndertowOptions.BUFFER_PIPELINED_DATA, false)) {
            pipeliningBuffer = new PipeliningBufferingStreamSinkConduit(connection.getOriginalSinkConduit(), connection.getBufferPool());
            connection.setPipelineBuffer(pipeliningBuffer);
            pipeliningBuffer.setupPipelineBuffer(exchange);
        }
        // no content - immediately start the next request, returning an empty stream for this one
        Connectors.terminateRequest(exchange);
    } else {
        persistentConnection = handleRequestEncoding(exchange, transferEncodingHeader, contentLengthHeader, connection, pipeliningBuffer, persistentConnection);
    }

    exchange.setPersistent(persistentConnection);

    if (!exchange.isRequestComplete() || connection.getExtraBytes() != null) {
        //if there is more data we suspend reads
        sourceChannel.setReadListener(null);
        sourceChannel.suspendReads();
    }

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:42,代碼來源:HttpTransferEncoding.java

示例13: getSourceChannel

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
@Override
protected ConduitStreamSourceChannel getSourceChannel() {
    return conduitStreamSourceChannel;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:SpdyServerConnection.java

示例14: ReadDispatchChannel

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
public ReadDispatchChannel(final ConduitStreamSourceChannel delegate) {
    super(delegate);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:4,代碼來源:HttpServerExchange.java

示例15: getSourceChannel

import org.xnio.conduits.ConduitStreamSourceChannel; //導入依賴的package包/類
@Override
public ConduitStreamSourceChannel getSourceChannel() {
    return new ConduitStreamSourceChannel(Configurable.EMPTY, new EmptyStreamSourceConduit(worker.getIoThread()));
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:5,代碼來源:InVMConnection.java


注:本文中的org.xnio.conduits.ConduitStreamSourceChannel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。