本文整理了Java中org.apache.qpid.proton.engine.Transport.getOutputBuffer()
方法的一些代码示例,展示了Transport.getOutputBuffer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transport.getOutputBuffer()
方法的具体详情如下:
包路径:org.apache.qpid.proton.engine.Transport
类名称:Transport
方法名:getOutputBuffer
[英]Get a read-only byte buffer containing the transport's pending output. Once the client has finished getting from the output buffer, #outputConsumed()must be called. Successive calls to this method are not guaranteed to return the same object. Once #outputConsumed() is called the buffer must not be used. If the transport's state changes AFTER calling this method, this will not be reflected in the output buffer.
[中]获取包含传输挂起的输出的只读字节缓冲区。一旦客户机完成从输出缓冲区的获取,就必须调用#outputConsumed()。对该方法的连续调用不能保证返回相同的对象。一旦调用了#outputConsumed(),就不能使用缓冲区。如果调用此方法后传输的状态发生变化,则这不会反映在输出缓冲区中。
代码示例来源:origin: org.apache.activemq/activemq-osgi
void pumpProtonToSocket() {
try {
boolean done = false;
while (!done) {
ByteBuffer toWrite = protonTransport.getOutputBuffer();
if (toWrite != null && toWrite.hasRemaining()) {
LOG.trace("Server: Sending {} bytes out", toWrite.limit());
amqpTransport.sendToAmqp(toWrite);
protonTransport.outputConsumed();
} else {
done = true;
}
}
} catch (IOException e) {
amqpTransport.onException(e);
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
void pumpProtonToSocket() {
try {
boolean done = false;
while (!done) {
ByteBuffer toWrite = protonTransport.getOutputBuffer();
if (toWrite != null && toWrite.hasRemaining()) {
LOG.trace("Server: Sending {} bytes out", toWrite.limit());
amqpTransport.sendToAmqp(toWrite);
protonTransport.outputConsumed();
} else {
done = true;
}
}
} catch (IOException e) {
amqpTransport.onException(e);
}
}
代码示例来源:origin: io.vertx/vertx-proton
void flush() {
boolean done = false;
while (!done) {
ByteBuffer outputBuffer = transport.getOutputBuffer();
if (outputBuffer != null && outputBuffer.hasRemaining()) {
final NetSocketInternal internal = (NetSocketInternal) socket;
final ByteBuf bb = internal.channelHandlerContext().alloc().directBuffer(outputBuffer.remaining());
bb.writeBytes(outputBuffer);
internal.writeMessage(bb);
transport.outputConsumed();
} else {
done = true;
}
}
}
代码示例来源:origin: apache/activemq-artemis
void pumpToProtonTransport(AsyncResult request) {
try {
boolean done = false;
while (!done) {
ByteBuffer toWrite = protonTransport.getOutputBuffer();
if (toWrite != null && toWrite.hasRemaining()) {
ByteBuf outbound = transport.allocateSendBuffer(toWrite.remaining());
outbound.writeBytes(toWrite);
transport.send(outbound);
protonTransport.outputConsumed();
} else {
done = true;
}
}
} catch (IOException e) {
fireClientException(e);
request.onFailure(e);
}
}
代码示例来源:origin: apache/qpid-jms
ByteBuffer toWrite = protonTransport.getOutputBuffer();
if (toWrite != null && toWrite.hasRemaining()) {
ByteBuf outbound = transport.allocateSendBuffer(toWrite.remaining());
代码示例来源:origin: org.apache.qpid/qpid-jms-client
ByteBuffer toWrite = protonTransport.getOutputBuffer();
if (toWrite != null && toWrite.hasRemaining()) {
ByteBuf outbound = transport.allocateSendBuffer(toWrite.remaining());
代码示例来源:origin: jboss-fuse/fabric8
@Override
public void handle(AmqpEvent event) {
switch( event.type ) {
case HEADER:
AmqpHeader header = (AmqpHeader) event.decodedFrame;
switch (header.getProtocolId()) {
case 0:
// amqpTransport.sendToAmqp(new AmqpHeader());
break; // nothing to do..
case 3:
// Client will be using SASL for auth..
sasl = protonTransport.sasl();
// sasl.setMechanisms(new String[] { "ANONYMOUS", "PLAIN" });
sasl.server();
break;
default:
}
processEvent(event);
// Les send back the AMQP response headers so that the client
// can send us the SASL init or AMQP open frames.
Buffer buffer = toBuffer(protonTransport.getOutputBuffer());
protonTransport.outputConsumed();
socket.write(buffer);
break;
default:
processEvent(event);
}
}
代码示例来源:origin: io.fabric8/gateway-core
@Override
public void handle(AmqpEvent event) {
switch( event.type ) {
case HEADER:
AmqpHeader header = (AmqpHeader) event.decodedFrame;
switch (header.getProtocolId()) {
case 0:
// amqpTransport.sendToAmqp(new AmqpHeader());
break; // nothing to do..
case 3:
// Client will be using SASL for auth..
sasl = protonTransport.sasl();
// sasl.setMechanisms(new String[] { "ANONYMOUS", "PLAIN" });
sasl.server();
break;
default:
}
processEvent(event);
// Les send back the AMQP response headers so that the client
// can send us the SASL init or AMQP open frames.
Buffer buffer = toBuffer(protonTransport.getOutputBuffer());
protonTransport.outputConsumed();
socket.write(buffer);
break;
default:
processEvent(event);
}
}
内容来源于网络,如有侵权,请联系作者删除!