ジョブ・スケジューラー Enterprise JavaBeans (EJB) インターフェースは、Compute Grid ジョブをプログラマチックに実行依頼および操作する場合に使用します。EJB インターフェースを WebSphere Application Server の基本スケジューラーと合わせて使用すると、Compute Grid ジョブをカレンダー・ベースで実行依頼することができます。
このトピックでは、WebSphere Application Server の基本スケジューラーを使用して、ジョブ・スケジューラーに Compute Grid ジョブを実行依頼する方法について説明します。
プロシージャー
-
スケジューラーを作成および構成します。スケジューラーの作成および構成方法について詳しくは、タスクの開発とスケジューリングを参照してください。
-
グリッド作業を実行依頼するためのスケジューラー・タスクを作成します。
このスケジューラー・タスクは、
ジョブ・スケジューラー EJB を起動して、Compute Grid ジョブを実行依頼します。
EJB を起動するタスクの作成に関する指示は、WebSphere Application Server バージョン 6.0 インフォメーション・センターの
Session Bean を呼び出すタスクの開発のトピックを参照してください。
このトピックには、
WebSphere スケジューラーのカレンダー機能の使用に関する指示も含まれています。以下に、ジョブ・スケジューラー EJB を起動する方法のタスク・コード例を示します。
// 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, for example, 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);
//To look up 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());
}
-
グリッド作業を実行依頼するためのスケジューラー・タスクをスケジュールに入れます。WebSphere Application
Server バージョン 6.0 インフォメーション・センターの『スケジューラーへのタスクのサブミット』を参照してください。