com.hazelcast.mapreduce.impl.task
Class DefaultContext<KeyIn,ValueIn>
java.lang.Object
com.hazelcast.mapreduce.impl.task.DefaultContext<KeyIn,ValueIn>
- Type Parameters:
KeyIn
- ValueIn
-
- All Implemented Interfaces:
- Context<KeyIn,ValueIn>
public class DefaultContext<KeyIn,ValueIn>
- extends Object
- implements Context<KeyIn,ValueIn>
This is the internal default implementation of a map reduce context mappers emit values to. It controls the emitted
values to be combined using either the set Combiner
or by utilizing the internal
collecting combiner (which is just a better HashMap ;-)).
In addition to that it is responsible to notify about an the MapCombineTask
about an emitted value to eventually send out chunks on reaching the chunk size limit.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultContext
protected DefaultContext(CombinerFactory<KeyIn,ValueIn,?> combinerFactory,
MapCombineTask mapCombineTask)
setPartitionId
public void setPartitionId(int partitionId)
emit
public void emit(KeyIn key,
ValueIn value)
- Description copied from interface:
Context
- Emits a key-value pair to the intermediate working space. The same key can be used multiple
times to collect values under the same key.
- Specified by:
emit
in interface Context<KeyIn,ValueIn>
- Parameters:
key
- emitted key.value
- emitted value.
requestChunk
public <Chunk> Map<KeyIn,Chunk> requestChunk()
getCollected
public int getCollected()
finish
public <Chunk> Map<KeyIn,Chunk> finish()
getOrCreateCombiner
public Combiner<ValueIn,?> getOrCreateCombiner(KeyIn key)
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.