Package org.rrd4j.core

Examples of org.rrd4j.core.Sample


          // happens right at this spot
          if(now - 1 > db.getLastUpdateTime()) {
            // only do it if there is not already a value
            double lastValue = db.getLastDatasourceValue(DATASOURCE_STATE);
            if(!Double.isNaN(lastValue)) {
              Sample sample = db.createSample();
                    sample.setTime(now - 1);
                    sample.setValue(DATASOURCE_STATE, lastValue);
                    sample.update();
                        logger.debug("Stored '{}' with state '{}' in rrd4j database", name, mapToState(lastValue, item.getName()));
            }
          }
        } catch (IOException e) {
          logger.debug("Error re-storing last value: {}", e.getMessage());
        }
      }
      try {
        Sample sample = db.createSample();
              sample.setTime(now);
             
              DecimalType state = (DecimalType) item.getStateAs(DecimalType.class);
              if (state!=null) {
                    double value = state.toBigDecimal().doubleValue();
                    sample.setValue(DATASOURCE_STATE, value);
                    sample.update();
                    logger.debug("Stored '{}' with state '{}' in rrd4j database", name, item.getState());
              }
      } catch (IllegalArgumentException e) {
        if(e.getMessage().contains("at least one second step is required")) {
View Full Code Here

TOP

Related Classes of org.rrd4j.core.Sample

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.