public static final IMonitoringRecord createFromArray(final String recordClassName, final Object[] values) throws MonitoringRecordException { final Class<? extends IMonitoringRecord> clazz = AbstractMonitoringRecord.classForName(recordClassName); return AbstractMonitoringRecord.createFromArray(clazz, values); }
public static final IMonitoringRecord createFromDeserializer(final String recordClassName, final IValueDeserializer deserializer) throws BufferUnderflowException, MonitoringRecordException { return AbstractMonitoringRecord.createFromDeserializerChw(recordClassName, deserializer); }
@Override protected long getRecordSpecificTimestamp(final IMonitoringRecord record) { return record.getLoggingTimestamp(); }
/** * Provides an ordering of IMonitoringRecords by the loggingTimestamp. * Classes overriding the implementation should respect this ordering. (see #326) * * @param otherRecord * The record to be compared. * * @return -1 if this object is less than, +1 if it is greater than or 0 if it is equal to the specified record. */ @Override public int compareTo(final IMonitoringRecord otherRecord) { final long timedifference = this.loggingTimestamp - otherRecord.getLoggingTimestamp(); if (timedifference < 0L) { return -1; } else if (timedifference > 0L) { return 1; } else { // same timing // this should work except for rare hash collisions return this.hashCode() - otherRecord.hashCode(); } }
/** * This constructor converts the given array into a record. * It is recommended to use the array which is the result of a call to {@link #toArray()}. * * @param values * The values for the record. * * @deprecated since 1.13. Use {@link #EmptyRecord(IValueDeserializer)} instead. */ @Deprecated public EmptyRecord(final Object[] values) { // NOPMD (direct store of values) AbstractMonitoringRecord.checkArray(values, TYPES); }
/** * This constructor converts the given array into a record. It is recommended to use the array which is the result of a call to {@link #toArray()}. * * @param values * The values for the record. */ public RegistryRecord(final Object[] values) { // NOPMD (direct store of E (usually String)) AbstractMonitoringRecord.checkArray(values, TYPES); this.id = (Integer) values[0]; this.string = (String) (values[1]); this.strBytes = RegistryRecord.stringToBytes(this.string); }
@Override public int hashCode() { return Long.hashCode(this.getLoggingTimestamp()); }
@Override public final int hashCode() { return (31 * Arrays.hashCode(this.toArray())) + (int) (this.loggingTimestamp ^ (this.loggingTimestamp >>> 32)); }
@SuppressWarnings("deprecation") @Override public IMonitoringRecord create(final Object[] values) { try { return AbstractMonitoringRecord.createFromArray(this.recordClassName, values); } catch (final MonitoringRecordException e) { throw new RecordInstantiationException(e); } }
@Override public IMonitoringRecord create(final IValueDeserializer deserializer) { try { return AbstractMonitoringRecord.createFromDeserializer(this.recordClassName, deserializer); } catch (final MonitoringRecordException e) { throw new RecordInstantiationException(e); } }
/** * Provides an ordering of IMonitoringRecords by the loggingTimestamp. * Classes overriding the implementation should respect this ordering. (see #326) * * @param otherRecord * The record to be compared. * * @return -1 if this object is less than, +1 if it is greater than or 0 if it is equal to the specified record. */ @Override public int compareTo(final IMonitoringRecord otherRecord) { final long timedifference = this.loggingTimestamp - otherRecord.getLoggingTimestamp(); if (timedifference < 0L) { return -1; } else if (timedifference > 0L) { return 1; } else { // same timing // this should work except for rare hash collisions return this.hashCode() - otherRecord.hashCode(); } }
/** * This constructor converts the given array into a record. * It is recommended to use the array which is the result of a call to {@link #toArray()}. * * @param values * The values for the record. * * @deprecated since 1.13. Use {@link #TimestampRecord(IValueDeserializer)} instead. */ @Deprecated public TimestampRecord(final Object[] values) { // NOPMD (direct store of values) AbstractMonitoringRecord.checkArray(values, TYPES); this.timestamp = (Long) values[0]; }
/** * This constructor converts the given array into a record. It is recommended to use the array which is the result of a call to {@link #toArray()}. * * @param values * The values for the record. */ @SuppressWarnings("unchecked") public RegistryRecord(final Object[] values) { // NOPMD (direct store of E (usually String)) AbstractMonitoringRecord.checkArray(values, TYPES); this.id = (Integer) values[0]; this.string = (String) (values[1]); this.strBytes = RegistryRecord.stringToBytes(this.string); }
/** * Create monitoring record based on class name and a given value deserializer. * * @param recordClassName * record class name * @param deserializer * the derserializer * @return a monitoring record * @throws BufferUnderflowException * on buffer read errors * @throws MonitoringRecordException * when no record could be constructed */ public static final IMonitoringRecord createFromDeserializer(final String recordClassName, final IValueDeserializer deserializer) throws BufferUnderflowException, MonitoringRecordException { return AbstractMonitoringRecord.createFromDeserializerChw(recordClassName, deserializer); }
/** * This constructor uses the given array to initialize the fields of this record. * * @param values * The values for the record. * @param valueTypes * The types of the elements in the first array. * * @deprecated since 1.13. Use {@link #EmptyRecord(IValueDeserializer)} instead. */ @Deprecated protected EmptyRecord(final Object[] values, final Class<?>[] valueTypes) { // NOPMD (values stored directly) AbstractMonitoringRecord.checkArray(values, valueTypes); }
/** * This constructor uses the given array to initialize the fields of this record. * * @param values * The values for the record. * @param valueTypes * The types of the elements in the first array. * * @deprecated since 1.13. Use {@link #AbstractEvent(IValueDeserializer)} instead. */ @Deprecated protected AbstractEvent(final Object[] values, final Class<?>[] valueTypes) { // NOPMD (values stored directly) AbstractMonitoringRecord.checkArray(values, valueTypes); this.timestamp = (Long) values[0]; }
/** * This constructor converts the given array into a record. * It is recommended to use the array which is the result of a call to {@link #toArray()}. * * @param values * The values for the record. * * @deprecated since 1.13. Use {@link #BranchingRecord(IValueDeserializer)} instead. */ @Deprecated public BranchingRecord(final Object[] values) { // NOPMD (direct store of values) AbstractMonitoringRecord.checkArray(values, TYPES); this.timestamp = (Long) values[0]; this.branchID = (Integer) values[1]; this.branchingOutcome = (Integer) values[2]; }
/** * This constructor uses the given array to initialize the fields of this record. * * @param values * The values for the record. * @param valueTypes * The types of the elements in the first array. * * @deprecated since 1.13. Use {@link #AggregationWindow(IValueDeserializer)} instead. */ @Deprecated protected AggregationWindow(final Object[] values, final Class<?>[] valueTypes) { // NOPMD (values stored directly) AbstractMonitoringRecord.checkArray(values, valueTypes); this.windowStart = (Long) values[0]; this.windowEnd = (Long) values[1]; }
/** * This constructor converts the given array into a record. * It is recommended to use the array which is the result of a call to {@link #toArray()}. * * @param values * The values for the record. * * @deprecated since 1.13. Use {@link #NamedDoubleRecord(IValueDeserializer)} instead. */ @Deprecated public NamedDoubleRecord(final Object[] values) { // NOPMD (direct store of values) AbstractMonitoringRecord.checkArray(values, TYPES); this.applicationName = (String) values[0]; this.timestamp = (Long) values[1]; this.responseTime = (Double) values[2]; }
/** * This constructor converts the given array into a record. * It is recommended to use the array which is the result of a call to {@link #toArray()}. * * @param values * The values for the record. * * @deprecated since 1.13. Use {@link #NamedTSPoint(IValueDeserializer)} instead. */ @Deprecated public NamedTSPoint(final Object[] values) { // NOPMD (direct store of values) AbstractMonitoringRecord.checkArray(values, TYPES); this.timestamp = (Long) values[0]; this.value = (Double) values[1]; this.name = (String) values[2]; }