本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}