public abstract class AbstractDataCollector extends Object implements DataCollector
Modifier and Type | Field and Description |
---|---|
protected RawBatchBuffer[] |
buffers |
protected ArrayWrappedIntIntMap |
fragmentMap |
protected BufferAllocator |
ownerAllocator
Allocator which owns incoming batches
|
logger
Constructor and Description |
---|
AbstractDataCollector(AtomicInteger parentAccounter,
int numBuffers,
BitControl.Collector collector,
int bufferCapacity,
FragmentContext context) |
Modifier and Type | Method and Description |
---|---|
boolean |
batchArrived(int minorFragmentId,
RawFragmentBatch batch) |
void |
close() |
BufferAllocator |
getAllocator() |
protected abstract RawBatchBuffer |
getBuffer(int minorFragmentId) |
RawBatchBuffer[] |
getBuffers() |
int |
getOppositeMajorFragmentId() |
int |
getTotalIncomingFragments() |
void |
setAllocator(BufferAllocator allocator)
Enables caller (e.g., receiver) to attach its buffer allocator to this Data Collector in order
to claim ownership of incoming batches; by default, the fragment allocator owns these batches.
|
protected final RawBatchBuffer[] buffers
protected final ArrayWrappedIntIntMap fragmentMap
protected BufferAllocator ownerAllocator
public AbstractDataCollector(AtomicInteger parentAccounter, int numBuffers, BitControl.Collector collector, int bufferCapacity, FragmentContext context)
parentAccounter
- numBuffers
- Number of RawBatchBuffer inputs required to store the incoming databufferCapacity
- Capacity of each RawBatchBuffer.context
- public int getOppositeMajorFragmentId()
getOppositeMajorFragmentId
in interface DataCollector
public RawBatchBuffer[] getBuffers()
getBuffers
in interface DataCollector
public boolean batchArrived(int minorFragmentId, RawFragmentBatch batch) throws IOException
batchArrived
in interface DataCollector
IOException
public int getTotalIncomingFragments()
getTotalIncomingFragments
in interface DataCollector
protected abstract RawBatchBuffer getBuffer(int minorFragmentId)
public void close() throws Exception
close
in interface AutoCloseable
close
in interface DataCollector
Exception
public BufferAllocator getAllocator()
getAllocator
in interface DataCollector
public void setAllocator(BufferAllocator allocator)
setAllocator
in interface DataCollector
allocator
- operator buffer allocatorCopyright © 1970 The Apache Software Foundation. All rights reserved.