org.apache.hadoop.chukwa.datacollection.agent
Class MemLimitQueue

java.lang.Object
  extended by org.apache.hadoop.chukwa.datacollection.agent.MemLimitQueue
All Implemented Interfaces:
ChunkQueue, ChunkReceiver

public class MemLimitQueue
extends Object
implements ChunkQueue

An event queue that blocks once a fixed upper limit of data is enqueued. For now, uses the size of the data field. Should really use estimatedSerializedSize()?


Constructor Summary
MemLimitQueue(int limit)
           
 
Method Summary
 void add(Chunk chunk)
          Add a chunk to the queue, blocking if queue is full.
 void collect(List<Chunk> events, int maxSize)
          Return at least one, and no more than count, Chunks into chunks.
 int size()
          Return an approximation of the number of chunks in the queue currently.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemLimitQueue

public MemLimitQueue(int limit)
Method Detail

add

public void add(Chunk chunk)
         throws InterruptedException
Description copied from interface: ChunkQueue
Add a chunk to the queue, blocking if queue is full.

Specified by:
add in interface ChunkQueue
Specified by:
add in interface ChunkReceiver
Throws:
InterruptedException - if thread is interrupted while blocking
See Also:
ChunkQueue.add(org.apache.hadoop.chukwa.Chunk)

collect

public void collect(List<Chunk> events,
                    int maxSize)
             throws InterruptedException
Description copied from interface: ChunkQueue
Return at least one, and no more than count, Chunks into chunks. Blocks if queue is empty.

Specified by:
collect in interface ChunkQueue
Throws:
InterruptedException
See Also:
ChunkQueue.collect(java.util.List, int)

size

public int size()
Description copied from interface: ChunkQueue
Return an approximation of the number of chunks in the queue currently. No guarantees are made about the accuracy of this number.

Specified by:
size in interface ChunkQueue


Copyright © ${year} The Apache Software Foundation