1 4 package com.tc.objectserver.control; 5 6 import com.tc.process.LinkedJavaProcess; 7 import com.tc.test.TestConfigObject; 8 import com.tc.util.Assert; 9 10 import java.io.File ; 11 import java.io.FileNotFoundException ; 12 13 public class ExtraL1ProcessControl extends ExtraProcessServerControl { 14 15 private final Class mainClass; 16 private final String [] mainArgs; 17 private final File directory; 18 19 public ExtraL1ProcessControl(String l2Host, int dsoPort, Class mainClass, String configFileLoc, String [] mainArgs, 20 File directory) throws FileNotFoundException { 21 super(new DebugParams(), l2Host, dsoPort, 0, configFileLoc, true); 22 this.mainClass = mainClass; 23 this.mainArgs = mainArgs; 24 this.directory = directory; 25 26 setJVMArgs(); 27 } 28 29 protected LinkedJavaProcess createLinkedJavaProcess() { 30 LinkedJavaProcess out = super.createLinkedJavaProcess(); 31 out.setDirectory(this.directory); 32 return out; 33 } 34 35 private void setJVMArgs() { 36 try { 37 String bootclasspath = "-Xbootclasspath/p:" + TestConfigObject.getInstance().normalBootJar(); 38 System.err.println("Bootclasspath:" + bootclasspath); 39 this.jvmArgs.add("-Dtc.classpath=" + System.getProperty("java.class.path")); 40 this.jvmArgs.add(bootclasspath); 41 this.jvmArgs.add("-Dtc.config=" + super.configFileLoc); 42 } catch (Exception e) { 43 throw Assert.failure("Can't set JVM args", e); 44 } 45 } 46 47 protected String getMainClassName() { 48 return mainClass.getName(); 49 } 50 51 protected String [] getMainClassArguments() { 52 return mainArgs; 53 } 54 55 public boolean isRunning() { 56 return true; 58 } 59 60 public void attemptShutdown() throws Exception { 61 process.destroy(); 63 } 64 } 65 | Popular Tags |