Interface AsyncPool<T>

    • Method Detail

      • acquire

        CompletableFuture<T> acquire()
        Acquire an object from this AsyncPool. The returned CompletableFuture is notified once the acquire is successful and failed otherwise. Behavior upon acquiring objects from an exhausted pool depends on the actual pool implementation whether requests are rejected immediately (exceptional completion with NoSuchElementException) or delayed after exceeding a particular timeout ( TimeoutException). It's required that an acquired object is always released to the pool again once the object is no longer in use..
      • release

        CompletableFuture<Void> release​(T object)
        Release an object back to this AsyncPool. The returned CompletableFuture is notified once the release is successful and failed otherwise. When failed the object will automatically disposed.
        Parameters:
        object - the object to be released. The object must have been acquired from this pool.
      • clear

        void clear()
        Clear the pool.