Accessing schedulers

Each configured scheduler is available using the Scheduler API from a Java™ Platform, Enterprise Edition (Java EE) server application, such as a servlet or Enterprise JavaBean (EJB) module. Use a Java Naming and Directory Interface (JNDI). name or resource reference to access schedulers. Each scheduler is also available using the Java™ Management Extensions (JMX) API, using its associated WASScheduler MBean.

About this task

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.

Procedure

  1. Locate schedulers using the javax.naming.Context.lookup() method from a Java EE 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
    

Results

The scheduler is now available to use from a Java EE 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.



In this information ...


Related reference

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Oct 20, 2010 11:50:58 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-base-iseries&topic=tsch_lookup
File name: tsch_lookup.html