|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdarx.ReplicationStrategy
public abstract class ReplicationStrategy
This is the component, used alongside each TaskShell
,
which defines a task's replication group.
This class provides methods to manage the information a specific task
possesses about its replication group in terms of replicant (un)registration,
that is it maintains up to date the number of replicants for this particular
task and the location of each replicant.
NB: EVERY replicant, independently of its being leader of the replication
group or not, carries and maintains this information up to date so as to be
available to take the leadership in case of the current leader's failure.
NB2: This class is abstract; its specialisations define the current
replication policy within the task's group, and therefore the message passing
and runtime management schemes.
ActiveReplicationStrategy
,
PassiveReplicationStrategy
,
Serialized FormField Summary | |
---|---|
static int |
ACTIVE_STRATEGY
The constant used to define the strategy type as active. |
static int |
BACKUP
The constant used to define the role of the strategy owner as backup. |
static int |
EMPTY_STRATEGY
The constant used to define the strategy type as empty. |
protected ReplicantInfo |
info
The information concerning the replication group leader |
static int |
LEADER
The constant used to define the role of the strategy owner as leader. |
static int |
PASSIVE_STRATEGY
The constant used to define the strategy type as passive. |
static int |
QUORUM_STRATEGY
The constant used to define the strategy type as quorum-based. |
protected int |
rep_number
The unique number used in the darx-pathname of the latest created replicant. |
protected java.util.Hashtable |
replicants
The list of remote replicants participating to the current replication group, the owner of this instance not included. |
protected int |
role
The role of the strategy owner (leader, active or passive) |
protected int |
type
The strategy type, that is whether it is active or passive. |
Constructor Summary | |
---|---|
protected |
ReplicationStrategy()
Constructs an empty information container to be filled in with data about the task's replication group. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object o)
Compares this replication strategy to an object. |
abstract int |
compareTo(ReplicationStrategy other_strategy)
Compares this replication strategy to another. |
boolean |
contains(ReplicantInfo rep_info)
|
abstract void |
deliverAsyncMessage(TaskShell shell,
DarxMessage msg)
Spreads the delivery of an asynchronous message throughout the replication group. |
abstract java.io.Serializable |
deliverSyncMessage(TaskShell shell,
DarxMessage msg)
Spreads the delivery of a synchronous message throughout the replication group. |
(package private) void |
display()
|
boolean |
equals(java.lang.Object o)
Compares the specified Object with this strategy for equality. |
ReplicantInfo |
findReplicantAt(java.lang.String url,
int port_nb)
Finds the info concerning a replicant at a given location |
protected TaskShellHandle |
getRemoteShellHandle(ReplicantInfo rep_info)
Retrieves the stub of a given replicant. |
TaskShellHandle |
getReplicantHandle(ReplicantInfo rep_info)
Gets the handle for a remote replicant within the group. |
ReplicantInfo |
getReplicantInfo()
|
int |
getReplicantRole()
|
java.util.Hashtable |
getReplicants()
|
int |
getReplicationNumber()
|
int |
getReplicationType()
|
void |
handleUnreachableReplicant(ReplicantInfo dead,
java.rmi.RemoteException re)
Handles situations where a replicant fails to be contacted. |
int |
hashCode()
Who knows when THIS might come in handy... |
void |
registerReplicant(ReplicantInfo rep,
TaskShellHandle sh)
Adds a member to the replication group. |
abstract void |
resume()
Spreads the resumption of the encapsulated task execution throughout the replication group. |
void |
setLeaderInfo(ReplicantInfo new_info)
Sets the info about the replication group leader |
void |
setReplicantRole(int new_role)
Sets the role of the strategy owner (leader or backup). |
void |
setReplicants(java.util.Hashtable new_replicants_list)
Sets the list of tasks belonging to this replication group. |
void |
setReplicantType(int type)
Sets the type of the strategy (active or passive). |
void |
setReplicationNumber(int new_rep_number)
Sets the serial number of the last created replicant. |
void |
stop()
Stops the activity regarding consistency maintenance within the replication group (e.g. updater thread in the passive strategy.) |
abstract void |
suspend()
Spreads the suspension of the encapsulated task execution throughout the replication group. |
void |
terminate()
Spreads the termination of the task execution throughout the replication group. |
TaskShellHandle |
unregisterReplicant(ReplicantInfo doomed_rep_info)
Removes a member from the replication group. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EMPTY_STRATEGY
public static final int ACTIVE_STRATEGY
public static final int PASSIVE_STRATEGY
public static final int QUORUM_STRATEGY
public static final int LEADER
public static final int BACKUP
protected int type
protected int role
protected ReplicantInfo info
protected java.util.Hashtable replicants
protected int rep_number
Constructor Detail |
---|
protected ReplicationStrategy()
Method Detail |
---|
public int getReplicationType()
public int getReplicantRole()
public ReplicantInfo getReplicantInfo()
public int getReplicationNumber()
public java.util.Hashtable getReplicants()
public boolean contains(ReplicantInfo rep_info)
rep_info
- the replica looked for
public ReplicantInfo findReplicantAt(java.lang.String url, int port_nb) throws UnknownReplicantException
url
- the url of server hosting the replicant to look forport_nb
- the port nb of server hosting the replicant to look for
UnknownReplicantException
public TaskShellHandle getReplicantHandle(ReplicantInfo rep_info) throws UnknownReplicantException
UnknownReplicantException
public void setReplicantType(int type)
public void setReplicantRole(int new_role)
public void setLeaderInfo(ReplicantInfo new_info)
public void setReplicants(java.util.Hashtable new_replicants_list)
public void setReplicationNumber(int new_rep_number)
public abstract int compareTo(ReplicationStrategy other_strategy)
other_strategy
- the strategy to be compared
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- the object (strategy) to be compared
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to be compared (hopefully a
ReplicationStrategy
)
public int hashCode()
hashCode
in class java.lang.Object
public void registerReplicant(ReplicantInfo rep, TaskShellHandle sh)
rep
- the info concerning the new membersh
- the shell handle for the new memberpublic TaskShellHandle unregisterReplicant(ReplicantInfo doomed_rep_info)
doomed_rep_info
- the info concerning the removed member
public abstract void suspend()
public abstract void resume()
public void stop()
public void terminate() throws java.rmi.RemoteException
java.rmi.RemoteException
public abstract void deliverAsyncMessage(TaskShell shell, DarxMessage msg)
shell
- the shell corresponding to the present strategy
(used to process the message locally)msg
- the message to deliverpublic abstract java.io.Serializable deliverSyncMessage(TaskShell shell, DarxMessage msg)
shell
- the shell corresponding to the present strategy
(used to process the message locally)msg
- the message to deliver
public void handleUnreachableReplicant(ReplicantInfo dead, java.rmi.RemoteException re)
dead
- the information concerning the replicant which
fails to respondre
- the exception resulting from the failureprotected TaskShellHandle getRemoteShellHandle(ReplicantInfo rep_info)
rep_info
- the information concerning the replicant whose stub
is being retrieved
void display()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |