Skip to content

Commit

Permalink
final order
Browse files Browse the repository at this point in the history
  • Loading branch information
halolk committed Feb 11, 2014
1 parent e28b445 commit f915d38
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="/Users/wenzheli/Workspaces/lab2/snakeyaml-1.13.jar"/>
<classpathentry kind="lib" path="E:/18842/snakeyaml-1.13.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file modified bin/lab2/Clock.class
Binary file not shown.
Binary file modified bin/lab2/GroupsRpg.class
Binary file not shown.
Binary file modified bin/lab2/HostInfo.class
Binary file not shown.
Binary file modified bin/lab2/Hosts.class
Binary file not shown.
Binary file modified bin/lab2/Logger$LogClientThread.class
Binary file not shown.
Binary file modified bin/lab2/Logger.class
Binary file not shown.
Binary file modified bin/lab2/MessagePasser$ClientThread.class
Binary file not shown.
Binary file modified bin/lab2/MessagePasser.class
Binary file not shown.
Binary file modified bin/lab2/MulticastMessagePasser.class
Binary file not shown.
Binary file modified bin/lab2/Rules.class
Binary file not shown.
Binary file modified bin/lab2/VectorClock.class
Binary file not shown.
22 changes: 11 additions & 11 deletions src/lab2/MessagePasser.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ public void run() {
MulticastMessage receiveMessage= mmp.receive((MulticastMessage)(incomingMessage));
if(receiveMessage != null){
// update group clock
/*groupsRpg.getClockGroup().get(receiveMessage.getGroupName()
).adjustClock(receiveMessage.getClockForGroup());*/
groupsRpg.getClockGroup().get(receiveMessage.getGroupName()
).adjustClock(receiveMessage.getClockForGroup());

inputQueue.add(receiveMessage);

Expand Down Expand Up @@ -337,8 +337,8 @@ public void run() {
MulticastMessage dup = new MulticastMessage((MulticastMessage)receiveMessage);
dup.setDuplicate(true);
// update group clock
/*groupsRpg.getClockGroup().get(receiveMessage.getGroupName()
).adjustClock(receiveMessage.getClockForGroup());*/
groupsRpg.getClockGroup().get(receiveMessage.getGroupName()
).adjustClock(receiveMessage.getClockForGroup());
inputQueue.add(receiveMessage);
inputQueue.add(dup);
}
Expand Down Expand Up @@ -409,8 +409,8 @@ private void inputReceiveBuffer(){
MulticastMessage receiveMessage = mmp.receive((MulticastMessage)(delayMsg));
if(receiveMessage != null) {
// update group clock
/*groupsRpg.getClockGroup().get(receiveMessage.getGroupName()
).adjustClock(receiveMessage.getClockForGroup());*/
groupsRpg.getClockGroup().get(receiveMessage.getGroupName()
).adjustClock(receiveMessage.getClockForGroup());
inputQueue.add(receiveMessage);
}
}
Expand All @@ -432,19 +432,19 @@ private void showCommandPrompt() {
while ((inputCommand = in.readLine()) != null) {
String[] tokens = inputCommand.split(" ");
if (tokens.length > 0) {
if ("s".equals(tokens[0]) && tokens.length == 3) {
if ("s".equals(tokens[0]) && tokens.length == 4) {
/**
* send multicast message
*/
if(tokens[1].startsWith("Group")){
Message message = new Message(tokens[1], tokens[2], null);
Message message = new Message(tokens[1], tokens[2], tokens[3]);
message.setSource(localName);
this.hostTimeStamp.addClock();
this.mmp.send(tokens[1], message);
}
else{
// Send: Create a new message and send
Message message = new Message(tokens[1], tokens[2], null);
Message message = new Message(tokens[1], tokens[2], tokens[3]);
message.setSource(localName);
message.setSeqNum(nextSeqNum++);
// Increment Local TimeStamp
Expand All @@ -471,8 +471,8 @@ else if(message instanceof MulticastMessage){
MulticastMessage mcMessage = (MulticastMessage) message;
System.out.println(mcMessage.toString());
this.hostTimeStamp.adjustClock(mcMessage.getTimeStamp());
groupsRpg.getClockGroup().get(mcMessage.getGroupName()
).adjustClock(mcMessage.getClockForGroup());
//groupsRpg.getClockGroup().get(mcMessage.getGroupName()
// ).adjustClock(mcMessage.getClockForGroup());
}
}

Expand Down

0 comments on commit f915d38

Please sign in to comment.