|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
ptolemy.actor.ptalon.lib.MapReduceAlgorithm
public abstract class MapReduceAlgorithm
The MapReduce Algorithm.
See MapReduce: Simplified Data Processing on Large Clusters
Red (cxh) |
Red (cxh) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private boolean |
_noMoreInputs
This is set externally to true when the reduceValues queue no longer needs to accept values. |
private boolean |
_threadDone
True when the run method is done being called. |
private boolean |
_threadError
True if an exception was thrown accessing the blocking queue. |
java.lang.String |
reduceKey
The key for the reduce algorithm, which should be set externally. |
java.util.List<java.lang.String> |
reduceOutput
The list generated by the reduce algorithm, which should be read externally. |
java.util.concurrent.BlockingQueue<java.lang.String> |
reduceValues
The values for the reduce algorithm, which should be set externally. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
MapReduceAlgorithm()
|
Method Summary | |
---|---|
protected boolean |
isQueueEmpty()
Return true if no more elements will be added to the list. |
boolean |
isReduceFinished()
Return true if the reduce is finished. |
abstract java.util.List<KeyValuePair> |
map(java.lang.String key,
java.lang.String value)
Subclasses should implement their map method here. |
abstract java.util.List<java.lang.String> |
reduce(java.lang.String key,
java.util.concurrent.BlockingQueue<java.lang.String> values)
Subclasses should implement their reduce method here, calling the take method of the BlockingQueue to get the next value, and checking the parameter noMoreInputs to test if no more values can be put on the queue. |
void |
run()
This is used to call the reduce algorithm. |
void |
setNoMoreInputs()
Set this true when no more inputs values will be given to the reduce method queue. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.lang.String reduceKey
public java.util.concurrent.BlockingQueue<java.lang.String> reduceValues
public java.util.List<java.lang.String> reduceOutput
private boolean _threadDone
private boolean _threadError
private boolean _noMoreInputs
Constructor Detail |
---|
public MapReduceAlgorithm()
Method Detail |
---|
public boolean isReduceFinished() throws IllegalActionException
IllegalActionException
- If there was a thread error.public abstract java.util.List<KeyValuePair> map(java.lang.String key, java.lang.String value)
key
- The key passed to the map method.value
- The value passed to the map method.
public abstract java.util.List<java.lang.String> reduce(java.lang.String key, java.util.concurrent.BlockingQueue<java.lang.String> values) throws java.lang.InterruptedException
key
- The key to reduce over.values
- The queue of values in reduction.
java.lang.InterruptedException
- If thrown while reducing.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void setNoMoreInputs()
protected boolean isQueueEmpty()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |