org.apache.qpid.proton.engine.Transport.outputConsumed()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中org.apache.qpid.proton.engine.Transport.outputConsumed()方法的一些代码示例,展示了Transport.outputConsumed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transport.outputConsumed()方法的具体详情如下:
包路径:org.apache.qpid.proton.engine.Transport
类名称:Transport
方法名:outputConsumed

Transport.outputConsumed介绍

[英]Informs the transport that the output buffer returned by #getOutputBuffer()is finished with, allowing implementation-dependent steps to be performed such as reclaiming buffer space.
[中]通知传输#getOutputBuffer()返回的输出缓冲区已完成,允许执行依赖于实现的步骤,例如回收缓冲区空间。

代码示例

代码示例来源: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

protonTransport.outputConsumed();
} else {
  done = true;

代码示例来源:origin: org.apache.qpid/qpid-jms-client

protonTransport.outputConsumed();
} else {
  done = true;

代码示例来源: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);
  }
}

相关文章