Package org.snpeff.akka
Class Master<TI,TO>
- java.lang.Object
-
- org.snpeff.akka.ConcurrentActor
-
- org.snpeff.akka.Master<TI,TO>
-
- Type Parameters:
TI
-TO
-
- All Implemented Interfaces:
java.lang.Iterable<TI>
,java.util.Iterator<TI>
- Direct Known Subclasses:
MasterVcf
public abstract class Master<TI,TO> extends ConcurrentActor implements java.lang.Iterable<TI>, java.util.Iterator<TI>
Master: Distributes the jobs to all workers, sends the results to 'listener'- Author:
- pablocingolani
-
-
Field Summary
Fields Modifier and Type Field Description protected int
batchSize
protected java.util.concurrent.CompletionService<Result<TO>>
completion
protected int
countInputObjects
static boolean
debug
static int
DEFAULT_BATCH_SIZE
static int
DEFAULT_SHOW_EVERY
static int
LOAD_FACTOR
protected long
nextOutput
protected int
numWorkers
protected java.util.concurrent.ExecutorService
pool
protected ConcurrentProperties
props
protected int
sentWorks
protected int
showEvery
protected java.util.HashMap<java.lang.Long,Result<TO>>
worksBySerial
-
Constructor Summary
Constructors Constructor Description Master(ConcurrentProperties props, int numWorkers)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
get(java.lang.Object message)
Master-receive: Handle-messagesabstract boolean
hasNext()
java.lang.Iterable<Work<TI>>
iterableWork()
Return a class that iterates Works (creates works)java.util.Iterator<TI>
iterator()
abstract TI
next()
Get next itemprotected void
output(Result<TO> result)
Output all contents of a resultprotected void
output(TO output)
Output a result datum You should probably override this methodprotected void
processResults(Result<TO> result)
Print results in the same order they were sent to the processing queue (i.e.void
remove()
protected void
startMaster(StartMaster startMaster)
This is executed when the 'start' message arrives (at the beginning of the processing)
-
-
-
Field Detail
-
LOAD_FACTOR
public static int LOAD_FACTOR
-
DEFAULT_SHOW_EVERY
public static final int DEFAULT_SHOW_EVERY
- See Also:
- Constant Field Values
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
- See Also:
- Constant Field Values
-
debug
public static boolean debug
-
batchSize
protected int batchSize
-
showEvery
protected int showEvery
-
nextOutput
protected long nextOutput
-
countInputObjects
protected int countInputObjects
-
numWorkers
protected int numWorkers
-
sentWorks
protected int sentWorks
-
pool
protected java.util.concurrent.ExecutorService pool
-
props
protected ConcurrentProperties props
-
-
Constructor Detail
-
Master
public Master(ConcurrentProperties props, int numWorkers)
Constructor- Parameters:
numWorkers
- : How may workers will be usedlistener
- : Listener
-
-
Method Detail
-
hasNext
public abstract boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<TI>
-
iterableWork
public java.lang.Iterable<Work<TI>> iterableWork()
Return a class that iterates Works (creates works)- Returns:
-
iterator
public java.util.Iterator<TI> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<TI>
-
next
public abstract TI next()
Get next item- Specified by:
next
in interfacejava.util.Iterator<TI>
- Returns:
-
get
public void get(java.lang.Object message)
Master-receive: Handle-messages
-
output
protected void output(Result<TO> result)
Output all contents of a result- Parameters:
result
-
-
output
protected void output(TO output)
Output a result datum You should probably override this method- Parameters:
result
-
-
processResults
protected void processResults(Result<TO> result)
Print results in the same order they were sent to the processing queue (i.e. ordered by Work.serialNumber)- Parameters:
result
-
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<TI>
-
startMaster
protected void startMaster(StartMaster startMaster)
This is executed when the 'start' message arrives (at the beginning of the processing)- Parameters:
startMaster
-
-
-