Update of /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/nc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23067/src/edu/harvard/syrah/pyxida/nc
Modified Files:
NCManager.java
Log Message:
problem with return XML values
Index: NCManager.java
===================================================================
RCS file: /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/nc/NCManager.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** NCManager.java 5 Dec 2006 19:01:29 -0000 1.23
--- NCManager.java 6 Dec 2006 22:03:54 -0000 1.24
***************
*** 14,17 ****
--- 14,18 ----
import edu.harvard.syrah.sbon.async.CallbacksIF.CB0;
import edu.harvard.syrah.sbon.async.CallbacksIF.CB1;
+ import edu.harvard.syrah.sbon.async.CallbacksIF.CB2;
import edu.harvard.syrah.sbon.comm.AddressFactory;
import edu.harvard.syrah.sbon.comm.AddressIF;
***************
*** 129,154 ****
/**
*/
! public boolean createProxyCoord(AddressIF remoteNode, long lease) {
! if (!Pyxida.USE_ICMP) return false;
if (addr2proxyClient.containsKey(remoteNode)) {
! log.debug("Not creating proxy coord for "+remoteNode+
! " because one already exists");
! return false;
}
- log.warn("createProxyCoord for "+remoteNode);
ProxyClient client = new ProxyClient(remoteNode,lease);
addr2proxyClient.put(remoteNode,client);
client.init();
! return true;
}
! public boolean renewLeaseOnProxyCoord(AddressIF remoteNode, long lease) {
ProxyClient proxyCoord = addr2proxyClient.get(remoteNode);
if (proxyCoord == null) {
! log.debug("No proxy coord for "+remoteNode+" found");
! return false;
}
proxyCoord.renewLease(lease);
! return true;
}
--- 130,158 ----
/**
*/
! public String createProxyCoord(AddressIF remoteNode, long lease) {
! if (!Pyxida.USE_ICMP) return "Proxy coords require ICMP";
if (addr2proxyClient.containsKey(remoteNode)) {
! String error = "Not creating proxy coord for "+remoteNode+
! " because one already exists";
! log.debug(error);
! return error;
}
ProxyClient client = new ProxyClient(remoteNode,lease);
addr2proxyClient.put(remoteNode,client);
client.init();
! String res = "Created proxy coord for"+remoteNode;
! log.debug(res);
! return res;
}
! public String renewLeaseOnProxyCoord(AddressIF remoteNode, long lease) {
ProxyClient proxyCoord = addr2proxyClient.get(remoteNode);
if (proxyCoord == null) {
! String error = "No proxy coord for "+remoteNode+" found";
! log.debug(error);
! return error;
}
proxyCoord.renewLease(lease);
! return "Success";
}
***************
*** 166,178 ****
/**
! * @return true if proxy coordinate existed for remoteNode
*/
! public boolean destroyProxyCoord(AddressIF remoteNode) {
ProxyClient proxyCoord = addr2proxyClient.remove(remoteNode);
if (proxyCoord == null) {
! log.debug("No proxy coord for "+remoteNode+" found");
! return false;
}
! return true;
}
--- 170,183 ----
/**
! * @return result of proxy coordinate removal
*/
! public String destroyProxyCoord(AddressIF remoteNode) {
ProxyClient proxyCoord = addr2proxyClient.remove(remoteNode);
if (proxyCoord == null) {
! String error = "No proxy coord for "+remoteNode+" found";
! log.debug(error);
! return error;
}
! return "Success";
}
***************
*** 221,225 ****
*/
public void estimateRTT(final AddressIF nodeA, final AddressIF nodeB,
! final CB1<Double> cbDistance) {
log.debug ("estimateRTT a="+nodeA+" b="+nodeB);
comm.sendRequestMessage
--- 226,230 ----
*/
public void estimateRTT(final AddressIF nodeA, final AddressIF nodeB,
! final CB2<Double,String> cbDistance) {
log.debug ("estimateRTT a="+nodeA+" b="+nodeB);
comm.sendRequestMessage
***************
*** 243,253 ****
double distance = respA.coord.distanceTo(respB.coord);
log.debug("distance= "+distance);
! cbDistance.call(CBResult.OK(), distance);
break;
}
case TIMEOUT:
case ERROR: {
! log.warn("Coord request to "+nodeB+" failed");
! cbDistance.callCBResult(resultB);
}
}
--- 248,259 ----
double distance = respA.coord.distanceTo(respB.coord);
log.debug("distance= "+distance);
! cbDistance.call(CBResult.OK(), distance, "Success");
break;
}
case TIMEOUT:
case ERROR: {
! String error = "Coord request to "+nodeB+" failed:"+ resultB.toString();
! log.warn(error);
! cbDistance.call(resultB, new Double(0), error);
}
}
***************
*** 259,264 ****
case TIMEOUT:
case ERROR: {
! log.warn("Coord request to "+nodeA+" failed");
! cbDistance.callCBResult(resultA);
break;
}
--- 265,270 ----
case TIMEOUT:
case ERROR: {
! String error = "Coord request to "+nodeA+" failed:"+ resultA.toString();
! cbDistance.call(resultA, new Double(0), error);
break;
}
|