/** * <p>Requests a RrdDb reference for the given RRD file definition object.</p> * <ul> * <li>If the file with the path specified in the RrdDef object is already open, * the method blocks until the file is closed. * <li>If the file is not already open and the number of already open RRD files is less than * {@link #INITIAL_CAPACITY}, a new RRD file will be created and a its RrdDb reference will be returned. * If the file is not already open and the number of already open RRD files is equal to * {@link #INITIAL_CAPACITY}, the method blocks until some RRD file is closed. * </ul> * * @param rrdDef Definition of the RRD file to be created * @return Reference to the newly created RRD file * @throws java.io.IOException Thrown in case of I/O error * @deprecated Use the {@link org.rrd4j.core.RrdDb.Builder} instead. */ @Deprecated public RrdDb requestRrdDb(RrdDef rrdDef) throws IOException { return requestRrdDb(rrdDef, RrdBackendFactory.findFactory(rrdDef.getUri())); }
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); } } }
factory = checkFactory(rrdDef.getUri(), factory); if (usePool) { return resolvePool(pool).requestRrdDb(rrdDef, factory);
xml.writeTag("path", getPath()); } else { xml.writeTag("uri", getUri());