@InterfaceStability.Unstable @InterfaceAudience.Public public abstract class InputInitializer extends Object
InputInitializer
s are typically used to initialize vertices
connected to data sources. They run in the App Master and can be used to
distribute data across the tasks for the vertex, determine the number of
tasks at runtime, update the Input payload etc.Constructor and Description |
---|
InputInitializer(InputInitializerContext initializerContext)
Constructor an instance of the InputInitializer.
|
Modifier and Type | Method and Description |
---|---|
InputInitializerContext |
getContext()
Return ahe
InputInitializerContext
for this specific instance of the Initializer. |
abstract void |
handleInputInitializerEvent(List<InputInitializerEvent> events)
Handle events meant for the specific Initializer.
|
abstract List<Event> |
initialize()
Run the initializer.
|
void |
onVertexStateUpdated(VertexStateUpdate stateUpdate)
Receive notifications on vertex state changes.
|
public InputInitializer(InputInitializerContext initializerContext)
initializerContext
- initializer context which can be used to access the payload, vertex
properties, etcpublic abstract List<Event> initialize() throws Exception
VertexManagerPlugin
for routingException
public abstract void handleInputInitializerEvent(List<InputInitializerEvent> events) throws Exception
events
- list of eventsException
public final InputInitializerContext getContext()
InputInitializerContext
for this specific instance of the Initializer.InputInitializerContext
for the initializerpublic void onVertexStateUpdated(VertexStateUpdate stateUpdate) throws Exception
InputInitializerContext.registerForVertexStateUpdates(String,
java.util.Set)
. Notifications will be received for all registered state changes, and not just
for the latest state update. They will be in order in which the state change occurred.
Extensive processing should not be performed via this method call. Instead this should just be
used as a notification mechanism to the main initialization, which is via the initialize method.
initialize()
etc. and
multi-threading/concurrency implications must be considered.stateUpdate
- an event indicating the name of the vertex, and it's updated state.
Additional information may be available for specific events, Look at the
type hierarchy for VertexStateUpdate
Exception
Copyright © 2015 Apache Software Foundation. All rights reserved.