public abstract class FlowProcess<Config> extends Object
Operation
is given a reference to a particular implementation, allowing it
to get configuration properties, send a "keep alive" ping, or to set a counter value.
Depending on the underlying system, FlowProcess instances are not continuous across all operations in a Flow
.
Thus, a call to increment(Enum, long)
may start incrementing from zero if the operation making the call
belongs to a subsequent 'job' or 'step' from any previous operations calling increment.
A FlowProcess is roughly a child of FlowSession
. FlowSession is roughly one to one with a particular Flow
.
And every FlowSession will have one or more FlowProcesses.FlowSession
Modifier and Type | Class and Description |
---|---|
static class |
FlowProcess.NullFlowProcess |
Modifier and Type | Field and Description |
---|---|
static FlowProcess |
NULL
Field NULL is a noop implementation of FlowSession.
|
Modifier | Constructor and Description |
---|---|
protected |
FlowProcess() |
protected |
FlowProcess(FlowProcess<Config> flowProcess)
Copy constructor.
|
protected |
FlowProcess(FlowSession currentSession) |
Modifier and Type | Method and Description |
---|---|
void |
closeTrapCollectors() |
abstract <C> C |
copyConfig(C config) |
abstract FlowProcess<Config> |
copyWith(Config config) |
abstract <C> Map<String,String> |
diffConfigIntoMap(C defaultConfig,
C updatedConfig) |
Boolean |
getBooleanProperty(String key)
Method getBooleanProperty should be used to return configuration parameters from the underlying system.
|
boolean |
getBooleanProperty(String key,
boolean defaultValue)
Method getBooleanProperty should be used to return configuration parameters from the underlying system.
|
abstract Config |
getConfig()
Method getConfig returns the actual instance of the underlying configuration instance.
|
abstract Config |
getConfigCopy() |
abstract long |
getCounterValue(Enum counter)
Method getCounterValue is used to retrieve a counter value.
|
abstract long |
getCounterValue(String group,
String counter)
Method getCounterValue is used to retrieve a counter value.
|
FlowSession |
getCurrentSession()
Method getCurrentSession returns the currentSession of this FlowProcess object.
|
abstract int |
getCurrentSliceNum()
Method getCurrentSliceNum returns an integer representing which slice instance currently running.
|
String |
getID()
Method getID() returns the current
|
Integer |
getIntegerProperty(String key)
Method getIntegerProperty should be used to return configuration parameters from the underlying system.
|
int |
getIntegerProperty(String key,
int defaultValue)
Method getIntegerProperty should be used to return configuration parameters from the underlying system.
|
abstract int |
getNumProcessSlices()
Method getNumProcessSlices returns the number of parallel slices or tasks allocated
for this process execution.
|
abstract Object |
getProperty(String key)
Method getProperty should be used to return configuration parameters from the underlying system.
|
abstract Collection<String> |
getPropertyKeys()
Method getPropertyKeys returns an immutable collection of all available property key values.
|
String |
getStringProperty(String key)
Method getStringProperty should be used to return configuration parameters from the underlying system.
|
String |
getStringProperty(String key,
String defaultValue)
Method getStringProperty should be used to return configuration parameters from the underlying system.
|
TupleEntryCollector |
getTrapCollectorFor(Tap trap)
Method getTrapCollectorFor will return a new
TupleEntryCollector if one hasn't previously
been created for the given trap Tap. |
protected Map<Tap,TupleEntryCollector> |
getTrapCollectors() |
abstract void |
increment(Enum counter,
long amount)
Method increment is used to increment a custom counter.
|
abstract void |
increment(String group,
String counter,
long amount)
Method increment is used to increment a custom counter.
|
abstract boolean |
isCounterStatusInitialized()
Method isCounterStatusInitialized returns true if it is safe to increment a counter or set a status.
|
abstract void |
keepAlive()
Method keepAlive notifies the system that the current process is still alive.
|
abstract Config |
mergeMapIntoConfig(Config defaultConfig,
Map<String,String> map) |
abstract Object |
newInstance(String className)
Method newInstance creates a new object instance from the given className argument delegating to any
platform specific instantiation and configuration routines.
|
abstract TupleEntryCollector |
openSystemIntermediateForWrite() |
abstract TupleEntryIterator |
openTapForRead(Tap tap)
Method openTapForRead return a
TupleEntryIterator for the given Tap instance. |
abstract TupleEntryCollector |
openTapForWrite(Tap tap)
Method openTapForWrite returns a (@link TupleCollector} for the given Tap instance.
|
abstract TupleEntryCollector |
openTrapForWrite(Tap trap)
Method openTrapForWrite returns a (@link TupleCollector} for the given Tap instance.
|
void |
setCurrentSession(FlowSession currentSession)
Method setCurrentSession sets the currentSession of this FlowProcess object.
|
abstract void |
setStatus(String status)
Method setStatus is used to set the status of the current operation.
|
public static FlowProcess NULL
protected FlowProcess()
protected FlowProcess(FlowSession currentSession)
protected FlowProcess(FlowProcess<Config> flowProcess)
flowProcess
- public abstract FlowProcess<Config> copyWith(Config config)
public FlowSession getCurrentSession()
public void setCurrentSession(FlowSession currentSession)
currentSession
- the currentSession of this FlowProcess object.public abstract int getNumProcessSlices()
public abstract int getCurrentSliceNum()
0
(zero) is the first slice instance.public abstract Object getProperty(String key)
key
- of type Stringpublic String getStringProperty(String key)
key
- of type String,public String getStringProperty(String key, String defaultValue)
key
- of type String,defaultValue
- of type String,defaultValue
if property is not setpublic Integer getIntegerProperty(String key)
key
- of type String,public int getIntegerProperty(String key, int defaultValue)
key
- of type String,defaultValue
- of type int,defaultValue
if property is not setpublic Boolean getBooleanProperty(String key)
key
- of type Boolean, null if property is not setpublic boolean getBooleanProperty(String key, boolean defaultValue)
key
- of type StringdefaultValue
- of type booleandefaultValue
if property is not setpublic abstract Collection<String> getPropertyKeys()
public abstract Object newInstance(String className)
className
- public abstract void keepAlive()
Operation
takes some moments to complete. Each system is different, so calling
ping every few seconds to every minute or so would be best.
This method will fail silently if the underlying mechanism to notify keepAlive status are not initialized.public abstract void increment(Enum counter, long amount)
isCounterStatusInitialized()
.counter
- of type Enumamount
- of type intpublic abstract void increment(String group, String counter, long amount)
isCounterStatusInitialized()
.group
- of type Stringcounter
- of type Stringamount
- of type intpublic abstract long getCounterValue(Enum counter)
isCounterStatusInitialized()
.counter
- of type Enumpublic abstract long getCounterValue(String group, String counter)
isCounterStatusInitialized()
.group
- of type Stringcounter
- of type Stringpublic abstract void setStatus(String status)
isCounterStatusInitialized()
.status
- of type Stringpublic abstract boolean isCounterStatusInitialized()
public abstract TupleEntryIterator openTapForRead(Tap tap) throws IOException
TupleEntryIterator
for the given Tap instance.
Note the returned iterator will return the same instance of TupleEntry
on every call,
thus a copy must be made of either the TupleEntry or the underlying Tuple
instance if they are to be
stored in a Collection.tap
- of type TapIOException
- when there is a failure opening the resourcepublic abstract TupleEntryCollector openTapForWrite(Tap tap) throws IOException
tap
- of type TapIOException
- when there is a failure opening the resourcepublic abstract TupleEntryCollector openTrapForWrite(Tap trap) throws IOException
trap
- of type TapIOException
- when there is a failure opening the resourcepublic abstract TupleEntryCollector openSystemIntermediateForWrite() throws IOException
IOException
public abstract Config getConfig()
getConfigCopy()
for a modifiable instance.public abstract Config getConfigCopy()
public abstract <C> C copyConfig(C config)
public abstract <C> Map<String,String> diffConfigIntoMap(C defaultConfig, C updatedConfig)
public abstract Config mergeMapIntoConfig(Config defaultConfig, Map<String,String> map)
public TupleEntryCollector getTrapCollectorFor(Tap trap)
TupleEntryCollector
if one hasn't previously
been created for the given trap Tap.trap
- protected Map<Tap,TupleEntryCollector> getTrapCollectors()
public void closeTrapCollectors()
Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.