/** * Reloads the {@link P6ModuleManager}. <br> * <br> * The idea is that whoever initiates this one causes it to start with the clean table. No * previously set values are kept (even those set manually - via jmx will be forgotten). */ public void reload() { initMe(); }
public SpyDotPropertiesReloader(SpyDotProperties spyDotProperties, P6ModuleManager p6ModuleManager) { this.spyDotProperties = spyDotProperties; final P6SpyLoadableOptions spyOptions = p6ModuleManager.getOptions(P6SpyOptions.class); reschedule(spyOptions.getReloadProperties(), spyOptions.getReloadPropertiesInterval()); p6ModuleManager.registerOptionChangedListener(this); }
private static void cleanUp() throws MBeanRegistrationException, InstanceNotFoundException, MalformedObjectNameException { if (instance == null) { return; } for (P6OptionsSource optionsSource : instance.optionsSources) { optionsSource.preDestroy(instance); } if (P6SpyOptions.getActiveInstance().getJmx() // // unregister mbeans (to prevent naming conflicts) && instance.mBeansRegistry != null) { instance.mBeansRegistry.unregisterAllMBeans(P6SpyOptions.getActiveInstance().getJmxPrefix()); } // clean table plz (we need to make sure that all the configured factories will be re-loaded) new DefaultJdbcEventListenerFactory().clearCache(); }
@Override public XAConnection getXAConnection() throws SQLException { if (this.jdbcEventListenerFactory == null) { this.jdbcEventListenerFactory = JdbcEventListenerFactoryLoader.load(); } return new P6XAConnection(castRealDS(XADataSource.class).getXAConnection(), this.jdbcEventListenerFactory); }
/** * Utility method, to make accessing options from app less verbose. * * @return active instance of the {@link P6LogLoadableOptions} */ public static P6LogLoadableOptions getActiveInstance() { return P6ModuleManager.getInstance().getOptions(P6LogOptions.class); }
public static JdbcEventListener getJdbcEventListener() { return JdbcEventListenerFactoryLoader.load().createJdbcEventListener(); }
private void destroyMBean(P6MBeansRegistry mBeansRegistry, final String jmxPrefix) throws Exception { // none to be reused registry if (null == mBeansRegistry) { mBeansRegistry = new P6MBeansRegistry(); } // unreg mBeansRegistry.unregisterAllMBeans(null); checkMBeanNotExposed(jmxPrefix); }
@After public void after() { // reset formatting setting P6SpyOptions.getActiveInstance().setCustomLogMessageFormat(null); }
{dbcp, dbcp.getClass()}, {dbcp2, dbcp2.getClass()}, {new P6DataSource(druidDataSource), druidDataSource.getClass()} });
protected void dropPrepared(Statement statement) { dropPreparedStatement("drop table prepstmt_test", statement); dropPreparedStatement("drop table prepstmt_test2", statement); dropPreparedStatement("drop table prepstmt_test3", statement); }
@Override public JdbcEventListener createJdbcEventListener() { return factory.createJdbcEventListener(); } }
protected void drop(Statement statement) { if (statement == null) { return; } dropStatement("drop table valid_sql_logged", statement); }
@Override public PooledConnection getPooledConnection(String user, String password) throws SQLException { if (this.jdbcEventListenerFactory == null) { this.jdbcEventListenerFactory = JdbcEventListenerFactoryLoader.load(); } return new P6XAConnection(castRealDS(ConnectionPoolDataSource.class).getPooledConnection(user, password), this.jdbcEventListenerFactory); }
/** * Utility method, to make accessing options from app less verbose. * * @return active instance of the {@link P6OutageLoadableOptions} */ public static P6OutageLoadableOptions getActiveInstance() { return P6ModuleManager.getInstance().getOptions(P6OutageOptions.class); }
@SuppressWarnings("resource") public static Connection wrapConnection(Connection realConnection, ConnectionInformation connectionInformation) { if (realConnection == null) { return null; } return ConnectionWrapper.wrap(realConnection, JdbcEventListenerFactoryLoader.load().createJdbcEventListener(), connectionInformation); }
@Override public PooledConnection getPooledConnection() throws SQLException { if (this.jdbcEventListenerFactory == null) { this.jdbcEventListenerFactory = JdbcEventListenerFactoryLoader.load(); } return new P6XAConnection(castRealDS(ConnectionPoolDataSource.class).getPooledConnection(), this.jdbcEventListenerFactory); }
/** * Utility method, to make accessing options from app less verbose. * * @return active instance of the {@link P6SpyLoadableOptions} */ public static P6SpyLoadableOptions getActiveInstance() { return P6ModuleManager.getInstance().getOptions(P6SpyOptions.class); }
@Override public XAConnection getXAConnection(String user, String password) throws SQLException { if (this.jdbcEventListenerFactory == null) { this.jdbcEventListenerFactory = JdbcEventListenerFactoryLoader.load(); } return new P6XAConnection(castRealDS(XADataSource.class).getXAConnection(user, password), this.jdbcEventListenerFactory); }
/** * Utility method, to make accessing options from app less verbose. * * @return active instance of the {@link P6TestLoadableOptions} */ public static P6TestLoadableOptions getActiveInstance() { return P6ModuleManager.getInstance().getOptions(P6TestOptions.class); }