Package io.netty.channel.pool
Class AbstractChannelPoolMap<K,P extends ChannelPool>
- java.lang.Object
-
- io.netty.channel.pool.AbstractChannelPoolMap<K,P>
-
- 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 skeletalChannelPoolMap
implementation. To find the rightChannelPool
theObject.hashCode()
andObject.equals(Object)
is used.
-
-
Constructor Summary
Constructors Constructor Description AbstractChannelPoolMap()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
contains(K key)
P
get(K key)
Return theChannelPool
for thecode
.boolean
isEmpty()
java.util.Iterator<java.util.Map.Entry<K,P>>
iterator()
protected abstract P
newPool(K key)
Called once a newChannelPool
needs to be created as non exists yet for thekey
.boolean
remove(K key)
Remove theChannelPool
from thisAbstractChannelPoolMap
.int
size()
Returns the number ofChannelPool
s currently in thisAbstractChannelPoolMap
.
-
-
-
Method Detail
-
get
public final P get(K key)
Description copied from interface:ChannelPoolMap
Return theChannelPool
for thecode
. This will never returnnull
, but create a newChannelPool
if non exists for they requestedkey
. Please note thatnull
keys are not allowed.- Specified by:
get
in interfaceChannelPoolMap<K,P extends ChannelPool>
-
remove
public final boolean remove(K key)
Remove theChannelPool
from thisAbstractChannelPoolMap
. Returnstrue
if removed,false
otherwise. If the removed pool extendsSimpleChannelPool
it will be closed asynchronously to avoid blocking in this method. Please note thatnull
keys are not allowed.
-
iterator
public final java.util.Iterator<java.util.Map.Entry<K,P>> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<K>
-
size
public final int size()
Returns the number ofChannelPool
s currently in thisAbstractChannelPoolMap
.
-
isEmpty
public final boolean isEmpty()
-
contains
public final boolean contains(K key)
Description copied from interface:ChannelPoolMap
- Specified by:
contains
in interfaceChannelPoolMap<K,P extends ChannelPool>
-
newPool
protected abstract P newPool(K key)
Called once a newChannelPool
needs to be created as non exists yet for thekey
.
-
close
public final void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-