org.activeio.packet
Class PacketPool
java.lang.Object
org.activeio.packet.PacketPool
- All Implemented Interfaces:
- Disposable
- Direct Known Subclasses:
- ByteBufferPacketPool
- public abstract class PacketPool
- extends Object
- implements Disposable
Provides a simple pool of Packet objects. When the packets that this pool produces are disposed,
they are returned to the pool.
- Version:
- $Revision: 1.1 $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_POOL_SIZE
public static final int DEFAULT_POOL_SIZE
DEFAULT_PACKET_SIZE
public static final int DEFAULT_PACKET_SIZE
PacketPool
public PacketPool(int maxPackets)
- Parameters:
maxPackets
- the number of buffers that will be in the pool.
getPacket
public Packet getPacket()
throws InterruptedException
- Blocks until a ByteBuffer can be retreived from the pool.
- Returns:
-
- Throws:
InterruptedException
dispose
public void dispose()
- Description copied from interface:
Disposable
- This method should not throw any exceptions. Cleaning up a Disposable object
should be easy of an end user therefore do not make him have to handle an Exception.
- Specified by:
dispose
in interface Disposable
waitForPacketsToReturn
public void waitForPacketsToReturn()
allocateNewPacket
protected abstract Packet allocateNewPacket()
- Returns:
Copyright © -2007 The ActiveIO Project. All Rights Reserved.