public static NetworkTopology createEmptyTopology() { return new NetworkTopology(); }
protected NetworkNode(final String name, final NetworkNode parentNode, final NetworkTopology networkTopology) { this.name = name; this.parentNode = parentNode; this.networkTopology = networkTopology; if (this.parentNode != null) { this.parentNode.addChild(this); } if (this.networkTopology != null) { this.networkTopology.addNode(this); } }
public static NetworkTopology fromFile(final String topologyFileName) throws IOException { return fromFile(new File(topologyFileName)); }
public static NetworkTopology fromFile(final File topologyFile) throws IOException { final NetworkTopology topology = new NetworkTopology(); NetworkNode previousNode = topology.getRootNode(); for (int i = 0; i < splits.length; i++) { NetworkNode networkNode = topology.getNodeByName(splits[i]); if (networkNode == null) { networkNode = new NetworkNode(splits[i], previousNode, topology);
NetworkNode parentNode = this.networkTopology.getRootNode(); NetworkNode currentStubNode = null; currentStubNode = this.networkTopology.getNodeByName(instanceName); if (currentStubNode != null) { break; instanceName = instanceConnectionInfo.address().toString(); instanceName = instanceName.replaceAll("/", ""); // Remove any / characters currentStubNode = this.networkTopology.getNodeByName(instanceName);
@Override public void reportHeartBeat(final InstanceConnectionInfo instanceConnectionInfo, final HardwareDescription hardwareDescription) { synchronized (this.synchronizationObject) { if(!localInstances.containsKey(instanceConnectionInfo)){ LocalInstance localInstance = new LocalInstance(this.defaultInstanceType, instanceConnectionInfo, this.networkTopology.getRootNode(), this.networkTopology, hardwareDescription); localInstances.put(instanceConnectionInfo, localInstance); this.instanceTypeDescriptionMap.put(this.defaultInstanceType, InstanceTypeDescriptionFactory .construct(this.defaultInstanceType, hardwareDescription, localInstances.size())); } } }
/** * Constructor. */ public ClusterManager() { this.registeredHosts = new HashMap<InstanceConnectionInfo, ClusterInstance>(); this.slicesOfJobs = new HashMap<JobID, List<AllocatedSlice>>(); // Load the instance type this cluster can offer this.defaultInstanceType = InstanceTypeFactory.constructFromDescription(ConfigConstants.DEFAULT_INSTANCE_TYPE); this.availableInstanceTypes = new InstanceType[] { this.defaultInstanceType }; this.instanceAccommodationMatrix = calculateInstanceAccommodationMatrix(); this.instanceTypeDescriptionMap = new SerializableHashMap<InstanceType, InstanceTypeDescription>(); long tmpCleanUpInterval = (long) GlobalConfiguration.getInteger(CLEANUP_INTERVAL_KEY, DEFAULT_CLEANUP_INTERVAL) * 1000; if (tmpCleanUpInterval < 10) { // Clean up interval must be at least ten seconds LOG.warn("Invalid clean up interval. Reverting to default cleanup interval of " + DEFAULT_CLEANUP_INTERVAL + " secs."); tmpCleanUpInterval = DEFAULT_CLEANUP_INTERVAL; } this.cleanUpInterval = tmpCleanUpInterval; // sort available instances by CPU core sortAvailableInstancesByNumberOfCPUCores(); this.networkTopology = NetworkTopology.createEmptyTopology(); // look every BASEINTERVAL milliseconds for crashed hosts final boolean runTimerAsDaemon = true; new Timer(runTimerAsDaemon).schedule(cleanupStaleMachines, 1000, 1000); // Load available instance types into the instance description list updateInstaceTypeDescriptionMap(); }
public int getDistance(final String nodeName) { final NetworkNode networkNode = this.networkTopology.getNodeByName(nodeName); if (networkNode == null) { return Integer.MAX_VALUE; } if (this.equals(networkNode)) { return 0; } return getDistance(networkNode); }
public void remove() { if (!isLeafNode()) { return; } if (this.parentNode != null) { this.parentNode.removeChild(this); } if (this.networkTopology != null) { this.networkTopology.removeNode(this); } }
public static NetworkTopology fromFile(final File topologyFile) throws IOException { final NetworkTopology topology = new NetworkTopology(); NetworkNode previousNode = topology.getRootNode(); for (int i = 0; i < splits.length; i++) { NetworkNode networkNode = topology.getNodeByName(splits[i]); if (networkNode == null) { networkNode = new NetworkNode(splits[i], previousNode, topology);
NetworkNode parentNode = this.networkTopology.getRootNode(); NetworkNode currentStubNode = null; currentStubNode = this.networkTopology.getNodeByName(instanceName); if (currentStubNode != null) { break; instanceName = instanceConnectionInfo.address().toString(); instanceName = instanceName.replaceAll("/", ""); // Remove any / characters currentStubNode = this.networkTopology.getNodeByName(instanceName);
@Override public void reportHeartBeat(final InstanceConnectionInfo instanceConnectionInfo, final HardwareDescription hardwareDescription) { synchronized (this.synchronizationObject) { if(!localInstances.containsKey(instanceConnectionInfo)){ LocalInstance localInstance = new LocalInstance(this.defaultInstanceType, instanceConnectionInfo, this.networkTopology.getRootNode(), this.networkTopology, hardwareDescription); localInstances.put(instanceConnectionInfo, localInstance); this.instanceTypeDescriptionMap.put(this.defaultInstanceType, InstanceTypeDescriptionFactory .construct(this.defaultInstanceType, hardwareDescription, localInstances.size())); } } }
/** * Constructor. */ public ClusterManager() { this.registeredHosts = new HashMap<InstanceConnectionInfo, ClusterInstance>(); this.slicesOfJobs = new HashMap<JobID, List<AllocatedSlice>>(); // Load the instance type this cluster can offer this.defaultInstanceType = InstanceTypeFactory.constructFromDescription(ConfigConstants.DEFAULT_INSTANCE_TYPE); this.availableInstanceTypes = new InstanceType[] { this.defaultInstanceType }; this.instanceAccommodationMatrix = calculateInstanceAccommodationMatrix(); this.instanceTypeDescriptionMap = new SerializableHashMap<InstanceType, InstanceTypeDescription>(); long tmpCleanUpInterval = (long) GlobalConfiguration.getInteger(CLEANUP_INTERVAL_KEY, DEFAULT_CLEANUP_INTERVAL) * 1000; if (tmpCleanUpInterval < 10) { // Clean up interval must be at least ten seconds LOG.warn("Invalid clean up interval. Reverting to default cleanup interval of " + DEFAULT_CLEANUP_INTERVAL + " secs."); tmpCleanUpInterval = DEFAULT_CLEANUP_INTERVAL; } this.cleanUpInterval = tmpCleanUpInterval; // sort available instances by CPU core sortAvailableInstancesByNumberOfCPUCores(); this.networkTopology = NetworkTopology.createEmptyTopology(); // look every BASEINTERVAL milliseconds for crashed hosts final boolean runTimerAsDaemon = true; new Timer(runTimerAsDaemon).schedule(cleanupStaleMachines, 1000, 1000); // Load available instance types into the instance description list updateInstaceTypeDescriptionMap(); }
public int getDistance(final String nodeName) { final NetworkNode networkNode = this.networkTopology.getNodeByName(nodeName); if (networkNode == null) { return Integer.MAX_VALUE; } if (this.equals(networkNode)) { return 0; } return getDistance(networkNode); }
public void remove() { if (!isLeafNode()) { return; } if (this.parentNode != null) { this.parentNode.removeChild(this); } if (this.networkTopology != null) { this.networkTopology.removeNode(this); } }
protected NetworkNode(final String name, final NetworkNode parentNode, final NetworkTopology networkTopology) { this.name = name; this.parentNode = parentNode; this.networkTopology = networkTopology; if (this.parentNode != null) { this.parentNode.addChild(this); } if (this.networkTopology != null) { this.networkTopology.addNode(this); } }
NetworkTopologyIterator(final NetworkTopology networkTopology) { traversalStack.add(new TraversalEntry(networkTopology.getRootNode())); refillStack(); }
this.networkTopology = NetworkTopology.createEmptyTopology();
public static NetworkTopology createEmptyTopology() { return new NetworkTopology(); }
public static NetworkTopology fromFile(final String topologyFileName) throws IOException { return fromFile(new File(topologyFileName)); }