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


Java Transport.pop方法代码示例

本文整理汇总了Java中org.apache.qpid.proton.engine.Transport.pop方法的典型用法代码示例。如果您正苦于以下问题:Java Transport.pop方法的具体用法?Java Transport.pop怎么用?Java Transport.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.qpid.proton.engine.Transport的用法示例。


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

示例1: pumpOnce

import org.apache.qpid.proton.engine.Transport; //导入方法依赖的package包/类
private int pumpOnce(Transport transportFrom, String fromRole, Transport transportTo, String toRole)
{
    int outputLength = transportFrom.pending();
    if (outputLength > 0)
    {
        ByteBuffer outputBuffer = transportFrom.head();

        int remaining = outputBuffer.remaining();
        assertTrue("Unexpected remaining in buffer: " + remaining + " vs " + outputLength, remaining >= outputLength);

        byte[] output = new byte[remaining];
        outputBuffer.get(output);

        transportFrom.pop(remaining);

        ByteBuffer inputBuffer = transportTo.getInputBuffer();
        inputBuffer.put(output, 0, output.length);

        TransportResult result = transportTo.processInput();
        result.checkIsOk();
    }

    return outputLength;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:25,代码来源:TransportPumper.java

示例2: writeToNetwork

import org.apache.qpid.proton.engine.Transport; //导入方法依赖的package包/类
private void writeToNetwork(Connection connection, OutputStream out) throws IOException {
    Transport transport = connection.getTransport();
    while(transport.pending() > 0)
    {
        ByteBuffer outputBuf = transport.head();
        final int size = outputBuf.remaining();
        byte[] tmpBuf = new byte[size];
        outputBuf.get(tmpBuf);
        LOG.tracev("writing {0} bytes", size);
        out.write(tmpBuf);
        transport.pop(size);
    }
}
 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:14,代码来源:SaslDelegatingLogin.java

示例3: run

import org.apache.qpid.proton.engine.Transport; //导入方法依赖的package包/类
@Override
public void run(Selectable selectable) {
    Reactor reactor = selectable.getReactor();
    Transport transport = ((SelectableImpl)selectable).getTransport();
    int pending = transport.pending();
    if (pending > 0) {
        SocketChannel channel = (SocketChannel)selectable.getChannel();
        try {
            int n = channel.write(transport.head());
            if (n < 0) {
                transport.close_head();
            } else {
                transport.pop(n);
            }
        } catch(IOException ioException) {
            ErrorCondition condition = new ErrorCondition();
            condition.setCondition(Symbol.getSymbol("proton:io"));
            condition.setDescription(ioException.getMessage());
            transport.setCondition(condition);
            transport.close_head();
        }
    }

    int newPending = transport.pending();
    if (newPending != pending) {
        update(selectable);
        reactor.update(selectable);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:30,代码来源:IOHandler.java


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