net.hycube.pastry.routing.PastryRoutingManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hycube Show documentation
Show all versions of hycube Show documentation
HyCube is a distributed hash table based on a hierarchical hypercube geometry, employing a novel variable metric adopting the Steinhaus transform.
package net.hycube.pastry.routing;
import net.hycube.core.NodePointer;
import net.hycube.logging.LogHelper;
import net.hycube.messaging.messages.HyCubeMessage;
import net.hycube.pastry.nexthopselection.PastryNextHopSelectionParameters;
import net.hycube.routing.HyCubeRoutingManager;
public class PastryRoutingManager extends HyCubeRoutingManager {
private static org.apache.commons.logging.Log devLog = LogHelper.getDevLog(PastryRoutingManager.class);
// private static org.apache.commons.logging.Log msgLog = LogHelper.getMessagesLog();
@Override
public NodePointer findNextHop(HyCubeMessage msg) {
if (devLog.isTraceEnabled()) {
devLog.trace("Finding next hop for message #" + msg.getSerialNoAndSenderString());
}
PastryNextHopSelectionParameters parameters = new PastryNextHopSelectionParameters();
parameters.setPMHApplied(msg.isPMHApplied());
parameters.setSkipRandomNumOfNodesApplied(msg.isSkipRandomNumOfNodesApplied());
parameters.setSecureRoutingApplied(msg.isSecureRoutingApplied());
parameters.setIncludeMoreDistantNodes(false);
NodePointer res = nextHopSelector.findNextHop(msg.getRecipientId(), parameters);
msg.setPMHApplied(parameters.isPMHApplied());
msg.setSkipRandomNumOfNodesApplied(parameters.isSkipRandomNumOfNodesApplied());
msg.setSecureRoutingApplied(parameters.isSecureRoutingApplied());
return res;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy