Package org.apache.activeio.packet
Class PacketPool
- java.lang.Object
-
- org.apache.activeio.packet.PacketPool
-
- Direct Known Subclasses:
ByteBufferPacketPool
public abstract class PacketPool extends java.lang.Object
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 $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PacketPool.PooledPacket
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PACKET_SIZE
static int
DEFAULT_POOL_SIZE
-
Constructor Summary
Constructors Constructor Description PacketPool(int maxPackets)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Packet
allocateNewPacket()
void
dispose()
Packet
getPacket()
Blocks until a ByteBuffer can be retreived from the pool.void
waitForPacketsToReturn()
-
-
-
Method Detail
-
getPacket
public Packet getPacket() throws java.lang.InterruptedException
Blocks until a ByteBuffer can be retreived from the pool.- Returns:
- Throws:
java.lang.InterruptedException
-
dispose
public void dispose()
-
waitForPacketsToReturn
public void waitForPacketsToReturn()
-
allocateNewPacket
protected abstract Packet allocateNewPacket()
- Returns:
-
-