public abstract class AbstractChannelPoolMap<K,P extends ChannelPool> extends Object implements ChannelPoolMap<K,P>, Iterable<Map.Entry<K,P>>, Closeable
ChannelPoolMap
implementation. To find the right ChannelPool
the Object.hashCode()
and Object.equals(Object)
is used.Constructor and Description |
---|
AbstractChannelPoolMap() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
contains(K key)
|
P |
get(K key)
Return the
ChannelPool for the code . |
boolean |
isEmpty()
|
Iterator<Map.Entry<K,P>> |
iterator() |
protected abstract P |
newPool(K key)
Called once a new
ChannelPool needs to be created as non exists yet for the key . |
boolean |
remove(K key)
Remove the
ChannelPool from this AbstractChannelPoolMap . |
int |
size()
Returns the number of
ChannelPool s currently in this AbstractChannelPoolMap . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public final P get(K key)
ChannelPoolMap
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.get
in interface ChannelPoolMap<K,P extends ChannelPool>
public final boolean remove(K key)
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.public final int size()
ChannelPool
s currently in this AbstractChannelPoolMap
.public final boolean isEmpty()
public final boolean contains(K key)
ChannelPoolMap
contains
in interface ChannelPoolMap<K,P extends ChannelPool>
protected abstract P newPool(K key)
ChannelPool
needs to be created as non exists yet for the key
.public final void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2008–2024 The Netty Project. All rights reserved.