Class Netty4Utils

java.lang.Object
org.opensearch.transport.reactor.netty4.Netty4Utils

public final class Netty4Utils extends Object
Shameless copy of Netty4Utils from transport-netty4 module
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addListener(io.netty.channel.ChannelFuture channelFuture, CompletableContext<Void> context)
    Add completion listener to ChannelFuture
    static void
    setAvailableProcessors(int availableProcessors)
    Set the number of available processors that Netty uses for sizing various resources (e.g., thread pools).
    static io.netty.buffer.ByteBuf
    toByteBuf(org.opensearch.core.common.bytes.BytesReference reference)
    Turns the given BytesReference into a ByteBuf.
    static org.opensearch.core.common.bytes.BytesReference
    toBytesReference(io.netty.buffer.ByteBuf buffer)
    Wraps the given ChannelBuffer with a BytesReference

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setAvailableProcessors

      public static void setAvailableProcessors(int availableProcessors)
      Set the number of available processors that Netty uses for sizing various resources (e.g., thread pools).
      Parameters:
      availableProcessors - the number of available processors
      Throws:
      IllegalStateException - if available processors was set previously and the specified value does not match the already-set value
    • toByteBuf

      public static io.netty.buffer.ByteBuf toByteBuf(org.opensearch.core.common.bytes.BytesReference reference)
      Turns the given BytesReference into a ByteBuf. Note: the returned ByteBuf will reference the internal pages of the BytesReference. Don't free the bytes of reference before the ByteBuf goes out of scope.
      Parameters:
      reference - reference to convert
    • toBytesReference

      public static org.opensearch.core.common.bytes.BytesReference toBytesReference(io.netty.buffer.ByteBuf buffer)
      Wraps the given ChannelBuffer with a BytesReference
      Parameters:
      buffer - buffer to convert
    • addListener

      public static void addListener(io.netty.channel.ChannelFuture channelFuture, CompletableContext<Void> context)
      Add completion listener to ChannelFuture
      Parameters:
      channelFuture - ChannelFuture to add listener to
      context - completion listener context