Class EventLoopGroup

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public final class EventLoopGroup
    extends CrtResource
    This class wraps the aws_event_loop_group from aws-c-io to provide access to an event loop for the MQTT protocol stack in the AWS Common Runtime.
    • Constructor Detail

      • EventLoopGroup

        public EventLoopGroup​(int numThreads)
                       throws CrtRuntimeException
        Creates a new event loop group for the I/O subsystem to use to run non-blocking I/O requests
        Parameters:
        numThreads - The number of threads that the event loop group may run tasks across. Usually 1.
        Throws:
        CrtRuntimeException - If the system is unable to allocate space for a native event loop group
      • EventLoopGroup

        public EventLoopGroup​(int cpuGroup,
                              int numThreads)
                       throws CrtRuntimeException
        Creates a new event loop group for the I/O subsystem to use to run non-blocking I/O requests. When using this constructor, the threads will be pinned to a particular cpuGroup (e.g. a particular NUMA node).
        Parameters:
        cpuGroup - the index of the cpu group to bind to (for example NUMA node 0 would be 0, NUMA node 1 would be 1 etc...)
        numThreads - The number of threads that the event loop group may run tasks across. Usually 1.
        Throws:
        CrtRuntimeException - If the system is unable to allocate space for a native event loop group
    • Method Detail

      • getShutdownCompleteFuture

        public java.util.concurrent.CompletableFuture<java.lang.Void> getShutdownCompleteFuture()
      • setStaticDefaultNumThreads

        public static void setStaticDefaultNumThreads​(int numThreads)
        Sets the number of threads for the static default event loop group, should it ever be created. Has no effect if the static default event loop group has already been created.
        Parameters:
        numThreads - number of threads for the static default event loop group
      • closeStaticDefault

        public static void closeStaticDefault()
        Closes the static EventLoopGroup, if it exists. Primarily intended for tests that use the static default EventLoopGroup, before they call waitForNoResources().