1 31 package org.objectweb.proactive.ic2d.util; 32 33 import org.objectweb.proactive.core.node.Node; 34 import org.objectweb.proactive.ic2d.data.*; 35 36 37 public class CreateJiniNodeTask implements Runnable { 38 private WorldObject worldObject; 39 private String host; 40 41 public CreateJiniNodeTask() { 42 } 43 44 public CreateJiniNodeTask(WorldObject worldObject) { 45 this.worldObject = worldObject; 46 this.host = null; 47 } 48 49 public CreateJiniNodeTask(WorldObject worldObject, String host) { 50 this.worldObject = worldObject; 51 this.host = host; 52 } 53 54 public void run() { 55 System.out.println("CreateJininodeTask: lancement de la recherche"); 56 57 Node[] nodes; 58 JiniNodeFinder finder = new JiniNodeFinder(); 59 nodes = finder.findNodes(host); 60 61 for (int i = 0; i < nodes.length; i++) { 63 Node node = nodes[i]; 64 String nodeName = node.getNodeInformation().getName(); 65 String hostname = node.getNodeInformation().getInetAddress() 66 .getCanonicalHostName(); 67 HostObject hostObject = worldObject.getHostObject(hostname); 68 69 if (hostObject == null) { 71 hostObject = new HostObject(worldObject, hostname, null); 73 worldObject.addHostsObject(hostObject); 74 worldObject.putChild(hostname, hostObject); 75 } 76 77 VMObject vmObject = hostObject.findVMObjectHavingExistingNode(nodeName); 78 79 if (vmObject == null) { 80 hostObject.addVMObject(node); 83 } else { 84 vmObject.addNodeObject(node); 86 vmObject.sendEventsForAllActiveObjects(); 87 } 88 } 89 } 90 } 91 | Popular Tags |