Package kieker.common.record
Class AbstractMonitoringRecord
java.lang.Object
kieker.common.record.AbstractMonitoringRecord
- All Implemented Interfaces:
Serializable,Comparable<IMonitoringRecord>,IMonitoringRecord
- Direct Known Subclasses:
AbstractEvent,AbstractJVMRecord,ActivationEvent,ActivationParameterEvent,AddParameterValueEvent,AfterDatabaseEvent,BeforeDatabaseEvent,BeforeReceivedRemoteEvent,BeforeSentRemoteEvent,BranchingRecord,CPUUtilizationRecord,DatabaseFailedEvent,DeactivationEvent,DiskUsageRecord,EmptyRecord,HostApplicationMetaData,KiekerMetadataRecord,LoadAverageRecord,MemSwapUsageRecord,NetworkUtilizationRecord,OperationCallEvent,OperationExecutionRecord,RegistryRecord,RemoveParameterValueEvent,ResourceUtilizationRecord,SessionEndEvent,SessionStartEvent,ThreadMetaData,TimestampRecord,TraceMetadata,UpdateParameterEvent
- Since:
- 1.2
- Author:
- Andre van Hoorn, Jan Waller, Nils Christian Ehmke
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final voidcheckArray(Object[] values, Class<?>[] valueTypes) This method checks the given arrays, making sure that they have the same length and that the value elements are compatible with the given value types.static final Class<? extends IMonitoringRecord>classForName(String classname) This method tries to find a monitoring record class with the given name.intcompareTo(IMonitoringRecord otherRecord) Provides an ordering of IMonitoringRecords by the loggingTimestamp.static final IMonitoringRecordcreateFromDeserializer(String recordClassName, IValueDeserializer deserializer) Create monitoring record based on class name and a given value deserializer.booleanPerforms a null-check, a this-check, and a class-check.static final Object[]fromStringArrayToTypedArray2(String[] recordFields, Class<?>[] valueTypes) This helper method converts the given array with string objects into an array containing objects from the specified type.final longDelivers the current timestamp of the record.inthashCode()protected static booleanisNotEqual(double x, double y) Checks whether two double values are equal or not.protected static booleanisNotEqual(float x, float y) Checks whether two float values are equal or not.final voidsetLoggingTimestamp(long timestamp) Sets the logging timestamp to a new value.static final Class<?>[]typesForClass(Class<? extends IMonitoringRecord> clazz) This method delivers the types array of the given class, either by finding the declared field (in case of a factory record) or via thegetValueTypesmethod.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface kieker.common.record.IMonitoringRecord
getSize, getValueNames, getValueTypes, serialize, toString
-
Field Details
-
TYPE_SIZE_INT
public static final int TYPE_SIZE_INT- See Also:
-
TYPE_SIZE_LONG
public static final int TYPE_SIZE_LONG- See Also:
-
TYPE_SIZE_FLOAT
public static final int TYPE_SIZE_FLOAT- See Also:
-
TYPE_SIZE_DOUBLE
public static final int TYPE_SIZE_DOUBLE- See Also:
-
TYPE_SIZE_SHORT
public static final int TYPE_SIZE_SHORT- See Also:
-
TYPE_SIZE_BYTE
public static final int TYPE_SIZE_BYTE- See Also:
-
TYPE_SIZE_CHARACTER
public static final int TYPE_SIZE_CHARACTER- See Also:
-
TYPE_SIZE_STRING
public static final int TYPE_SIZE_STRING- See Also:
-
TYPE_SIZE_BOOLEAN
public static final int TYPE_SIZE_BOOLEAN- See Also:
-
-
Constructor Details
-
AbstractMonitoringRecord
public AbstractMonitoringRecord()
-
-
Method Details
-
isNotEqual
protected static boolean isNotEqual(double x, double y) Checks whether two double values are equal or not.- Parameters:
x- first valuey- second values- Returns:
- returns true if the values differ
-
isNotEqual
protected static boolean isNotEqual(float x, float y) Checks whether two float values are equal or not.- Parameters:
x- first valuey- second values- Returns:
- returns true if the values differ
-
getLoggingTimestamp
public final long getLoggingTimestamp()Description copied from interface:IMonitoringRecordDelivers the current timestamp of the record.- Specified by:
getLoggingTimestampin interfaceIMonitoringRecord- Returns:
- The timestamp.
-
setLoggingTimestamp
public final void setLoggingTimestamp(long timestamp) Description copied from interface:IMonitoringRecordSets the logging timestamp to a new value.- Specified by:
setLoggingTimestampin interfaceIMonitoringRecord- Parameters:
timestamp- The new timestamp for the record.
-
compareTo
Provides an ordering of IMonitoringRecords by the loggingTimestamp. Classes overriding the implementation should respect this ordering. (see #326)- Specified by:
compareToin interfaceComparable<IMonitoringRecord>- Parameters:
otherRecord- The record to be compared.- Returns:
- -1 if this object is less than, +1 if it is greater than or 0 if it is equal to the specified record.
-
equals
Performs a null-check, a this-check, and a class-check. Moreover, it checks each attribute for equality.
-
hashCode
public int hashCode() -
checkArray
This method checks the given arrays, making sure that they have the same length and that the value elements are compatible with the given value types. If the arrays are not compatible, this method throws anIllegalArgumentException.- Parameters:
values- The values.valueTypes- The value types.
-
fromStringArrayToTypedArray2
public static final Object[] fromStringArrayToTypedArray2(String[] recordFields, Class<?>[] valueTypes) throws IllegalArgumentException This helper method converts the given array with string objects into an array containing objects from the specified type. (e.g. via thevalueOfmethods).- Parameters:
recordFields- The array containing the string objects.valueTypes- The array containing the types the new array will have.- Returns:
- An array of objects, converted from the given string array.
- Throws:
IllegalArgumentException- If one or more of the given types are not supported.
-
classForName
public static final Class<? extends IMonitoringRecord> classForName(String classname) throws MonitoringRecordException This method tries to find a monitoring record class with the given name.- Parameters:
classname- The name of the class.- Returns:
- A
Classinstance corresponding to the given name, if it exists. - Throws:
MonitoringRecordException- If either a class with the given name could not be found or if the class doesn't implementIMonitoringRecord.
-
typesForClass
public static final Class<?>[] typesForClass(Class<? extends IMonitoringRecord> clazz) throws MonitoringRecordException This method delivers the types array of the given class, either by finding the declared field (in case of a factory record) or via thegetValueTypesmethod.- Parameters:
clazz- The record class.- Returns:
- The value types of the specified record.
- Throws:
MonitoringRecordException- If this method failed to access the value types.InvocationTargetException
-
createFromDeserializer
public static final IMonitoringRecord createFromDeserializer(String recordClassName, IValueDeserializer deserializer) throws BufferUnderflowException, MonitoringRecordException Create monitoring record based on class name and a given value deserializer.- Parameters:
recordClassName- record class namedeserializer- the derserializer- Returns:
- a monitoring record
- Throws:
BufferUnderflowException- on buffer read errorsMonitoringRecordException- when no record could be constructed
-