public RrdDb requestRrdDb(RrdDef rrdDef) throws IOException { RrdEntry ref = null; try { ref = getUnusedEntry(rrdDef.getPath()); ref.rrdDb = new RrdDb(rrdDef); ref.count.set(1); } catch (IOException e) { capacity.release(); throw e; } finally { ref.rlock.release(); } return ref.rrdDb; }
public synchronized RrdDb requestRrdDb(RrdDef rrdDef) throws IOException { String canonicalPath = Util.getCanonicalPath(rrdDef.getPath()); while (rrdMap.containsKey(canonicalPath) || rrdMap.size() >= capacity) { try { wait(); } catch (InterruptedException e) { throw new RuntimeException(e); } } RrdDb rrdDb = new RrdDb(rrdDef); rrdMap.put(canonicalPath, new RrdEntry(rrdDb)); return rrdDb; }
RrdDb requestRrdDb(RrdDef rrdDef, RrdBackendFactory backend) throws IOException { RrdEntry ref = null; try { URI uri = backend.getCanonicalUri(rrdDef.getUri()); ref = requestEmpty(uri); ref.rrdDb = RrdDb.getBuilder().setRrdDef(rrdDef).setBackendFactory(backend).setPool(this).build(); return ref.rrdDb; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException("request interrupted for new rrdDef " + rrdDef.getPath(), e); } catch (RuntimeException e) { passNext(ACTION.DROP, ref); ref = null; throw e; } finally { if (ref != null) { passNext(ACTION.SWAP, ref); } } }
String path = rrdDef.getPath(); backend = factory.open(path, false); try {
XmlWriter xml = new XmlWriter(out); xml.startTag("rrd_def"); xml.writeTag("path", getPath()); xml.writeTag("step", getStep()); xml.writeTag("start", getStartTime());
xml.startTag("rrd_def"); if (compatible) { xml.writeTag("path", getPath()); } else { xml.writeTag("uri", getUri());