public static void RegisterAndSetAsDefaultFactory(RrdBackendFactory factory) { RegisterFactory(factory); SetDefaultFactory(factory.FactoryName); }
/// <summary> /// Replaces the default backend factory with a new one. This method must be called before /// the first RRD gets created. /// </summary> /// <param name="factoryName"> /// Name of the default factory. Out of the box, JRobin supports four /// different RRD backends: "FILE" (java.io.* based), "SAFE" (java.io.* based - use this /// backend if RRD files may be accessed from several JVMs at the same time), /// "NIO" (java.nio.* based) and "MEMORY" (byte[] based). /// </param> public static void SetDefaultFactory(String factoryName) { // We will allow this only if no RRDs are created if (!RrdBackend.InstanceCreated()) { defaultFactory = GetFactory(factoryName); } else { throw new RrdException( "Could not change the default backend factory. This method must be called before the first RRD gets created"); } }
public static void RegisterFactory(RrdBackendFactory factory) { String name = factory.FactoryName; if (!factories.ContainsKey(name)) { factories.Add(name, factory); } else { throw new RrdException("Backend factory of this name2 (" + name + ") already exists and cannot be registered"); } }