|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread org.ourgrid.mygrid.replicaexecutor.ReplicaExecutorThreadManager
public class ReplicaExecutorThreadManager
This class takes care of a thread pool. Threads inside the pool are in charge of executing replicas. Description: A thread pool that contains all ReplicaExecutorThread objects.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
FAKE
Fake execution identifier |
static int |
MG
Real execution identifier |
static int |
THREAD_POOL_SIZE
Amount of threads in the pool TODO This number should be calculated in a dynamic way based on the number of available GuMs |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ReplicaExecutorThreadManager(EBReplicaExecutorFacade ebReplicaExecutorFacade)
Simple constructor. |
|
ReplicaExecutorThreadManager(EBReplicaExecutorFacade ebReplicaExecutorFacade,
int type,
int threadPoolSize)
Main constructor |
Method Summary | |
---|---|
java.util.Collection<ReplicaExecutor> |
getReplicaExecutorThreads()
Provides a Collection that contains all
ReplicaExecutorThread objects. |
ReplicaExecutor |
obtainReplicaExecutorThread(ReplicaEntry replica,
GumClient gumClient)
Provides a replicaExecutorThread |
void |
releaseReplicaExecutorThread(ReplicaEntry replica)
Releases a thread to the pool |
void |
replicaFinished(ReplicaEntry replica)
Registers that a replica has finished |
void |
shutdown()
Shuts down all threads in the pool, including the pool itself |
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, run, 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 static final int MG
public static final int FAKE
public static int THREAD_POOL_SIZE
Constructor Detail |
---|
public ReplicaExecutorThreadManager(EBReplicaExecutorFacade ebReplicaExecutorFacade)
ebReplicaExecutorFacade
- The EBReplicaExecutorFacade
public ReplicaExecutorThreadManager(EBReplicaExecutorFacade ebReplicaExecutorFacade, int type, int threadPoolSize)
ebReplicaExecutorFacade
- The EBReplicaExecutorFacade
type
- Defines whether this class must use either
FakeReplicaExecutorThread
(usually for tests) or
MGReplicaExecutorThread
(for real execution)threadPoolSize
- The number of threads in the threadPoolMethod Detail |
---|
public ReplicaExecutor obtainReplicaExecutorThread(ReplicaEntry replica, GumClient gumClient) throws ReplicaExecutorThreadException
replica
- Replica to be executed by the
ReplicaExecutorThread
gumClient
- Grid machine where the replica will be executed.
ReplicaExecutorThread
object to execute the
replica.
ReplicaExecutorThreadException
public void releaseReplicaExecutorThread(ReplicaEntry replica) throws ReplicaExecutorThreadException
replica
- Replica associated with the
ReplicaExecutorThread
to be released.
ReplicaExecutorThreadException
public java.util.Collection<ReplicaExecutor> getReplicaExecutorThreads()
Collection
that contains all
ReplicaExecutorThread
objects.
Collection
that contains all
ReplicaExecutorThread
objects.public void shutdown()
shutdown
in interface Shutdownable
public void replicaFinished(ReplicaEntry replica)
replica
- The replica that has finished.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |