Package software.amazon.awssdk.crt.io
Class EventLoopGroup
java.lang.Object
software.amazon.awssdk.crt.CrtResource
software.amazon.awssdk.crt.io.EventLoopGroup
- All Implemented Interfaces:
AutoCloseable
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.awssdk.crt.CrtResource
CrtResource.ResourceInstance -
Constructor Summary
ConstructorsConstructorDescriptionEventLoopGroup(int numThreads) Creates a new event loop group for the I/O subsystem to use to run non-blocking I/O requestsEventLoopGroup(int cpuGroup, int numThreads) Creates a new event loop group for the I/O subsystem to use to run non-blocking I/O requests. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCloses the static EventLoopGroup, if it exists.static voidsetStaticDefaultNumThreads(int numThreads) Sets the number of threads for the static default event loop group, should it ever be created.Methods inherited from class software.amazon.awssdk.crt.CrtResource
addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, logNativeResources, removeReferenceTo, setDescription, waitForNoResources
-
Constructor Details
-
EventLoopGroup
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
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 Details
-
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().
-