Package dev.getelements.elements.rt
Interface AsyncConnectionGroup<ContextT,SocketT>
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
JeroMQAsyncConnectionGroup
Represents a group of
AsyncConnections which all are serviced by the same thread. This guarantees that
each AsyncConnection may call directly into another. Closing the group will close all
AsyncConnection instances contained therein. However it is not necessary to close the group explicitly.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes allConnectioninstances assocaited with thisAsyncConnectionGroup.get(int index) Gets theAsyncConnectionat the provided index.voidsignal(Consumer<AsyncConnectionGroup<ContextT, SocketT>> consumer) Similar toAsyncConnection.signal(Consumer), this executes the the suppliedConsumerwithin the thread that is servicing all of the underlyingAsyncConnectioninstances associated with theAsyncConnectionGroupintsize()Returns the number ofAsyncConnectioninstances in thisAsyncConnectionGroup.
-
Method Details
-
size
int size()Returns the number ofAsyncConnectioninstances in thisAsyncConnectionGroup.- Returns:
- the size
-
get
Gets theAsyncConnectionat the provided index. TheAsyncConnections will be returned in the order in whichAsyncConnectionGroup.Builder.connection(Function, Consumer)was invoked.- Parameters:
index- the index of theAsyncConnection- Returns:
- the
AsyncConnection
-
signal
Similar toAsyncConnection.signal(Consumer), this executes the the suppliedConsumerwithin the thread that is servicing all of the underlyingAsyncConnectioninstances associated with theAsyncConnectionGroup- Parameters:
consumer-
-
close
void close()Closes allConnectioninstances assocaited with thisAsyncConnectionGroup. Safe to call from any thread.- Specified by:
closein interfaceAutoCloseable
-