|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.echarts.monitor.MachineMonitorEvent
public abstract class MachineMonitorEvent
Abstract superclass representing events to put into a Monitor. An event is timestamped and host-IP-stamped when it is created. In addition, an event maintains a property list with an arbitrary list of String key/value pairs. Property values may include line separators, tab characters etc. Supports efficient (remote) serialization via readRaw and writeRaw, and readExternal and writeExternal methods. Subclasses should include a zero argument constructor if readRaw or readExternal will be used.
Field Summary | |
---|---|
java.lang.String |
hostIpAddress
Holds the IP Address of the host on which this JVM is running. |
java.util.Properties |
properties
Properties associated with the event. |
long |
timestamp
All events are timestamped to indicate their creation times. |
Constructor Summary | |
---|---|
MachineMonitorEvent()
|
Method Summary | |
---|---|
java.lang.String |
getClassString()
Strip package name from class name. |
java.lang.String |
getHostAddress()
|
java.lang.String |
getPropertiesString()
|
java.lang.String[] |
getSortedKeys()
Acquires the keys from the properties object and returns them in a sorted array. |
void |
readExternal(java.io.ObjectInput in)
|
static MachineMonitorEvent |
readRaw(java.io.DataInput in,
byte[] inputBuffer)
|
java.lang.String |
replaceChar(java.lang.String source,
char target,
java.lang.String substitute)
Replaces all occurrences of a single character in a string with a substitute sub-string. |
java.lang.String |
toString()
Separate fields with tabs. |
void |
writeExternal(java.io.ObjectOutput out)
|
void |
writeRaw(java.io.DataOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.lang.String hostIpAddress
public java.util.Properties properties
public long timestamp
Constructor Detail |
---|
public MachineMonitorEvent()
Method Detail |
---|
public final java.lang.String getHostAddress()
public java.lang.String[] getSortedKeys()
public void writeRaw(java.io.DataOutput out) throws java.io.IOException
java.io.IOException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public static MachineMonitorEvent readRaw(java.io.DataInput in, byte[] inputBuffer) throws java.lang.Exception
java.lang.Exception
public void readExternal(java.io.ObjectInput in) throws java.io.IOException
readExternal
in interface java.io.Externalizable
java.io.IOException
public java.lang.String toString()
formattedTimestamp "\t" timestamp "\t" IPaddressOfEventCreatorHost "\t" eventClassName "\t" propName1={value1} "\t" propName2={value2} "\t" ...
Property values are formatted by replacing the certain characters with substrings as follows:
-------------------------- Character Substitution -------------------------- '\n''\r' '\t' '{' '}' --------------------------
Newlines (or '\r\n' pairs) must be replaced because the log entry must be contained within a single record in the file. Tabs are field separators, hence, embedded tab characters must be substituted. Curly braces are used to denote the start and end of a property value, and therefore they must be substituted if they should occur with a property value.
Most property values will not need any reformatting, and for those that do, it will be most likely just '\n' or '\r\n'.
Should the IP Address of the host that created the event not be available, then the placeholder string, "<host unknown>" will appear instead.
toString
in class java.lang.Object
public java.lang.String getPropertiesString()
public java.lang.String replaceChar(java.lang.String source, char target, java.lang.String substitute)
source
- The string on which the substitutions are to be made.target
- The character to be substituted.substitute
- The string to replace all instances of target.
public java.lang.String getClassString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |