장기간 실행 스케줄러 EJB(Enterprise JavaBean) 인터페이스는 프로그램을 통해 장기간 실행 작업을 제출 및 조작할 때 사용됩니다. EJB 인터페이스는 WebSphere 스케줄러와 함께 사용하여 장기간 실행 작업을 달력에 기반하여 제출할 수 있습니다. 이 섹션에서는 WebSphere Application Server의 기본 스케줄러를 사용하여 장기간 실행 스케줄러에 장기간 실행 작업을 제출하는 방법을 설명합니다.
// These are the import statements needed by the Task import javax.naming.*; import com.ibm.websphere.longrun.JobScheduler; import com.ibm.websphere.longrun.JobSchedulerHome private JobSchedulerHome zjsHome = null; private JobScheduler zjs = null; public void process(TaskStatus task) () try{ //ensure that the xJCL can be placed in a String, eg: by reading an xJCL //file into a String. String xJCL = <xJCL as a string>; //obtain cell level naming Context InitialContext ctxt = new InitialContext(); Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); env.put(Context.PROVIDER_URL,"corbaloc:rir:/NameServiceCellRoot"); ctxt = new InitialContext(env); //in order to lookup the LRS EJB from the cell context in the namespace, //the name context to the Application Server or cluster to which the LRS //application is deployed has to be provided. //Eg: “nodes/myNode/servers/myServer” or “clusters/myCluster”. String longRunningContext = <long_running_context>; zjsHome = (JobSchedulerHome) ctxt.lookup(longRunningContext + "/ejb/com/ibm/websphere/longrun/JobSchedulerHome"); zjs = zjsHome.create(); zjs.submitJob( xJCL ); }catch (Exception e) { System.out.println(e.getMessage()); }
Related concepts
장기간 실행 스케줄러에 대한
웹 서비스 및 EJB 인터페이스