private static RrdBackendFactory checkFactory(URI uri, RrdBackendFactory factory) { if (factory == null) { return RrdBackendFactory.findFactory(uri); } else { return factory; } }
/** * <p>Requests a RrdDb reference for the given RRD file path.</p> * <ul> * <li>If the file is already open, previously returned RrdDb reference will be returned. Its usage count * will be incremented by one. * <li>If the file is not already open and the number of already open RRD files is less than * {@link #INITIAL_CAPACITY}, the file will be open and a new 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 uri {@link URI} to existing RRD file * @return reference for the give 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(URI uri) throws IOException { RrdBackendFactory factory = RrdBackendFactory.findFactory(uri); return requestRrdDb(uri, factory); }
/** * <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())); }