All Examples  This Package

Class examples.workspace.monitor.DestructionMonitor

java.lang.Object
   |
   +----examples.workspace.monitor.DestructionMonitor

public class DestructionMonitor
extends Object
implements DestroyMonitor
This example shows how a Workspace Monitor can be used to trigger an event when a Workspace value is destroyed. It implements the interface weblogic.common.DestroyMonitor, in particular the preDestroy() and postDestroy() methods. You use these methods to operate on an object before and/or after it is destroyed. In this example, we also use WebLogic Events; we submit an event when the object is destroyed, potentially to notify any registrations that are interested in the object of its demise.

To set up this example:

  1. Set up your development shell as described in Setting up your environment.

  2. Compile this example by executing the following command in your development shell:

    $ javac -d %SERVER_CLASSES% DestructionMonitor.java

  3. You do not execute this example directly; it is called by the MonitorDemo class. You must compile all the other examples in this package before running MonitorDemo.

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

Constructor Index

 o DestructionMonitor()

Method Index

 o monitorInit(ParamSet, boolean)
Initializes a monitor.
 o postDestroy(Destroyable, ParamSet, Exception)
Implement this method to carry out some arbitrary operations after the target object is destroyed.
 o preDestroy(Destroyable, ParamSet)
Implement this method to carry out some arbitrary operations before the target object is destroyed.
 o setServices(T3ServicesDef)
Sets the services stub for this class.

Constructors

 o DestructionMonitor
 public DestructionMonitor()

Methods

 o monitorInit
 public void monitorInit(ParamSet params,
                         boolean isMaster) throws ParamSetException
Initializes a monitor. This allows passing of initialization parameters even when the object is instantiated remotely on the WebLogic Server with a default constructor (which cannot have arguments).

Parameters:
params - ParamSet of initialization values
isMaster - true if this is a Master Monitor
Throws: ParamSetException
if the Monitor cannot be initialized or there is a problem with the ParamSet
 o setServices
 public void setServices(T3ServicesDef services)
Sets the services stub for this class. It allows you to write a class that can be instantiated by a client or a WebLogic Server -- how this class accesses WebLogic services is determined by the services stub, which is set at runtime.

 o preDestroy
 public void preDestroy(Destroyable target,
                        ParamSet callbackData)
Implement this method to carry out some arbitrary operations before the target object is destroyed.

Parameters:
target - Object to be destroyed
callbackData - ParamSet of potential data for callback
 o postDestroy
 public void postDestroy(Destroyable target,
                         ParamSet callbackData,
                         Exception e)
Implement this method to carry out some arbitrary operations after the target object is destroyed. Here we submit an event with the target object as part of the event.

Parameters:
target - Object to be destroyed
callbackData - ParamSet of potential data for callback
e - Exception to be thrown if the monitor is vetoed or does not complete

All Examples  This Package