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); }
/** * 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); }
public static final IMonitoringRecord createFromDeserializer(final String recordClassName, final IValueDeserializer deserializer) throws BufferUnderflowException, MonitoringRecordException { return AbstractMonitoringRecord.createFromDeserializerChw(recordClassName, deserializer); }
/** * <p> * Performs a null-check, a this-check, and a class-check. Moreover, it checks each attribute for equality. * </p> * * {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (this == obj) { return true; } if (obj.getClass() != this.getClass()) { return false; } final AbstractMonitoringRecord castedRecord = (AbstractMonitoringRecord) obj; if (this.getLoggingTimestamp() != castedRecord.getLoggingTimestamp()) { return false; } return Arrays.equals(this.toArray(), castedRecord.toArray()); }
clazz = AbstractMonitoringRecord.classForName(classname); } catch (final MonitoringRecordException ex) { // NOPMD (ExceptionAsFlowControl); need this to distinguish error by skipValues = 2; record = AbstractMonitoringRecord.createFromStringArray(clazz, Arrays.copyOfRange(recordFields, skipValues, recordFields.length)); record.setLoggingTimestamp(loggingTimestamp); } else { // legacy record final String[] recordFieldsReduced = new String[recordFields.length - 1]; System.arraycopy(recordFields, 1, recordFieldsReduced, 0, recordFields.length - 1); record = AbstractMonitoringRecord.createFromStringArray(OperationExecutionRecord.class, recordFieldsReduced);
final Class<? extends IMonitoringRecord> clazz = AbstractMonitoringRecord.classForName(classname);
final Class<? extends IMonitoringRecord> clazz = AbstractMonitoringRecord.classForName(classname); final Class<?>[] typeArray = AbstractMonitoringRecord.typesForClass(clazz); final IMonitoringRecord record = AbstractMonitoringRecord.createFromArray(clazz, objectArray); record.setLoggingTimestamp(loggingTimestamp); if (!this.recordReceiver.newMonitoringRecord(record)) {
@Override public int hashCode() { return Long.hashCode(this.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(); } }
@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); } }
final Class<? extends IMonitoringRecord> clazz = AbstractMonitoringRecord.classForName(classname); final IMonitoringRecord record = AbstractMonitoringRecord.createFromStringArray(clazz, values); record.setLoggingTimestamp(timestamp); this.recordQueue.add(record);
final String classname = indexTable.getString(2); try { // NOCS (nested try) this.table2record(connection, tablename, AbstractMonitoringRecord.classForName(classname)); } catch (final MonitoringRecordException ex) {
final Class<? extends IMonitoringRecord> clazz = AbstractMonitoringRecord.classForName(classname); final Class<?>[] typeArray = AbstractMonitoringRecord.typesForClass(clazz); final IMonitoringRecord record = AbstractMonitoringRecord.createFromArray(clazz, objectArray); record.setLoggingTimestamp(loggingTimestamp); if (!this.recordReceiver.newMonitoringRecord(record)) {
/** * <p> * Performs a null-check, a this-check, and a class-check. Moreover, it checks each attribute for equality. * </p> * * {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (this == obj) { return true; } if (obj.getClass() != this.getClass()) { return false; } final AbstractMonitoringRecord castedRecord = (AbstractMonitoringRecord) obj; return this.getLoggingTimestamp() == castedRecord.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(); } }
recordValues[i] = records.getObject(i + 3); final IMonitoringRecord record = AbstractMonitoringRecord.createFromArray(clazz, recordValues); record.setLoggingTimestamp(records.getLong(2)); super.deliver(OUTPUT_PORT_NAME_RECORDS, record);
/** * 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]; }
clazz = AbstractMonitoringRecord.classForName(classname); } catch (final MonitoringRecordException ex) { // NOPMD (ExceptionAsFlowControl); need this to distinguish error by record = AbstractMonitoringRecord.createFromStringArray(clazz, Arrays.copyOfRange(recordFields, skipValues, recordFields.length)); record.setLoggingTimestamp(loggingTimestamp); } else { // legacy record final String[] recordFieldsReduced = new String[recordFields.length - 1]; System.arraycopy(recordFields, 1, recordFieldsReduced, 0, recordFields.length - 1); record = AbstractMonitoringRecord.createFromStringArray(OperationExecutionRecord.class, recordFieldsReduced);
final String classname = indexTable.getString(2); try { // NOCS (nested try) this.table2record(connection, tablename, AbstractMonitoringRecord.classForName(classname)); } catch (final MonitoringRecordException ex) {