/** * {@inheritDoc} * * <p>Initialize the service collector. * * <p>During initialization the JMX collector: - Initializes various configuration factories. - * Verifies access to the database - Verifies access to RRD file repository - Verifies access to * JNI RRD shared library - Determines if JMX to be stored for only the node's primary interface * or for all interfaces. * * @exception RuntimeException Thrown if an unrecoverable error occurs that prevents the plug-in * from functioning. */ @Override public void initialize(Map<String, String> parameters) { // Initialize the JMXDataCollectionConfigFactory try { // XXX was reload(), which isn't test-friendly JMXDataCollectionConfigFactory.init(); } catch (Throwable e) { LogUtils.errorf(this, e, "initialize: Failed to load data collection configuration"); throw new UndeclaredThrowableException(e); } // Make sure we can connect to the database java.sql.Connection ctest = null; try { DataSourceFactory.init(); ctest = DataSourceFactory.getInstance().getConnection(); } catch (final Exception e) { LogUtils.errorf(this, e, "initialize: failed to get a database connection"); throw new UndeclaredThrowableException(e); } finally { if (ctest != null) { try { ctest.close(); } catch (final Throwable t) { LogUtils.debugf( this, "initialize: an exception occured while closing the JDBC connection"); } } } // Save local reference to singleton instance LogUtils.debugf(this, "initialize: successfully instantiated JNI interface to RRD."); }