/** * Returns an array of open file path. * * @return Array with canonical path to open RRD files held in the pool. */ public String[] getOpenFiles() { //Direct toarray from keySet can fail Set<String> files = new HashSet<>(); for (RrdEntry i: pool.values()) { files.add(i.rrdDb.getPath()); } return files.toArray(new String[files.size()]); }
public synchronized void release(RrdDb rrdDb) throws IOException { // null pointer should not kill the thread, just ignore it if (rrdDb == null) { return; } String canonicalPath = Util.getCanonicalPath(rrdDb.getPath()); if (!rrdMap.containsKey(canonicalPath)) { throw new IllegalStateException("Could not release [" + canonicalPath + "], the file was never requested"); } RrdEntry entry = rrdMap.get(canonicalPath); if (--entry.count <= 0) { // no longer used rrdMap.remove(canonicalPath); notifyAll(); entry.rrdDb.close(); } }
/** * Creates a new writer that stores * * @param aDb A writeable RRD DB. * @throws IllegalArgumentException If the rrd db definition does not contain all required * datasources */ public Rrd4jAggregationWriter(RrdDb aDb) { super(extractLastTimestamp(aDb), extractStep(aDb)); transactionsEnabled = validateDataSource(aDb, "transactions!"); minEnabled = validateDataSource(aDb, "min"); maxEnabled = validateDataSource(aDb, "max"); averageEnabled = validateDataSource(aDb, "average"); if (!(transactionsEnabled || minEnabled || maxEnabled || averageEnabled)) { throw new EtmException("Invalid datasource. " + "One of the datasources 'transactions', 'min', 'max' or 'average' should exist in " + aDb.getPath() + "."); } db = aDb; LOG.debug("Using Rrd4j destination " + aDb.getPath() + " starting at " + new Date(startInterval * 1000) + " with step " + increment + " seconds."); }
Def(String name, String dsName, FetchData fetchData) { this(name, fetchData.getRequest().getParentDb().getPath(), dsName, fetchData.getRequest().getConsolFun(), fetchData.getRequest().getParentDb().getRrdBackend().getFactory() ); this.fetchData = fetchData; }
writer.startTag("fetch_data"); writer.startTag("request"); writer.writeTag("file", request.getParentDb().getPath()); writer.writeComment(Util.getDate(request.getFetchStart())); writer.writeTag("start", request.getFetchStart());
writer.startTag("fetch_data"); writer.startTag("request"); writer.writeTag("file", request.getParentDb().getPath()); writer.writeComment(Util.getDate(request.getFetchStart())); writer.writeTag("start", request.getFetchStart());