|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.distributed.api.Environment
Defines all methods that can be used by any distributed appication process
| Field Summary | |
static int |
CONTROL_PORT
Default port number |
int |
N
Number of processes in distributed system |
| Constructor Summary | |
Environment(java.lang.String filename,
EnvironmentListener up)
establishes the connections with other processes & starts listening on the channel |
|
| Method Summary | |
protected void |
allSnapsReceived(int sendsnapto,
java.lang.String chanstate)
Sends the global picture of distributed system to the requesting process |
protected void |
appendState(java.lang.String s)
Appends to present global state |
Clock |
getClock()
Returns the internal clock of the application process |
void |
getConsensus(int val)
Proposes consensus value of this application process & achieves consensus |
int |
getPid()
Returns process id of the application process in distributed system |
protected EnvironmentListener |
getUserProcess()
Returns EnvironmentListener of application process |
void |
holdElection()
Does the election using protocol 1 |
void |
holdElection2()
Does the election using protocol 2 |
void |
messageReceived(Message m)
Handles both control & application messages |
void |
releaseLock()
Exits critical sections & releases lock |
void |
requestCsEntry()
Enters the application process in critical section |
protected void |
saveLocalState(int source,
int sendsnapto)
Saves local state & turns red |
void |
sendTo(int despid,
java.lang.String messgtext)
Sends messgtext message to particular destination |
protected void |
sendTo(int despid,
java.lang.String messgtext,
int messgtype,
boolean clock_required,
int clock_type)
Environment uses this method to send message to a particular destination |
void |
sendToAllNeighbours(java.lang.String messgtext)
Broadcasts message |
protected void |
sendToAllNeighbours(java.lang.String messgtext,
int messgtype,
boolean clock_required,
int clock_type)
Used by Environment to broadcast messages |
java.lang.String |
takeSnapshot()
Returns global picture of the entire distributed system |
void |
terminate()
Closes all connection |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int CONTROL_PORT
public int N
| Constructor Detail |
public Environment(java.lang.String filename,
EnvironmentListener up)
throws java.lang.Exception
filename - configuration file of the networkup - application process Environment listener| Method Detail |
protected void allSnapsReceived(int sendsnapto,
java.lang.String chanstate)
sendsnapto - process to which snapshot has to be sentchanstate - state of the channelprotected void appendState(java.lang.String s)
s - string to be appended to global statepublic Clock getClock()
public void getConsensus(int val)
val - value to be proposedpublic int getPid()
protected EnvironmentListener getUserProcess()
public void holdElection()
public void holdElection2()
public void messageReceived(Message m)
messageReceived in interface MessageReceiverListenerm - Message that has been receivedpublic void releaseLock()
public void requestCsEntry()
protected void saveLocalState(int source,
int sendsnapto)
source - process from which the marker was receivedsendsnapto - process to which snapshot has to be sent
public void sendTo(int despid,
java.lang.String messgtext)
messgtext - message to be sent
protected void sendTo(int despid,
java.lang.String messgtext,
int messgtype,
boolean clock_required,
int clock_type)
messgtext - message to be sentmessgtype - type of the messageclock_required - says whether clock is required or notclock_type - type of clock(lamport or vector)public void sendToAllNeighbours(java.lang.String messgtext)
messgtext - message to be broadcasted
protected void sendToAllNeighbours(java.lang.String messgtext,
int messgtype,
boolean clock_required,
int clock_type)
messgtext - message to be sentmessgtype - type of the messageclock_required - says whether clock is required or notclock_type - type of clock(lamport or vector)public java.lang.String takeSnapshot()
public void terminate()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||