Class AbstractChannelPoolMap<K, P extends ChannelPool>
java.lang.Object
io.netty.channel.pool.AbstractChannelPoolMap<K,P>
- All Implemented Interfaces:
ChannelPoolMap<K,P>, Closeable, AutoCloseable, Iterable<Map.Entry<K, P>>
public abstract class AbstractChannelPoolMap<K, P extends ChannelPool>
extends Object
implements ChannelPoolMap<K,P>, Iterable<Map.Entry<K,P>>, Closeable
A skeletal
ChannelPoolMap implementation. To find the right ChannelPool
the Object.hashCode() and Object.equals(Object) is used.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()final booleanfinal PReturn theChannelPoolfor thecode.final booleanisEmpty()iterator()protected abstract PCalled once a newChannelPoolneeds to be created as non exists yet for thekey.If the pool implementation supports asynchronous close, then use it to avoid a blocking close call in case the ChannelPoolMap operations are called from an EventLoop.final booleanRemove theChannelPoolfrom thisAbstractChannelPoolMap.removeAsyncIfSupported(K key) Remove theChannelPoolfrom thisAbstractChannelPoolMap.final intsize()Returns the number ofChannelPools currently in thisAbstractChannelPoolMap.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
map
-
-
Constructor Details
-
AbstractChannelPoolMap
public AbstractChannelPoolMap()
-
-
Method Details
-
get
Description copied from interface:ChannelPoolMapReturn theChannelPoolfor thecode. This will never returnnull, but create a newChannelPoolif non exists for they requestedkey. Please note thatnullkeys are not allowed.- Specified by:
getin interfaceChannelPoolMap<K, P extends ChannelPool>
-
remove
Remove theChannelPoolfrom thisAbstractChannelPoolMap. Returnstrueif removed,falseotherwise. If the removed pool extendsSimpleChannelPoolit will be closed asynchronously to avoid blocking in this method. Please note thatnullkeys are not allowed. -
removeAsyncIfSupported
Remove theChannelPoolfrom thisAbstractChannelPoolMap. Returns a future that comletes with atrueresult if the pool has been removed by this call, otherwise the result isfalse. If the removed pool extendsSimpleChannelPoolit will be closed asynchronously to avoid blocking in this method. The returned future will be completed once this asynchronous pool close operation completes. -
poolCloseAsyncIfSupported
If the pool implementation supports asynchronous close, then use it to avoid a blocking close call in case the ChannelPoolMap operations are called from an EventLoop.- Parameters:
pool- the ChannelPool to be closed
-
iterator
-
size
public final int size()Returns the number ofChannelPools currently in thisAbstractChannelPoolMap. -
isEmpty
public final boolean isEmpty() -
contains
Description copied from interface:ChannelPoolMap- Specified by:
containsin interfaceChannelPoolMap<K, P extends ChannelPool>
-
newPool
Called once a newChannelPoolneeds to be created as non exists yet for thekey. -
close
public final void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-