1 20 package org.apache.cactus.integration.ant.container.enhydra; 21 22 import java.lang.reflect.Method ; 23 24 import org.apache.cactus.integration.ant.container.AbstractServerRun; 25 26 32 public class EnhydraRun extends AbstractServerRun 33 { 34 37 public EnhydraRun(String [] theArgs) 38 { 39 super(theArgs); 40 } 41 42 47 public static void main(String [] theArgs) 48 { 49 EnhydraRun enhydra = new EnhydraRun(theArgs); 50 51 enhydra.doRun(); 52 } 53 54 60 protected final Thread doStartServer(String [] theArgs) 61 { 62 try 63 { 64 Class enhydraClass = 65 Class.forName("com.lutris.multiServer.MultiServer"); 66 Method initMethod = enhydraClass.getMethod("main", 67 new Class [] {theArgs.getClass()}); 68 69 initMethod.invoke(null, new Object [] {theArgs}); 70 } 71 catch (Exception e) 72 { 73 e.printStackTrace(); 74 throw new RuntimeException ("Cannot create instance of MultiServer"); 75 } 76 77 return this; 78 } 79 80 86 protected final void doStopServer(String [] theArgs, 87 Thread theRunningServerThread) throws Exception 88 { 89 try 90 { 91 Class enhydraClass = 92 Class.forName("com.lutris.multiServer.MultiServer"); 93 Method shutDownMethod = enhydraClass.getMethod("shutdown", null); 94 95 shutDownMethod.invoke(null, null); 96 } 97 catch (Exception e) 98 { 99 e.printStackTrace(); 100 throw new RuntimeException ("Cannot stop running instance of " 101 + "MultiServer"); 102 } 103 } 104 } 105 | Popular Tags |