WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

examples.time
Class ServerTimer

java.lang.Object
  |
  +--examples.time.ServerTimer
All Implemented Interfaces:
weblogic.time.common.Schedulable, weblogic.time.common.Triggerable

public class ServerTimer
extends java.lang.Object
implements weblogic.time.common.Schedulable, weblogic.time.common.Triggerable

This application connects to a WebLogic Server, and schedules a recurring trigger that executes on the server. The server dynamically loads an instance of the ServerTimer class, repeatedly calling its schedule method to schedule execution of its trigger method. In this example, the timer starts out at a 0 second delay, but with each event, the delay is increased by 1 second. When it reaches 10, the trigger is cancelled.

Assuming that the server is running on port 7001 of the local machine, you would run this example using the following command:

  java examples.time.ServerTimer t3://localhost:7001

View the server output logs to see the results of the timer execution.

Author:
Copyright (c) 1996-2000 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
ServerTimer()
           
 
Method Summary
static void main(java.lang.String[] argv)
          Main allows this example to be called from the command line.
 long schedule(long t)
           
 void trigger(weblogic.time.common.Schedulable sched)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerTimer

public ServerTimer()
Method Detail

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Main allows this example to be called from the command line. String argv are the params for the event registration.

schedule

public long schedule(long t)
Specified by:
schedule in interface weblogic.time.common.Schedulable

trigger

public void trigger(weblogic.time.common.Schedulable sched)
Specified by:
trigger in interface weblogic.time.common.Triggerable

Documentation is available at
http://e-docs.bea.com/wls/docs60

Copyright © 2000 BEA Systems, Inc. All Rights Reserved.