Package dev.getelements.elements.rt
Interface AsyncConnectionService<ContextT,SocketT>
- All Known Implementing Classes:
JeroMQAsyncConnectionService,SharedAsyncConnectionService
public interface AsyncConnectionService<ContextT,SocketT>
A system-wide service to house
AsyncConnection instances. Each instance of AsyncConnection is
managed internally and callbacks issued on a background thread dedicated to that as well as other Connection
instances.-
Method Summary
Modifier and TypeMethodDescriptiondefault AsyncConnectionPool<ContextT, SocketT> allocatePool(int minConnections, int maxConnections, Function<ContextT, SocketT> socketSupplier) Allocates an instance ofAsyncConnectionPool.allocatePool(String name, int minConnections, int maxConnections, Function<ContextT, SocketT> socketSupplier) Allocates an instance ofAsyncConnectionPool.default AsyncConnectionGroup.Builder<ContextT, SocketT> group()Creates an anonymous group.Returns aAsyncConnectionGroup.Builderwhich can be used to build an instance ofAsyncConnectionGroupfor managing closely relatedAsyncConnectioninstances.voidstart()Starts theAsyncConnectionService<ContextT,.SocketT> voidstop()Stops theAsyncConnectionService<ContextT,.SocketT>
-
Method Details
-
start
void start()Starts theAsyncConnectionService<ContextT,.SocketT> -
stop
void stop()Stops theAsyncConnectionService<ContextT,.SocketT> -
group
Creates an anonymous group.- Returns:
- the
AsyncConnectionGroup.Builder<ContextT,SocketT>
-
group
Returns aAsyncConnectionGroup.Builderwhich can be used to build an instance ofAsyncConnectionGroupfor managing closely relatedAsyncConnectioninstances.- Parameters:
name- the name of the pool (used for logging and debugging)- Returns:
- the
AsyncConnectionGroup.Builder
-
allocatePool
default AsyncConnectionPool<ContextT,SocketT> allocatePool(int minConnections, int maxConnections, Function<ContextT, SocketT> socketSupplier) Allocates an instance ofAsyncConnectionPool.- Parameters:
minConnections-maxConnections-socketSupplier-- Returns:
-
allocatePool
AsyncConnectionPool<ContextT,SocketT> allocatePool(String name, int minConnections, int maxConnections, Function<ContextT, SocketT> socketSupplier) Allocates an instance ofAsyncConnectionPool.- Parameters:
name-minConnections-maxConnections-socketSupplier-- Returns:
-