Top Description Fields Constructors Methods
io.netty.channel.pool

public abstract Class AbstractChannelPoolMap<K, P extends io.netty.channel.pool.ChannelPool>

extends Object
implements ChannelPoolMap<K, P extends ChannelPool>, Iterable<Map.Entry<K, P extends ChannelPool>>, Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable, java.lang.Iterable, io.netty.channel.pool.ChannelPoolMap
Imports
io.netty.util.concurrent.Future, .GenericFutureListener, .GlobalEventExecutor, .Promise, io.netty.util.internal.PlatformDependent, .ReadOnlyIterator, java.io.Closeable, java.util.Iterator, .Map.Entry, java.util.concurrent.ConcurrentMap

A skeletal ChannelPoolMap implementation. To find the right ChannelPool the Object#hashCode() and Object#equals(Object) is used.

Field Summary

Modifier and TypeField and Description
private final ConcurrentMap<K, P>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public final boolean
contains(K key)

Implements io.netty.channel.pool.ChannelPoolMap.contains.

Returns true if a ChannelPool exists for the given key.
public final P
get(K key)

Implements io.netty.channel.pool.ChannelPoolMap.get.

Return the ChannelPool for the code.
public final boolean
isEmpty()

Returns true if the AbstractChannelPoolMap is empty, otherwise false.

public final Iterator<Map.Entry<K, P>>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
protected abstract P
newPool(K key)

Called once a new ChannelPool needs to be created as non exists yet for the key.

private static Future<Void>
poolCloseAsyncIfSupported(ChannelPool
the ChannelPool to be closed
pool
)

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.

public final boolean
remove(K key)

Remove the ChannelPool from this AbstractChannelPoolMap.

private Future<Boolean>
public final int
size()

Returns the number of ChannelPools currently in this AbstractChannelPoolMap.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private final ConcurrentMap<K, P> map

Constructor Detail

AbstractChannelPoolMapback to summary
public AbstractChannelPoolMap()

Method Detail

closeback to summary
public final void close()

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
containsback to summary
public final boolean contains(K key)

Implements io.netty.channel.pool.ChannelPoolMap.contains.

Doc from io.netty.channel.pool.ChannelPoolMap.contains.

Returns true if a ChannelPool exists for the given key. Please note that null keys are not allowed.

Annotations
@Override
getback to summary
public final P get(K key)

Implements io.netty.channel.pool.ChannelPoolMap.get.

Doc from io.netty.channel.pool.ChannelPoolMap.get.

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.

Annotations
@Override
isEmptyback to summary
public final boolean isEmpty()

Returns true if the AbstractChannelPoolMap is empty, otherwise false.

iteratorback to summary
public final Iterator<Map.Entry<K, P>> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<Map.Entry<K, P>>

an Iterator.

Annotations
@Override
newPoolback to summary
protected abstract P newPool(K key)

Called once a new ChannelPool needs to be created as non exists yet for the key.

poolCloseAsyncIfSupportedback to summary
private static Future<Void> poolCloseAsyncIfSupported(ChannelPool pool)

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:ChannelPool

the ChannelPool to be closed

removeback to summary
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.

removeAsyncIfSupportedback to summary
private Future<Boolean> removeAsyncIfSupported(K key)

Remove the ChannelPool from this AbstractChannelPoolMap. Returns a future that comletes with a true result if the pool has been removed by this call, otherwise the result is false. If the removed pool extends SimpleChannelPool it will be closed asynchronously to avoid blocking in this method. The returned future will be completed once this asynchronous pool close operation completes.

sizeback to summary
public final int size()

Returns the number of ChannelPools currently in this AbstractChannelPoolMap.