WebSphere Application Server - Express, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Accessing schedulers

Why and when to perform this task

Each configured scheduler is available using the Scheduler API from a J2EE server application, such as a servlet or EJB module. Use a JNDI name or resource reference to access schedulers. Each scheduler is also available using the JMX API, using its associated WASScheduler MBean.

Scheduler and WASScheduler interfaces are the starting point for all scheduler activities. Each scheduler is independent and allows task life cycle operations, such as creating new tasks.

Steps for this task

  1. Locate schedulers using the javax.naming.Context.lookup() method from a J2EE server application, such as a servlet or EJB module like the following example:
    //lookup the scheduler to be used
    import com.ibm.websphere.scheduler.Scheduler;
    import javax.naming.InitialContext;
    Scheduler scheduler = (Scheduler)new InitialContext.lookup("java:comp/env/sched/MyScheduler");
    
  2. Use wsadmin to locate a WASScheduler MBean using JACL scripting:
    set jndiName sched/MyScheduler
    
    # Map the JNDI name to the mbean name.  The mbean name is 
    # formed by replacing the / in the JNDI namewith . and prepending 
    # Scheduler_ 
    regsub -all {/} $jndiName "." jndiName
    set mbeanName Scheduler_$jndiName
    
    puts "Looking-up Scheduler MBean $mbeanName"
    set sched [$AdminControl queryNames WebSphere:*,type=WASScheduler,name=$mbeanName]
    puts $sched
    

Result

The scheduler is now available to use from a J2EE server application or from a JMX API client. To create a task see the topics, Developing a task that calls a session bean or Developing a task that sends a JMS message.



Related tasks
Developing and scheduling tasks
Developing a task that calls a session bean
Developing a task that sends a Java Message Service message

Related reference
MBean Javadoc

Task topic    

Terms of Use | Feedback

Last updated: Jun 8, 2005 12:45:23 PM EDT
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/scheduler/tasks/tsch_lookup.html

© Copyright IBM Corporation 2002, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)