1 5 package ve.luz.ica.jackass.daemon; 6 7 import java.lang.reflect.Method ; 8 9 import org.apache.commons.logging.Log; 10 import org.apache.commons.logging.LogFactory; 11 12 16 class InstantiatorThread extends Thread 17 { 18 private static final Log LOG = LogFactory.getLog(InstantiatorThread.class); 19 20 private String className; 21 private String [] commandLineParams = null; 22 23 28 public InstantiatorThread(String name, String [] params) 29 { 30 this.className = name; 31 this.commandLineParams = params; 32 } 33 34 38 public void run() 39 { 40 Class [] params = {String [].class}; 41 Class instClass; 42 try 43 { 44 instClass = Class.forName(className); 45 Method mainMethod = instClass.getDeclaredMethod("main", params); 46 mainMethod.invoke(null, new Object [] {commandLineParams}); 47 } 48 catch (Exception e) 49 { 50 LOG.error(e.getMessage(), e); 51 } 52 } 53 } 54 | Popular Tags |