Update of /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/nc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17794/src/edu/harvard/syrah/pyxida/nc
Modified Files:
NCManager.java
Log Message:
fixed xml calls, added gravity
Index: NCManager.java
===================================================================
RCS file: /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/nc/NCManager.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** NCManager.java 4 Dec 2006 13:14:19 -0000 1.17
--- NCManager.java 4 Dec 2006 16:32:44 -0000 1.18
***************
*** 84,87 ****
--- 84,88 ----
public void init(final CB0 cbDone) {
comm.registerMessageCB(GossipRequestMsg.class, new GossipHandler());
+ comm.registerMessageCB(CoordRequestMsg.class, new CoordHandler());
upNeighbors = new HashSet<AddressIF>();
***************
*** 166,169 ****
--- 167,195 ----
/**
+ * Fetch coordinate from remote node.
+ */
+ public void getRemoteCoord(final AddressIF remoteNode,
+ final CB1<Coordinate> cbCoord) {
+ comm.sendRequestMessage
+ (new CoordRequestMsg(), remoteNode,
+ new ObjCommRRCB<CoordResponseMsg>() {
+ protected void cb(CBResult result, final CoordResponseMsg resp,
+ AddressIF remoteAddr, Long ts) {
+ switch (result.state) {
+ case OK: {
+ log.debug("received coord back from "+remoteNode);
+ cbCoord.call(CBResult.OK(), resp.coord);
+ break;
+ }
+ case TIMEOUT:
+ case ERROR: {
+ log.warn("Coord request to "+remoteNode+" failed");
+ cbCoord.call(result, null);
+ }
+ }
+ }});
+ }
+
+ /**
* Fetches coordinates from two nodes and returns
* the distance between them.
***************
*** 171,175 ****
public void estimateRTT(final AddressIF nodeA, final AddressIF nodeB,
final CB1<Double> cbDistance) {
! log.warn ("ncm a "+nodeA+" b "+nodeB);
comm.sendRequestMessage
(new CoordRequestMsg(), nodeA,
--- 197,201 ----
public void estimateRTT(final AddressIF nodeA, final AddressIF nodeB,
final CB1<Double> cbDistance) {
! log.debug ("estimateRTT a="+nodeA+" b="+nodeB);
comm.sendRequestMessage
(new CoordRequestMsg(), nodeA,
***************
*** 276,280 ****
public void cb(CBResult result, CoordRequestMsg msg, AddressIF remoteAddr,
Long ts, final CB1<Boolean> cbHandled) {
! log.debug("in CoordHandler cb: "+msg);
long curr_time = System.currentTimeMillis();
sendResponseMessage("Coord", remoteAddr,
--- 302,306 ----
public void cb(CBResult result, CoordRequestMsg msg, AddressIF remoteAddr,
Long ts, final CB1<Boolean> cbHandled) {
! log.debug("in CoordHandler remoteAddr="+remoteAddr);
long curr_time = System.currentTimeMillis();
sendResponseMessage("Coord", remoteAddr,
|