An Event may be created at the top-level under the Listener object, as a subordinate of a Container object, or subordinate to another Event object (a sub-Event). In the first two cases, the programmer must specify the event class of the Event, while in the latter case, the class must be the same as the parent Event object's class.
This method will create an Event object only when that object does not already exist. If the object already exists, the existing object is returned.
When using the Listener object or a Container object to create an Event, the
event class must be specified. Java™ does not support the use of enumerated types,
therefore, the event class is expressed as an instance of the PCHeventClass
class. This is a "type safe enumeration" in Java which is limited
to the pre-created definitions PCHeventClass.RPC
and PCHeventClass.USER
.
When creating an Event subordinate to another Event (sub-Event), the event class is not specified because sub-Events must have the same class as their parent Event object.
Event lookupEvent([PCHeventClass.RPC || PCHeventClass.USER], String
eventName, [optional] boolean includeParent);
Event lookupEvent([PCHeventClass.RPC || PCHeventClass.USER], String
eventName, [optional] boolean includeParent);
Event lookupEvent(String eventName, [optional] boolean
includeParent);
PCHeventClass.RPC
and PCHeventClass.USER
. When using the Listener object or a Container
object to create an Event, the event class must be specified. When creating
an Event subordinate to another Event (sub-Event), the event class is not
specified because sub-Events must have the same class as their parent Event
object.Listener listener = new Listener("sampleApp", "4.0");
Event creations = listener.lookupEvent(PCHeventClass.RPC, "document creations");
Accumulator numCreations = creations.lookupAccumulator(Listener.DURATION);
...
- or -
Listener listener = new Listener("sampleApp", "4.0");
Container store = listener.lookupContainer("storeName");
Event creations = store.lookupEvent(PCHeventClass.RPC, "document creations",
false);
Event subCreations = creations.lookupEvent("document sub-creations");
Meter creationSize = creations.lookupMeter("creation size");
Accumulator numCreations = creations.lookupAccumulator(Listener.DURATION);
...