All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.hycube.pastry.routing.PastryRoutingManager Maven / Gradle / Ivy

Go to download

HyCube is a distributed hash table based on a hierarchical hypercube geometry, employing a novel variable metric adopting the Steinhaus transform.

There is a newer version: 1.0.5
Show newest version
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