|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.mygrid.replicaexecutor.PermissionManager
public class PermissionManager
Description: This class is responsible for managing the access of a replica
to it's task's critical region.
The critical region of a task is composed by it's two final tasks. Only one
replica of each task should be capable to execute it's critical region. Once
a replica has finished, no other replica of the same task should be allowed
to execute it's critical region.
Constructor Summary | |
---|---|
PermissionManager()
Creates a PermissionManager |
Method Summary | |
---|---|
java.util.Collection<org.ourgrid.mygrid.replicaexecutor.PermissionManager.Pair> |
getBlockedReplicas()
|
protected java.util.Collection<org.ourgrid.mygrid.replicaexecutor.PermissionManager.Pair> |
getBlockedReplicas(ReplicaEntry replica)
|
java.util.Collection<ReplicaEntry> |
getRunningReplicas()
|
void |
replicaAborted(ReplicaEntry replica)
If a replica has been aborted, all replicas of the same task will be aborted too soon. |
void |
replicaCanceled(ReplicaEntry replica)
If a replica has been cancelled, all replicas of the same task will be cancelled too soon. |
void |
replicaFailed(ReplicaEntry replica)
If a replica fails inside it's critical region and there are other replicas waiting to access it's critical region the PermissionManager should allow the first replica of the
queue to access it's critical region. |
void |
replicaFinished(ReplicaEntry replica)
If a replica has finished, all replicas of the same task will be aborted soon. |
void |
requestPermission(ReplicaEntry replica,
EventQueue<ResponseEvent<java.lang.Boolean>> responseQueue)
Ask the PermissionManager to verify if a given replica can
access it's task's critical region. |
void |
shutdown()
Shutdown the PermissionManager |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PermissionManager()
Method Detail |
---|
protected java.util.Collection<org.ourgrid.mygrid.replicaexecutor.PermissionManager.Pair> getBlockedReplicas(ReplicaEntry replica)
public java.util.Collection<org.ourgrid.mygrid.replicaexecutor.PermissionManager.Pair> getBlockedReplicas()
public java.util.Collection<ReplicaEntry> getRunningReplicas()
public void requestPermission(ReplicaEntry replica, EventQueue<ResponseEvent<java.lang.Boolean>> responseQueue)
PermissionManager
to verify if a given replica can
access it's task's critical region. If no replica of the same task is
already inside it's critical region, the permission is granted,
otherwise, the replica will be blocked until the task's critical region
is free.
replica
- The replica that asks for permissionresponseQueue
- The replica's response queuepublic void replicaFailed(ReplicaEntry replica)
PermissionManager
should allow the first replica of the
queue to access it's critical region. Elsewhere, if a replica fails
outside it's critical region, the PermissionManager
should
remove it from the waiting queue.
replica
- The replica who has failed.public void replicaAborted(ReplicaEntry replica)
PermissionManager
should remove
all references for replicas of the same task from it's internal data
structures.
replica
- public void replicaFinished(ReplicaEntry replica)
PermissionManager
should remove all
references for replicas of the same task from it's internal data
structures.
replica
- public void replicaCanceled(ReplicaEntry replica)
PermissionManager
should
remove all references for replicas of the same task from it's internal
data structures.
replica
- public void shutdown()
PermissionManager
shutdown
in interface Shutdownable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |