Skip to content

Commit

Permalink
new domain
Browse files Browse the repository at this point in the history
  • Loading branch information
akamel001 committed Apr 8, 2012
1 parent 141b735 commit 13f06d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Binary file modified bin/server/SessionTable.class
Binary file not shown.
24 changes: 12 additions & 12 deletions server/SimpleDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

public final class SimpleDB extends Thread {

public static final String MEMBER_LIST_DOMAIN = "CS5300PROJECT1BSDBMbrList";
public static final String MEMBER_LIST_DOMAIN = "CS5300PROJECT1BSDBMbrList1";

private static boolean DEBUG = true;

Expand Down Expand Up @@ -94,24 +94,24 @@ public void memberRefresh(){
//protocol of Section 3.9 every response will cause a server to be added to the MbrSet.
HashSet<IPP> retrySet = new HashSet<IPP>();
IPP ippLocal = RpcServer.getInstance().getIPPLocal();

if(DEBUG) System.out.println("RpcServer returned local ipp (" + ippLocal.toString() + ")");
for(IPP ipp : DBMbrList) {
if(ippLocal.equals(ipp))
continue;
if(RpcMessageCall.NoOp(ipp))
localMbrList.add(ipp);
else
retrySet.add(ipp);
// else
// retrySet.add(ipp);
}
for(IPP ipp : retrySet) {
if(RpcMessageCall.NoOp(ipp))
localMbrList.add(ipp);
}
// for(IPP ipp : retrySet) {
// if(RpcMessageCall.NoOp(ipp))
// localMbrList.add(ipp);
// }

//Add IPPself to the MbrSet

localMbrList.add(ippLocal);

if(DEBUG) System.out.println("MemberRefresh member list (" +localMbrList +")");

//Write this new MbrSet into the SDBMbrList on SimpleDB.
ArrayList<ReplaceableAttribute> newAttributes = new ArrayList<ReplaceableAttribute>();
Expand Down Expand Up @@ -163,7 +163,7 @@ public ArrayList<IPP> getLocalMembers(){

private ArrayList<IPP> getMembers(){
ArrayList<IPP> servers = new ArrayList<IPP>();
String query = "select " + AttrName + " from " + MEMBER_LIST_DOMAIN;
String query = "select * from " + MEMBER_LIST_DOMAIN;
SelectRequest selectRequest = new SelectRequest(query);
SelectResult result = sdbc.select(selectRequest);
List<Item> items = result.getItems();
Expand Down Expand Up @@ -216,7 +216,7 @@ public static SimpleDB getInstance() {

public static void main(String[] args){
SimpleDB db = SimpleDB.getInstance();
//db.deleteDomain(MEMBER_LIST_DOMAIN);
db.deleteDomain(MEMBER_LIST_DOMAIN);
}

public void run() {
Expand All @@ -228,7 +228,7 @@ public void run() {
double probOfRefresh = 1.0/localMbrList.size();
double rand = generator.nextDouble();
if(DEBUG) System.out.println("Local member list: " + localMbrList.toString());
if(rand <= probOfRefresh)
//if(rand <= probOfRefresh)
memberRefresh();
} catch (InterruptedException e) {
e.printStackTrace();
Expand Down

0 comments on commit 13f06d1

Please sign in to comment.