1 31 package org.objectweb.proactive.core.runtime; 32 33 import org.apache.log4j.Logger; 34 import org.objectweb.proactive.core.ProActiveException; 35 import org.objectweb.proactive.core.config.ProActiveConfiguration; 36 import org.objectweb.proactive.core.util.UrlBuilder; 37 38 39 53 public class StartRuntime { 54 static Logger logger = Logger.getLogger(StartRuntime.class.getName()); 58 protected String DefaultRuntimeURL; 59 protected String nodeURL; 60 protected String creatorID; 61 protected ProActiveRuntime proActiveRuntime; 62 protected String nodeNumber; 64 protected String vmName; 65 protected int nodenumber; 67 protected String protocolId; 68 69 70 protected StartRuntime() { 71 } 72 73 private StartRuntime(String [] args) { 74 this.nodeURL = args[0]; 75 this.creatorID = args[0].trim(); 76 this.DefaultRuntimeURL = args[1]; 78 this.nodeNumber = args[2]; 80 this.nodenumber = (new Integer (nodeNumber)).intValue(); 82 this.protocolId = args[3]; 83 this.vmName = args[4]; 84 } 85 86 public static void main(String [] args) { 87 if (args.length < 3) { 88 logger.error( 89 "Usage: java org.objectweb.proactive.core.runtime.StartRuntime <nodeURL> <DefaultRuntimeURL> <acquisitionMethod> <portNumber>"); 90 System.exit(1); 91 } 92 ProActiveConfiguration.load(); 93 94 97 try { 98 logger.info("**** Starting jvm on " + 99 java.net.InetAddress.getLocalHost().getCanonicalHostName()); 100 if (logger.isDebugEnabled()) { 101 logger.debug("**** Starting jvm with classpath " + 102 System.getProperty("java.class.path")); 103 logger.debug("**** with bootclasspath " + 104 System.getProperty("sun.boot.class.path")); 105 } 106 } catch (java.net.UnknownHostException e) { 107 e.printStackTrace(); 108 } 109 new StartRuntime(args).run(); 110 } 111 112 117 private void run() { 118 try { 119 120 proActiveRuntime = RuntimeFactory.getProtocolSpecificRuntime(System.getProperty("proactive.communication.protocol")+":"); 122 123 proActiveRuntime.getVMInformation().setCreationProtocolID(protocolId); 124 125 137 register(DefaultRuntimeURL); 138 } catch (ProActiveException e) { 139 e.printStackTrace(); 140 } 141 142 } 146 147 152 private void register(String hostName) { 153 try { 154 155 ProActiveRuntime PART = RuntimeFactory.getRuntime(DefaultRuntimeURL, 156 UrlBuilder.getProtocol(DefaultRuntimeURL)); 157 PART.register(proActiveRuntime, proActiveRuntime.getURL(), 158 creatorID, System.getProperty("proactive.communication.protocol")+":",vmName); 159 160 } catch (ProActiveException e) { 161 e.printStackTrace(); 162 } 163 } 164 } 165 | Popular Tags |