Search in sources :

Example 6 with TearDown

use of org.openjdk.jmh.annotations.TearDown in project logging-log4j2 by apache.

the class JpaAppenderBenchmark method tearDown.

@TearDown
public void tearDown() throws SQLException {
    final LoggerContext context = LoggerContext.getContext(false);
    try {
        ((JpaAppender) context.getConfiguration().getAppender("H2Appender")).getManager().close();
        ((JpaAppender) context.getConfiguration().getAppender("HSQLDBAppender")).getManager().close();
    } finally {
        System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
        // context.reconfigure();
        // StatusLogger.getLogger().reset();
        Statement statement = null;
        try {
            statement = connectionHSQLDB.createStatement();
            statement.execute("SHUTDOWN");
        } catch (final SQLException ignore) {
        // ignore
        } finally {
            Closer.closeSilently(statement);
            Closer.closeSilently(connectionHSQLDB);
        }
        try {
            statement = connectionH2.createStatement();
            statement.execute("SHUTDOWN");
        } catch (final SQLException ignore) {
        // ignore
        } finally {
            Closer.closeSilently(statement);
            Closer.closeSilently(connectionH2);
        }
    }
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) LoggerContext(org.apache.logging.log4j.core.LoggerContext) TearDown(org.openjdk.jmh.annotations.TearDown)

Example 7 with TearDown

use of org.openjdk.jmh.annotations.TearDown in project logging-log4j2 by apache.

the class AsyncLoggersLocationBenchmark method down.

@TearDown(Level.Trial)
public void down() {
    ((LifeCycle) LogManager.getContext(false)).stop();
    new File("perftest.log").delete();
}
Also used : LifeCycle(org.apache.logging.log4j.core.LifeCycle) File(java.io.File) TearDown(org.openjdk.jmh.annotations.TearDown)

Example 8 with TearDown

use of org.openjdk.jmh.annotations.TearDown in project logging-log4j2 by apache.

the class JdbcAppenderBenchmark method tearDown.

@TearDown
public void tearDown() throws SQLException {
    final LoggerContext context = LoggerContext.getContext(false);
    try {
        ((JdbcAppender) context.getConfiguration().getAppender("H2Appender")).getManager().close();
        ((JdbcAppender) context.getConfiguration().getAppender("HSQLDBAppender")).getManager().close();
    } finally {
        System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
        // context.reconfigure();
        // StatusLogger.getLogger().reset();
        Statement statement = null;
        try {
            statement = connectionHSQLDB.createStatement();
            statement.execute("SHUTDOWN");
        } catch (final SQLException ignore) {
        // ignore
        } finally {
            Closer.closeSilently(statement);
            Closer.closeSilently(connectionHSQLDB);
        }
        try {
            statement = connectionH2.createStatement();
            statement.execute("SHUTDOWN");
        } catch (final SQLException ignore) {
        // ignore
        } finally {
            Closer.closeSilently(statement);
            Closer.closeSilently(connectionH2);
        }
    }
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) LoggerContext(org.apache.logging.log4j.core.LoggerContext) TearDown(org.openjdk.jmh.annotations.TearDown)

Example 9 with TearDown

use of org.openjdk.jmh.annotations.TearDown in project logging-log4j2 by apache.

the class AsyncAppenderLog4j2Benchmark method down.

@TearDown(Level.Trial)
public void down() {
    ((LifeCycle) LogManager.getContext(false)).stop();
    new File("perftest.log").delete();
}
Also used : LifeCycle(org.apache.logging.log4j.core.LifeCycle) File(java.io.File) TearDown(org.openjdk.jmh.annotations.TearDown)

Example 10 with TearDown

use of org.openjdk.jmh.annotations.TearDown in project logging-log4j2 by apache.

the class AsyncAppenderLogbackBenchmark method down.

@TearDown(Level.Trial)
public void down() {
    ((LifeCycle) LoggerFactory.getILoggerFactory()).stop();
    new File("perftest.log").delete();
}
Also used : LifeCycle(ch.qos.logback.core.spi.LifeCycle) File(java.io.File) TearDown(org.openjdk.jmh.annotations.TearDown)

Aggregations

TearDown (org.openjdk.jmh.annotations.TearDown)11 File (java.io.File)9 LifeCycle (org.apache.logging.log4j.core.LifeCycle)5 LifeCycle (ch.qos.logback.core.spi.LifeCycle)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2 LoggerContext (org.apache.logging.log4j.core.LoggerContext)2