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

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

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

Transport.pop介绍

暂无

代码示例

代码示例来源:origin: org.apache.activemq/artemis-proton-plug

@Override
public void outputDone(int bytes) {
 synchronized (lock) {
   transport.pop(bytes);
   offset -= bytes;
   if (offset < 0) {
    throw new IllegalStateException("You called outputDone for more bytes than you actually received. numberOfBytes=" + bytes +
                      ", outcome result=" + offset);
   }
 }
 flush();
}

代码示例来源:origin: EnMasseProject/enmasse

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);
  }
}

代码示例来源:origin: org.apache.qpid/proton-j-impl

private boolean write() throws IOException
{
  boolean processed = false;
  int interest = _key.interestOps();
  int pending = _transport.pending();
  if (pending >= 0)
  {
    int wrote = _channel.write(_transport.head());
    if (wrote > 0) {
      processed = true;
      _transport.pop(wrote);
    }
  }
  else
  {
    _outputDone = true;
  }
  pending = _transport.pending();
  if (pending > 0) {
    interest |= SelectionKey.OP_WRITE;
  } else {
    interest &= ~SelectionKey.OP_WRITE;
    if (pending < 0) {
      _outputDone = true;
    }
  }
  _key.interestOps(interest);
  return processed;
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

if (wrote > 0) {
  processed = true;
  _transport.pop(wrote);
} else {
  writeBlocked = true;

代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol

public void flushBytes() {
 for (EventHandler handler : handlers) {
   if (!handler.flowControl(readyListener)) {
    return;
   }
 }
 lock.lock();
 try {
   while (true) {
    ByteBuffer head = transport.head();
    int pending = head.remaining();
    if (pending <= 0) {
      break;
    }
    // We allocated a Pooled Direct Buffer, that will be sent down the stream
    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.directBuffer(pending);
    buffer.writeBytes(head);
    for (EventHandler handler : handlers) {
      handler.pushBytes(buffer);
    }
    transport.pop(pending);
   }
 } finally {
   lock.unlock();
 }
}

代码示例来源:origin: org.apache.qpid/proton-j

transport.close_tail();
transport.close_head();
transport.pop(Math.max(0, transport.pending())); // Force generation of TRANSPORT_HEAD_CLOSE (not in C code)

代码示例来源:origin: com.ibm.mqlight/mqlight-api

private void writeToNetwork(EngineConnection engineConnection) {
 final String methodName = "writeToNetwork";
 logger.entry(this, methodName, engineConnection);
  if (engineConnection.transport.pending() > 0) {
    ByteBuffer head = engineConnection.transport.head();
    int amount = head.remaining();
    engineConnection.channel.write(head, new NetworkWritePromiseImpl(this, amount, engineConnection));
    engineConnection.transport.pop(amount);
    engineConnection.transport.tick(System.currentTimeMillis());
  }
  logger.exit(this, methodName);
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

transport.close_tail();
transport.close_head();
transport.pop(transport.pending());

代码示例来源:origin: apache/activemq-artemis

private void actualFlush() {
 requireHandler();
 for (EventHandler handler : handlers) {
   if (!handler.flowControl(readyListener)) {
    scheduledFlush = false;
    return;
   }
 }
 try {
   while (true) {
    ByteBuffer head = transport.head();
    int pending = head.remaining();
    if (pending <= 0) {
      break;
    }
    // We allocated a Pooled Direct Buffer, that will be sent down the stream
    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.directBuffer(pending);
    buffer.writeBytes(head);
    for (EventHandler handler : handlers) {
      handler.pushBytes(buffer);
    }
    transport.pop(pending);
   }
 } finally {
   scheduledFlush = false;
 }
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

transport.close_tail();
transport.close_head();
transport.pop(transport.pending());   // Force generation of TRANSPORT_HEAD_CLOSE (not in C code)

代码示例来源:origin: org.apache.qpid/proton-j

transport.close_tail();
transport.close_head();
transport.pop(Math.max(0, transport.pending())); // Force generation of TRANSPORT_HEAD_CLOSE (not in C code)

代码示例来源:origin: org.apache.qpid/proton-j

@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);
    }
  }
};

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

@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);
    }
  }
};

相关文章