Package dev.getelements.elements.rt
Interface AsyncConnectionGroup<ContextT,SocketT>
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
JeroMQAsyncConnectionGroup
Represents a group of
AsyncConnection
s 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 TypeMethodDescriptionvoid
close()
Closes allConnection
instances assocaited with thisAsyncConnectionGroup
.get
(int index) Gets theAsyncConnection
at the provided index.void
signal
(Consumer<AsyncConnectionGroup<ContextT, SocketT>> consumer) Similar toAsyncConnection.signal(Consumer)
, this executes the the suppliedConsumer
within the thread that is servicing all of the underlyingAsyncConnection
instances associated with theAsyncConnectionGroup
int
size()
Returns the number ofAsyncConnection
instances in thisAsyncConnectionGroup
.
-
Method Details
-
size
int size()Returns the number ofAsyncConnection
instances in thisAsyncConnectionGroup
.- Returns:
- the size
-
get
Gets theAsyncConnection
at the provided index. TheAsyncConnection
s 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 suppliedConsumer
within the thread that is servicing all of the underlyingAsyncConnection
instances associated with theAsyncConnectionGroup
- Parameters:
consumer
-
-
close
void close()Closes allConnection
instances assocaited with thisAsyncConnectionGroup
. Safe to call from any thread.- Specified by:
close
in interfaceAutoCloseable
-