Interface ClientGroup<Key,​Client extends ListenableAsyncCloseable>

    • Method Detail

      • get

        Client get​(Key key)
        Return the ClientGroup identified by the provided key or create a new one when none exists.
        Parameters:
        key - the key identifying the client to return or create, this key may contain attributes about the requested client in order to create new instances
        Returns:
        a client assigned to the provided key, either by looking up an existing or creating a new instance if non-existent
      • from

        static <Key,​Client extends ListenableAsyncCloseableClientGroup<Key,​Client> from​(java.util.function.Function<Key,​Client> factory)
        Creates a ClientGroup based on a factory of clients of type Client.
        Type Parameters:
        Key - the type of key used for client lookup and creation
        Client - the type of client stored in the group
        Parameters:
        factory - Function will be called every time get(Object) is called with a non-existent ClientGroup.
        Returns:
        a ClientGroup based on a @{code factory} of clients of type ClientGroup.