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

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

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

Transport.capacity介绍

暂无

代码示例

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

@Override
public int capacity() {
 synchronized (lock) {
   return transport.capacity();
 }
}

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

public int capacity() {
 lock.lock();
 try {
   return transport.capacity();
 } finally {
   lock.unlock();
 }
}

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

public int capacity() {
 requireHandler();
 return transport.capacity();
}

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

public void inputBuffer(ByteBuf buffer) {
 dataReceived = true;
 lock.lock();
 try {
   while (buffer.readableBytes() > 0) {
    int capacity = transport.capacity();
    if (!receivedFirstPacket) {
      handleFirstPacket(buffer);
      // there is a chance that if SASL Handshake has been carried out that the capacity may change.
      capacity = transport.capacity();
    }
    if (capacity > 0) {
      ByteBuffer tail = transport.tail();
      int min = Math.min(capacity, buffer.readableBytes());
      tail.limit(min);
      buffer.readBytes(tail);
      flush();
    } else {
      if (capacity == 0) {
       log.debugf("abandoning: readableBytes=%d", buffer.readableBytes());
      } else {
       log.debugf("transport closed, discarding: readableBytes=%d, capacity=%d", buffer.readableBytes(), transport.capacity());
      }
      break;
    }
   }
 } finally {
   lock.unlock();
 }
}

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

int capacity = _transport.capacity();
if (capacity == Transport.END_OF_STREAM)
capacity = _transport.capacity();
if (capacity > 0) {
  interest |= SelectionKey.OP_READ;

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

public void inputBuffer(ByteBuf buffer) {
 requireHandler();
 dataReceived = true;
 while (buffer.readableBytes() > 0) {
   int capacity = transport.capacity();
   if (!receivedFirstPacket) {
    handleFirstPacket(buffer);
    // there is a chance that if SASL Handshake has been carried out that the capacity may change.
    capacity = transport.capacity();
   }
   if (capacity > 0) {
    ByteBuffer tail = transport.tail();
    int min = Math.min(capacity, buffer.readableBytes());
    tail.limit(min);
    buffer.readBytes(tail);
    flush();
   } else {
    if (capacity == 0) {
      log.debugf("abandoning: readableBytes=%d", buffer.readableBytes());
    } else {
      log.debugf("transport closed, discarding: readableBytes=%d, capacity=%d", buffer.readableBytes(), transport.capacity());
    }
    break;
   }
 }
}

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

synchronized (lock) {
  while (buffer.readableBytes() > 0) {
   int capacity = transport.capacity();
        capacity = transport.capacity();
      log.debugf("transport closed, discarding: readableBytes=%d, capacity=%d", buffer.readableBytes(), transport.capacity());

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

int capacity = _transport.capacity();
if (capacity == Transport.END_OF_STREAM)
capacity = _transport.capacity();
if (capacity > 0) {
  interest |= SelectionKey.OP_READ;

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

private static int capacity(Selectable selectable) {
  Transport transport = ((SelectableImpl)selectable).getTransport();
  int capacity = transport.capacity();
  if (capacity < 0) {
    if (transport.isClosed()) {
      selectable.terminate();
    }
  }
  return capacity;
}

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

private static int capacity(Selectable selectable) {
  Transport transport = ((SelectableImpl)selectable).getTransport();
  int capacity = transport.capacity();
  if (capacity < 0) {
    if (transport.isClosed()) {
      selectable.terminate();
    }
  }
  return capacity;
}

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

@Override
  public void run(Selectable selectable) {
    Reactor reactor = selectable.getReactor();
    Transport transport = ((SelectableImpl)selectable).getTransport();
    int capacity = transport.capacity();
    if (capacity > 0) {
      SocketChannel socketChannel = (SocketChannel)selectable.getChannel();
      try {
        int n = socketChannel.read(transport.tail());
        if (n == -1) {
          transport.close_tail();
        } else {
          transport.process();
        }
      } catch (IOException | TransportException e) {
        ErrorCondition condition = new ErrorCondition();
        condition.setCondition(Symbol.getSymbol("proton:io"));
        condition.setDescription(e.getMessage());
        transport.setCondition(condition);
        transport.close_tail();
      }
    }
    // (Comment from C code:) occasionally transport events aren't
    // generated when expected, so the following hack ensures we
    // always update the selector
    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 capacity = transport.capacity();
    if (capacity > 0) {
      SocketChannel socketChannel = (SocketChannel)selectable.getChannel();
      try {
        int n = socketChannel.read(transport.tail());
        if (n == -1) {
          transport.close_tail();
        } else {
          transport.process();
        }
      } catch (IOException e) {
        ErrorCondition condition = new ErrorCondition();
        condition.setCondition(Symbol.getSymbol("proton:io"));
        condition.setDescription(e.getMessage());
        transport.setCondition(condition);
        transport.close_tail();
      }
    }
    // (Comment from C code:) occasionally transport events aren't
    // generated when expected, so the following hack ensures we
    // always update the selector
    update(selectable);
    reactor.update(selectable);
  }
};

相关文章