|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.prc.server.transitioner.LocalTransitioner
public class LocalTransitioner
The LocalTransitioner is used when the Transitioner component is executed on the same machine as the PRCServer. If the Transitioner will be run on a separate machine, use the RemoteTransitionerProxy instead.
Transitioner
,
RemoteTransitionerProxy
Field Summary | |
---|---|
private TransitionerQueue<WorkUnit> |
canonicalWorkUnits
|
private TransitionerQueue<Result> |
ingressResults
|
private TransitionerQueue<WorkUnit> |
ingressWorkUnits
|
private int |
minNumResults
|
private int |
minNumSpotChecks
|
private TransitionerQueue<Result> |
pendingResults
|
private TransitionerQueue<WorkUnit> |
pendingWorkUnits
|
private SpotCheckThread |
spotChecker
|
private float |
spotCheckProbability
|
private TransitionerQueue<Result> |
spotCheckResults
|
private TransitionerQueue<WorkUnit> |
spotCheckWorkUnits
|
Constructor Summary | |
---|---|
LocalTransitioner()
Private constructor ensures that only one instance of LocalTransitioner exists. |
Method Summary | |
---|---|
void |
addEgressResult(Result r)
NOTE: This method is for testing only! It should never be used. |
void |
addEgressWorkUnit(WorkUnit wu)
NOTE: This method is for testing only! It should never be used. |
void |
addIngressResult(Result r)
Enqueues a result in the ingress result queue. |
void |
addIngressWorkUnit(WorkUnit wu)
Enqueues a work unit in the ingress work queue. |
void |
addPendingResult(Result r)
NOTE: This method is for testing only! It should never be used. |
void |
addPendingWorkUnit(WorkUnit wu)
NOTE: This method is for testing only! It should never be used. |
Result[] |
getAssociatedIngressResults(WorkUnit wu)
Finds all ingress Results associated with a given WorkUnit. |
Result[] |
getAssociatedPendingResults(WorkUnit wu)
Finds all pending Results associated with a given WorkUnit. |
private Result[] |
getAssociatedResults(java.lang.String hqlQuery)
Finds all Results generated by the given HQL query. |
private WorkUnit[] |
getAssociatedWorkUnits(java.lang.String hqlQuery)
Finds all WorkUnits generated by the given HQL query. |
TransitionerQueue<WorkUnit> |
getCanonicalWorkQueue()
|
WorkUnit |
getCanonicalWorkUnit()
Gets the first work unit that has enough Results. |
TransitionerQueue<Result> |
getIngressResultQueue()
|
TransitionerQueue<WorkUnit> |
getIngressWorkQueue()
|
TransitionerQueue<Result> |
getPendingResultQueue()
|
TransitionerQueue<WorkUnit> |
getPendingWorkQueue()
|
Result |
getResult()
Gets the first result that needs to be validated. |
private Result[] |
getResultsFromUser(Volunteer v)
Gets all results returned by the specified user. |
TransitionerQueue<WorkUnit> |
getRetiredWorkQueue()
|
TransitionerQueue<Result> |
getValidResultQueue()
|
WorkUnit |
getWorkUnit(Volunteer v)
Gets the next work unit to be processed. |
private WorkUnit[] |
getWorkUnitsWithEnoughResults()
Finds all pending WorkUnits for which enough valid Results have been returned. |
void |
markResultInvalid(Result invalidResult)
Marks a result as invalid. |
void |
markResultValid(Result validResult)
Marks a Result as valid. |
private void |
moveToPendingResultQueue(TransitionerQueue<Result> originQueue,
Result r)
Moves a Result from a result queue to the pending result queue. |
private void |
moveToPendingWorkQueue(TransitionerQueue<WorkUnit> originQueue,
WorkUnit wu)
Moves a WorkUnit from a work queue to the pending work queue. |
private void |
moveToRetiredWorkQueue(WorkUnit wu)
Moves a WorkUnit from the pending work queue to the retired work queue. |
private void |
moveToValidResultQueue(Result r)
Moves a Result from the pending result queue to the valid result queue. |
private void |
restoreFromDatabase()
Restores all queues from the database. |
void |
selectCanonicalResult(Result canonicalResult)
Designates a canonical Result by removing all related results from the ingress and pending queues, adding the canonical result to the valid queue, and retiring the canonical result's work unit. |
void |
shutdown()
Performs any necessary tasks to safely shut down the Transitioner. |
private void |
verifySpotChecks()
Checks whether sufficient spot checks have been computed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private TransitionerQueue<WorkUnit> ingressWorkUnits
private TransitionerQueue<WorkUnit> pendingWorkUnits
private TransitionerQueue<WorkUnit> spotCheckWorkUnits
private TransitionerQueue<WorkUnit> canonicalWorkUnits
private TransitionerQueue<Result> ingressResults
private TransitionerQueue<Result> pendingResults
private TransitionerQueue<Result> spotCheckResults
private SpotCheckThread spotChecker
private final int minNumResults
private final float spotCheckProbability
private final int minNumSpotChecks
Constructor Detail |
---|
public LocalTransitioner()
Method Detail |
---|
public TransitionerQueue<WorkUnit> getIngressWorkQueue()
getIngressWorkQueue
in interface Transitioner
public TransitionerQueue<WorkUnit> getPendingWorkQueue()
getPendingWorkQueue
in interface Transitioner
public TransitionerQueue<WorkUnit> getCanonicalWorkQueue()
getCanonicalWorkQueue
in interface Transitioner
public TransitionerQueue<WorkUnit> getRetiredWorkQueue()
getRetiredWorkQueue
in interface Transitioner
public TransitionerQueue<Result> getIngressResultQueue()
getIngressResultQueue
in interface Transitioner
public TransitionerQueue<Result> getPendingResultQueue()
getPendingResultQueue
in interface Transitioner
public TransitionerQueue<Result> getValidResultQueue()
getValidResultQueue
in interface Transitioner
private void moveToPendingWorkQueue(TransitionerQueue<WorkUnit> originQueue, WorkUnit wu)
originQueue
- The queue from which the WorkUnit will be moved.wu
- The WorkUnit to move.private void moveToRetiredWorkQueue(WorkUnit wu)
wu
- The WorkUnit to move.private void moveToPendingResultQueue(TransitionerQueue<Result> originQueue, Result r)
originQueue
- The queue from which the Result will be moved.r
- The Result to move.private void moveToValidResultQueue(Result r)
r
- The Result to move.public void addIngressWorkUnit(WorkUnit wu)
addIngressWorkUnit
in interface Transitioner
wu
- The work unit to add.public void addPendingWorkUnit(WorkUnit wu)
wu
- The work unit to add.public void addIngressResult(Result r)
addIngressResult
in interface Transitioner
r
- The result to add.public void addPendingResult(Result r)
r
- The result to add.private Result[] getResultsFromUser(Volunteer v)
v
- The user to search for.
public void markResultValid(Result validResult)
markResultValid
in interface Transitioner
validResult
- The result from the ingress result queue to be marked valid.public void markResultInvalid(Result invalidResult)
markResultInvalid
in interface Transitioner
invalidResult
- The result to be marked invalid.public void addEgressWorkUnit(WorkUnit wu)
wu
- The work unit to add.public void addEgressResult(Result r)
r
- The result to add.private Result[] getAssociatedResults(java.lang.String hqlQuery)
hqlQuery
- The HQL query to execute.
public Result[] getAssociatedIngressResults(WorkUnit wu)
getAssociatedIngressResults
in interface Transitioner
wu
- The WorkUnit for which to find all associated ingress Results.
public Result[] getAssociatedPendingResults(WorkUnit wu)
getAssociatedPendingResults
in interface Transitioner
wu
- The WorkUnit for which to find all associated pending Results.
private WorkUnit[] getWorkUnitsWithEnoughResults()
private WorkUnit[] getAssociatedWorkUnits(java.lang.String hqlQuery)
hqlQuery
- The HQL query to execute.
public void selectCanonicalResult(Result canonicalResult)
selectCanonicalResult
in interface Transitioner
canonicalResult
- The canonical result to select.public WorkUnit getWorkUnit(Volunteer v) throws EmptyQueueException
getWorkUnit
in interface Transitioner
v
- The volunteer who will receive it.
EmptyQueueException
public WorkUnit getCanonicalWorkUnit() throws EmptyQueueException
getCanonicalWorkUnit
in interface Transitioner
EmptyQueueException
public Result getResult() throws EmptyQueueException
getResult
in interface Transitioner
EmptyQueueException
private void verifySpotChecks()
private void restoreFromDatabase()
public void shutdown()
shutdown
in interface Transitioner
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |