Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 6.0sp2 API Reference

## weblogic.time.common
Interface TimeServicesDef

public interface TimeServicesDef

Interface that defines a time service factory. Use this interface to schedule a recurring action, as shown in this example, which illustrates a recurring trigger established from a T3Client, but schedule and executed on a WebLogic Server.

      ParamSet schedParams = new ParamSet();
         schedParams.setParam("interval", 10000); // 10 seconds

       Scheduler scheduler = new Scheduler("tutorial.time.TimeTest", schedParams);
       Trigger  trigger    = new Trigger("tutorial.time.TimeTest");

       ScheduledTriggerDef std = t3.services.time()
                                   .getScheduledTrigger(scheduler, trigger)

Note that the Scheduler implements ScheduleDef, rather than Schedulable, so that its `setServices()` and `scheduleInit()` methods will be called; also the Trigger implements Triggerable for the same reason. The Schedule and Trigger wrapper objects in this case merely hold the name of the target server-side class and its parameters.

You may also pass client-side objects to these constructors, in which case the trigger is created and used exclusively from within the client's VM.

For more detailed information, read the Developers Guide, Using WebLogic Time services in the WebLogic Server documentation.

Author:
  Copyright (c) 1997-98, WebLogic, Inc. All Rights Reserved., Copyright (c) 1999 by BEA WebXpress. All Rights Reserved.
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
  `Schedulable`, `ScheduleDef`, `Triggerable`, `TriggerDef`

Method Summary
`long` | `currentTimeMillis()` Obtains the current server time, in "local server time" format.
`int` | `getLocalClockOffsetMillis()` Returns the number of milliseconds of LocalClockOffset between client and server, based on the algorithm shown in `currentTimeMillis()`.
`int` | `getRoundTripDelayMillis()` Returns the number of milliseconds of roundtrip delay between client and server, based on the algorithm shown in `currentTimeMillis()`.
`ScheduledTriggerDef` | `getScheduledTrigger(Schedulable scheduler, Triggerable trigger)` The Trigger's `trigger()` method will be scheduled for execution according to the time returned by the scheduler's `schedule()` method.
`ScheduledTriggerDef` | `getScheduledTrigger(Scheduler scheduler, Trigger trigger)` This method is used on a T3Client to instantiate a scheduled trigger on the WebLogic Server.

Method Detail

### getScheduledTrigger

    public ScheduledTriggerDef getScheduledTrigger(Schedulable scheduler,
                                                   Triggerable trigger)
                                            throws TimeTriggerException

  The Trigger's `trigger()` method will be scheduled for execution according to the time returned by the scheduler's `schedule()` method. The Scheduler is passed the current time in milliseconds since the epoch and returns `time + delta` to schedule execution for delta milliseconds in the future. If the `schedule()` method returns a value less than or equal to 0, then the trigger is unscheduled from future execution. The scheduler and trigger are run locally.

  The `getScheduledTrigger()` method returns a ScheduledTriggerDef object. To initiate execution, call the ScheduledTriggerDef's `schedule()` method. To cancel future execution, call its `cancel()` method, or return 0 from its `schedule()` method.

  The Schedulable object passed as an argument to this method may implement either Schedulable or ScheduleDef. The Trigger object may implement either Triggerable or TriggerDef.

  Parameters:
    `scheduler` - Object that implements a `schedule()` method
    `trigger` - Object that implements a trigger() method
  Returns:
    ScheduledTriggerDef to initiate and cancel the scheduled trigger
  Throws:
    TimeTriggerException - if an error occurs when installing the scheduled trigger
  See Also:
    `ScheduledTriggerDef`

### getScheduledTrigger

    public ScheduledTriggerDef getScheduledTrigger(Scheduler scheduler,
                                                   Trigger trigger)
                                            throws TimeTriggerException

  This method is used on a T3Client to instantiate a scheduled trigger on the WebLogic Server. The Scheduler and Trigger objects are wrappers that contain the name of classes that implement Schedulable and Triggerable interfaces.

  If the supplied classes also implement ScheduleDef or TriggerDef, you can parameters to the Scheduler and Trigger constructors via calls to `scheduleInit()` and `triggerInit()`. Their `setServices()` method will also be called, for access to WebLogic services.

  The `getScheduledTrigger()` method returns a ScheduledTriggerDef object. To initiate execution, call its the ScheduledTriggerDef's `schedule()` method. To cancel future execution, call its `cancel()` method.

  Parameters:
    `scheduler` - Wrapper for a Schedulable or ScheduleDef class name and (optionally) a ParamSet for initialization
    `trigger` - Wrapper for a Triggerable or TriggerDef class name and (optionally) a ParamSet for initialization.
  Returns:
    ScheduledTriggerDef for initiating and cancelling the scheduled trigger.
  Throws:
    TimeTriggerException - if an error occurs when installing the scheduled trigger

### currentTimeMillis

    public long currentTimeMillis()
                           throws T3Exception

  Obtains the current server time, in "local server time" format. "Local server time" format is the server's time, adjusted for propogation delay between the invoker and the WebLogic Server -- which is 0 when the invoker is in the server, and some positive number of milliseconds when the invoker is in the client or in another WebLogic Server -- and the difference in timezones between the client and the server.

  Within the WebLogic Server, this is simply a wrapper for java.util.Date() (for JDK 1.0.2-based Tengah Servers) and `java.util.GregorianCalendar()` (for JDK 1.1 and above). On clients, however, we use (S)NTP-style algorithms (see RFC 2030, Section 5, page 12) in order to calculate roundtrip delay "d" and local clock offset "t" to calculate the appropriate time value. [source RFC2030]

  Returns:
    Current server time in local server time format
  Throws:
    T3Exception - if the time cannot be properly returned

### getRoundTripDelayMillis

    public int getRoundTripDelayMillis()
                                throws T3Exception

  Returns the number of milliseconds of roundtrip delay between client and server, based on the algorithm shown in `currentTimeMillis()`. If unknown or out of bounds (over 2^31-1 milliseconds), then a T3Exception is thrown.

  Returns:
    Milliseconds of roundtrip delay
  Throws:
    T3Exception - if the return value is unknown or out of bounds

### getLocalClockOffsetMillis

    public int getLocalClockOffsetMillis()
                                  throws T3Exception

  Returns the number of milliseconds of LocalClockOffset between client and server, based on the algorithm shown in `currentTimeMillis()`. If unknown or out of bounds (over 2^31-1 milliseconds), then a T3Exception is thrown.

  Returns:
    Milliseconds of clock offset between client and server
  Throws:
    T3Exception - if the return value is unknown or out of bounds

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs60
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD