com.hazelcast.mapreduce
Interface LifecycleMapper<KeyIn,ValueIn,KeyOut,ValueOut>

Type Parameters:
KeyIn - type of key used in the KeyValueSource
ValueIn - type of value used in the KeyValueSource
KeyOut - key type for mapped results
ValueOut - value type for mapped results
All Superinterfaces:
Mapper<KeyIn,ValueIn,KeyOut,ValueOut>, Serializable
All Known Implementing Classes:
LifecycleMapperAdapter

@Beta
public interface LifecycleMapper<KeyIn,ValueIn,KeyOut,ValueOut>
extends Mapper<KeyIn,ValueIn,KeyOut,ValueOut>

The LifecycleMapper interface is a more sophisticated version of Mapper normally used for complexer algorithms with a need of initialization and finalization.

The behavior is the same as for Mapper but initialize(Context) is called before calling Mapper.map(Object, Object, Context) for the first time to prepare the mapper instance and maybe already emit some values. After all mapping calls are finished finalized(Context) is called and here is also the possibility given to emit additional key-value pairs.

Since:
3.2

Method Summary
 void finalized(Context<KeyOut,ValueOut> context)
          This method is called after the Mapper.map(Object, Object, Context) method is executed for every value and can be used to finalize the internal state of the mapper or to emit a special value.
 void initialize(Context<KeyOut,ValueOut> context)
          This method is called before the Mapper.map(Object, Object, Context) method is executed for every value and can be used to initialize the internal state of the mapper or to emit a special value.
 
Methods inherited from interface com.hazelcast.mapreduce.Mapper
map
 

Method Detail

initialize

void initialize(Context<KeyOut,ValueOut> context)
This method is called before the Mapper.map(Object, Object, Context) method is executed for every value and can be used to initialize the internal state of the mapper or to emit a special value.

Parameters:
context - Context to be used for emitting values

finalized

void finalized(Context<KeyOut,ValueOut> context)
This method is called after the Mapper.map(Object, Object, Context) method is executed for every value and can be used to finalize the internal state of the mapper or to emit a special value.

Parameters:
context - Context to be used for emitting values


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.