Interface ThreadLocalHolder.Lifecycle

Enclosing class:
ThreadLocalHolder<T>

public static interface ThreadLocalHolder.Lifecycle
Optional interface that pooled instances may implement if they wish to be notified of life cycle events.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Dispose the instance and free allocated resources.
    default boolean
    Indicate whether the instance can be recycled and returned to the pool and perform the necessary recycling tasks.
  • Method Details

    • recycle

      default boolean recycle()
      Indicate whether the instance can be recycled and returned to the pool and perform the necessary recycling tasks.
      Returns:
      true if the instance can be returned to the pool, false if it must be disposed instead.
    • dispose

      default void dispose()
      Dispose the instance and free allocated resources.