Interface BufferCollector<B extends ManagedBuffer<?>>

Type Parameters:
B - the type of buffer that can be collected
All Known Implementing Classes:

public interface BufferCollector<B extends ManagedBuffer<?>>
Defines the method of a buffer collector.
  • Field Details


      static final BufferCollector<? extends ManagedBuffer<?>> NOOP_COLLECTOR
      A predefined buffer collector that does nothing when the managed buffer is no longer used.

      Using this collector with a managed buffer effectively make it an unmanaged buffer.

  • Method Details

    • noopCollector

      static <T extends ManagedBuffer<?>> BufferCollector<T> noopCollector()
      A type-safe way to get the NOOP_COLLECTOR.
      Type Parameters:
      T - the type of buffer that can be collected
      the noop buffer collector
    • recollect

      void recollect(B buffer)
      Recollect the buffer.

      Invoked after all locks to a managed buffer have been released. Usually, the implementation of a buffer collector returns the buffer into some kind of pool when this method is invoked.

      buffer - the buffer