Class ObjectPool<DATATYPE>

    • Constructor Detail

      • ObjectPool

        public ObjectPool​(@Nonnegative
                          int nItemCount,
                          @Nonnull
                          Supplier<? extends DATATYPE> aFactory)
        Create a new object pool for a certain amount of items and a factory that creates the objects on demand.
        Parameters:
        nItemCount - The number of items in the pool. Must be ≥ 1.
        aFactory - The factory to create object. May not be null. The factory may not create null objects, as this leads to an error!
      • ObjectPool

        public ObjectPool​(@Nonnegative
                          int nItemCount,
                          @Nonnull
                          IObjectPoolFactory<DATATYPE> aFactory)
        Create a new object pool for a certain amount of items and a factory that creates the objects on demand.
        Parameters:
        nItemCount - The number of items in the pool. Must be ≥ 1.
        aFactory - The factory to create object. May not be null. The factory may not create null objects, as this leads to an error!
    • Method Detail

      • isSilentMode

        public static boolean isSilentMode()
        Returns:
        true if logging is disabled, false if it is enabled.
        Since:
        9.4.0
      • setSilentMode

        public static boolean setSilentMode​(boolean bSilentMode)
        Enable or disable certain regular log messages.
        Parameters:
        bSilentMode - true to disable logging, false to enable logging
        Returns:
        The previous value of the silent mode.
        Since:
        9.4.0
      • getBorrowedObjectCount

        @Nonnegative
        public int getBorrowedObjectCount()
        Returns:
        The number of objects currently borrowed from the pool. Something between 0 and getPoolSize()
        Since:
        11.0.6
        See Also:
        getPoolSize()
      • clearUnusedItems

        public void clearUnusedItems()