Class AbstractChannelPoolMap<K,​P extends ChannelPool>

  • All Implemented Interfaces:
    ChannelPoolMap<K,​P>, java.io.Closeable, java.lang.AutoCloseable, java.lang.Iterable<java.util.Map.Entry<K,​P>>

    public abstract class AbstractChannelPoolMap<K,​P extends ChannelPool>
    extends java.lang.Object
    implements ChannelPoolMap<K,​P>, java.lang.Iterable<java.util.Map.Entry<K,​P>>, java.io.Closeable
    A skeletal ChannelPoolMap implementation. To find the right ChannelPool the Object.hashCode() and Object.equals(Object) is used.
    • Constructor Detail

      • AbstractChannelPoolMap

        public AbstractChannelPoolMap()
    • Method Detail

      • get

        public final P get​(K key)
        Description copied from interface: ChannelPoolMap
        Return the ChannelPool for the code. This will never return null, but create a new ChannelPool if non exists for they requested key. Please note that null keys are not allowed.
        Specified by:
        get in interface ChannelPoolMap<K,​P extends ChannelPool>
      • remove

        public final boolean remove​(K key)
        Remove the ChannelPool from this AbstractChannelPoolMap. Returns true if removed, false otherwise. If the removed pool extends SimpleChannelPool it will be closed asynchronously to avoid blocking in this method. Please note that null keys are not allowed.
      • iterator

        public final java.util.Iterator<java.util.Map.Entry<K,​P>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<K>
      • isEmpty

        public final boolean isEmpty()
        Returns true if the AbstractChannelPoolMap is empty, otherwise false.
      • newPool

        protected abstract P newPool​(K key)
        Called once a new ChannelPool needs to be created as non exists yet for the key.
      • close

        public final void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable