org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf.release()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(180)

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

ByteBuf.release介绍

暂无

代码示例

代码示例来源:origin: apache/flink

@Override
public void close() throws Exception {
  if (!isClosed) {
    // If we did not consume the whole buffer yet, we have to release
    // it here. Otherwise, it's the responsibility of the consumer.
    if (!isEndOfInput) {
      buf.release();
    }
    isClosed = true;
  }
}

代码示例来源:origin: apache/flink

@Override
  public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
    ByteBuf buf = (ByteBuf) msg;
    assertEquals(MessageType.REQUEST, MessageSerializer.deserializeHeader(buf));
    long requestId = MessageSerializer.getRequestId(buf);
    KvStateInternalRequest request = serializer.deserializeRequest(buf);
    buf.release();
    KvStateResponse response = new KvStateResponse(serializedResult);
    ByteBuf serResponse = MessageSerializer.serializeResponse(
        ctx.alloc(),
        requestId,
        response);
    ctx.channel().writeAndFlush(serResponse);
  }
});

代码示例来源:origin: apache/flink

buf.release();
buf.release();

代码示例来源:origin: apache/flink

KvStateInternalRequest deserRequest = serializer.deserializeRequest(buf);
buf.release();

代码示例来源:origin: com.alibaba.blink/flink-runtime

void releaseBuffer() {
  if (buffer != null) {
    buffer.release();
  }
}

代码示例来源:origin: org.apache.flink/flink-queryable-state-client-java_2.11

@Override
public void close() throws Exception {
  if (!isClosed) {
    // If we did not consume the whole buffer yet, we have to release
    // it here. Otherwise, it's the responsibility of the consumer.
    if (!isEndOfInput) {
      buf.release();
    }
    isClosed = true;
  }
}

代码示例来源:origin: com.alibaba.blink/flink-queryable-state-client-java

@Override
public void close() throws Exception {
  if (!isClosed) {
    // If we did not consume the whole buffer yet, we have to release
    // it here. Otherwise, it's the responsibility of the consumer.
    if (!isEndOfInput) {
      buf.release();
    }
    isClosed = true;
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

void releaseBuffer() {
  buffer.release();
}

代码示例来源:origin: org.apache.flink/flink-runtime

void releaseBuffer() {
  buffer.release();
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
ByteBuf write(ByteBufAllocator allocator) throws Exception {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16);
    receiverId.writeTo(result);
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
  return result;
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
ByteBuf write(ByteBufAllocator allocator) throws Exception {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16);
    receiverId.writeTo(result);
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
  return result;
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
ByteBuf write(ByteBufAllocator allocator) throws Exception {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16);
    receiverId.writeTo(result);
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
  return result;
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

/**
 * Releases all pending resources when the handler exits.
 *
 * @param ctx the channel handler context.
 */
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  LOG.info("Channel get inactive, currentNettyMessage = {}", currentNettyMessage);
  super.channelInactive(ctx);
  if (currentNettyMessage != null
      && currentNettyMessage instanceof NettyMessage.BufferResponse
      && ((NettyMessage.BufferResponse) currentNettyMessage).getBuffer() != null) {
    ((NettyMessage.BufferResponse) currentNettyMessage).getBuffer().release();
  }
  currentNettyMessage = null;
  frameHeaderBuffer.release();
  messageHeaderBuffer.release();
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
ByteBuf write(ByteBufAllocator allocator) throws IOException {
  final ByteBuf result = allocateBuffer(allocator, ID);
  try (ObjectOutputStream oos = new ObjectOutputStream(new ByteBufOutputStream(result))) {
    oos.writeObject(cause);
    if (receiverId != null) {
      result.writeBoolean(true);
      receiverId.writeTo(result);
    } else {
      result.writeBoolean(false);
    }
    // Update frame length...
    result.setInt(0, result.readableBytes());
    return result;
  }
  catch (Throwable t) {
    result.release();
    if (t instanceof IOException) {
      throw (IOException) t;
    } else {
      throw new IOException(t);
    }
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
ByteBuf write(ByteBufAllocator allocator) throws IOException {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16 + 16 + 4 + 16);
    partitionId.getPartitionId().writeTo(result);
    partitionId.getProducerId().writeTo(result);
    result.writeInt(credit);
    receiverId.writeTo(result);
    return result;
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
ByteBuf write(ByteBufAllocator allocator) throws IOException {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16 + 16 + 4 + 16);
    partitionId.getPartitionId().writeTo(result);
    partitionId.getProducerId().writeTo(result);
    result.writeInt(credit);
    receiverId.writeTo(result);
    return result;
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
ByteBuf write(ByteBufAllocator allocator) throws IOException {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16 + 16 + 4 + 16);
    partitionId.getPartitionId().writeTo(result);
    partitionId.getProducerId().writeTo(result);
    result.writeInt(credit);
    receiverId.writeTo(result);
    return result;
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
ByteBuf write(ByteBufAllocator allocator) throws IOException {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16 + 16 + 4 + 16 + 4);
    partitionId.getPartitionId().writeTo(result);
    partitionId.getProducerId().writeTo(result);
    result.writeInt(queueIndex);
    receiverId.writeTo(result);
    result.writeInt(credit);
    return result;
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
ByteBuf write(ByteBufAllocator allocator) throws IOException {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16 + 16 + 4 + 16 + 4);
    partitionId.getPartitionId().writeTo(result);
    partitionId.getProducerId().writeTo(result);
    result.writeInt(queueIndex);
    receiverId.writeTo(result);
    result.writeInt(credit);
    return result;
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
ByteBuf write(ByteBufAllocator allocator) throws IOException {
  ByteBuf result = null;
  try {
    result = allocateBuffer(allocator, ID, 16 + 16 + 4 + 16 + 4);
    partitionId.getPartitionId().writeTo(result);
    partitionId.getProducerId().writeTo(result);
    result.writeInt(queueIndex);
    receiverId.writeTo(result);
    result.writeInt(credit);
    return result;
  }
  catch (Throwable t) {
    if (result != null) {
      result.release();
    }
    throw new IOException(t);
  }
}

相关文章