jgroup.util.log
Class Event

java.lang.Object
  extended by jgroup.util.log.Event
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Event>
Direct Known Subclasses:
ConnectionPatternEvent, DomainEvent, ExperimentEvent, ReplicaEvent, ViewEvent

public class Event
extends java.lang.Object
implements java.lang.Comparable<Event>, java.io.Serializable

A general event that can be logged. This class is designed to be subclassed, and it should be noted that subclassing requires that the subclass be serializable to be written to disk. Since this class does implement Serializable the subclasses do not need to do that.

Since:
Jgroup 3.0
Author:
Rune Vestvik, Hein Meling
See Also:
Serialized Form

Field Summary
protected  java.lang.String description
           
protected  java.net.InetAddress eventHost
           
protected  long time
           
protected  EventType type
           
 
Constructor Summary
Event()
          Super constructor for sub events with late initialization
Event(EventType type, java.lang.String description)
           
Event(long time, EventType type, java.lang.String description)
           
 
Method Summary
protected  java.lang.StringBuilder commonToString(boolean includeDescription)
           
 int compareTo(Event event)
          Allows the system to compare two events to determine which are first in some ordering; hence making it simple to sort the events.
 java.lang.String getDescription()
           
 java.net.InetAddress getHost()
           
 java.lang.String getHostname()
           
 long getTime()
           
 EventType getType()
           
 boolean isLastEvent()
          This method must be overriden by the event type which will be used to indicate that it is the last event.
 boolean isType(EventType theType)
          Returns true if the given type is the same as the type of this instance.
static void setRelativeTo(Event relativeEvent)
          Set the event whose time will be the used to compute relative time of consecutive events.
 void setTime(long time)
          Set the time value of this event; used to adjust the time for events that was logged on machines with incorrect clock.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

time

protected long time

type

protected EventType type

description

protected java.lang.String description

eventHost

protected java.net.InetAddress eventHost
Constructor Detail

Event

public Event()
Super constructor for sub events with late initialization


Event

public Event(EventType type,
             java.lang.String description)

Event

public Event(long time,
             EventType type,
             java.lang.String description)
Method Detail

getTime

public long getTime()
Returns:
Returns the occurrance time of this event

setTime

public void setTime(long time)
Set the time value of this event; used to adjust the time for events that was logged on machines with incorrect clock.

Parameters:
time - the occurrance time of this event

getType

public EventType getType()
Returns:
Returns the type of this event

getDescription

public java.lang.String getDescription()
Returns:
Returns the description of this event

getHostname

public java.lang.String getHostname()
Returns:
Returns the hostname.

getHost

public java.net.InetAddress getHost()
Returns:
Returns the host on which this event was generated.

isType

public boolean isType(EventType theType)
Returns true if the given type is the same as the type of this instance.


isLastEvent

public boolean isLastEvent()
This method must be overriden by the event type which will be used to indicate that it is the last event.

Returns:
Always returns false.

setRelativeTo

public static void setRelativeTo(Event relativeEvent)
Set the event whose time will be the used to compute relative time of consecutive events. Typically, the first event should be the relative event.

Parameters:
relativeEvent -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

commonToString

protected java.lang.StringBuilder commonToString(boolean includeDescription)

compareTo

public int compareTo(Event event)
Allows the system to compare two events to determine which are first in some ordering; hence making it simple to sort the events.

Specified by:
compareTo in interface java.lang.Comparable<Event>


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.