Top Description Inners Fields Constructors Methods
org.glassfish.pfl.tf.timer.spi

public Class TimerEvent

extends Object
Class Inheritance

Represents a particular observable event. We are mostly interested in measuring how long an operation takes. An operation is typically represented by a Timer, and then the timer is used to generate a TimerEvent at the entry to and exit from the operation.

Note that this class can also be used as a base class, in case there is a need to attach extra information to a TimerEvent.

All access to this class is unsynchronized. This class must be used either as an immutable (no calls to update), or access must be restricted to a single thread (as in an iterator).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private TimerEvent.TimerEventType
private long
private Timer

Constructor Summary

AccessConstructor and Description
public
public
TimerEvent(Timer timer, TimerEvent.TimerEventType etype)

Create a TimerEvent at the current time.

public
TimerEvent(Timer timer, TimerEvent.TimerEventType etype, long time)

Create a TimerEvent at the given time.

Method Summary

Modifier and TypeMethod and Description
public void
incrementTime(long update)

private void
public long
time()

Time of event in nanoseconds since the TimerLog was created or cleared.

public Timer
timer()

The name of the Timer used to create this entry.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public TimerEvent.TimerEventType
type()

Type of event: ENTER for start of interval for a Timer, EXIT for end of the interval.

public void
update(Timer timer, TimerEvent.TimerEventType etype, long time)

Re-use the same TimerEvent instance with different data.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

etypeback to summary
private TimerEvent.TimerEventType etype
timeback to summary
private long time
timerback to summary
private Timer timer

Constructor Detail

TimerEventback to summary
public TimerEvent(TimerEvent te)
TimerEventback to summary
public TimerEvent(Timer timer, TimerEvent.TimerEventType etype)

Create a TimerEvent at the current time.

TimerEventback to summary
public TimerEvent(Timer timer, TimerEvent.TimerEventType etype, long time)

Create a TimerEvent at the given time.

Method Detail

incrementTimeback to summary
public void incrementTime(long update)
internalSetDataback to summary
private void internalSetData(Timer timer, TimerEvent.TimerEventType etype, long time)
timeback to summary
public long time()

Time of event in nanoseconds since the TimerLog was created or cleared.

timerback to summary
public Timer timer()

The name of the Timer used to create this entry.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

typeback to summary
public TimerEvent.TimerEventType type()

Type of event: ENTER for start of interval for a Timer, EXIT for end of the interval.

updateback to summary
public void update(Timer timer, TimerEvent.TimerEventType etype, long time)

Re-use the same TimerEvent instance with different data. Used to create flyweight instances for iteration over a collection of TimerEvent instances.

org.glassfish.pfl.tf.timer.spi back to summary

public final Enum TimerEvent.TimerEventType

extends Enum<TimerEvent.TimerEventType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final TimerEvent.TimerEventType
public static final TimerEvent.TimerEventType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TimerEvent.TimerEventType
public static TimerEvent.TimerEventType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ENTERback to summary
public static final TimerEvent.TimerEventType ENTER
EXITback to summary
public static final TimerEvent.TimerEventType EXIT

Constructor Detail

TimerEventTypeback to summary
private TimerEventType()

Method Detail

valueOfback to summary
public static TimerEvent.TimerEventType valueOf(String name)
valuesback to summary
public static TimerEvent.TimerEventType[] values()