Search in sources :

Example 1 with DatabasePanicEventGenerator

use of org.neo4j.kernel.impl.core.DatabasePanicEventGenerator in project neo4j by neo4j.

the class DatabaseHealthTest method shouldGenerateKernelPanicEvents.

@Test
public void shouldGenerateKernelPanicEvents() throws Exception {
    // GIVEN
    DatabasePanicEventGenerator generator = mock(DatabasePanicEventGenerator.class);
    DatabaseHealth databaseHealth = new DatabaseHealth(generator, NullLogProvider.getInstance().getLog(DatabaseHealth.class));
    databaseHealth.healed();
    // WHEN
    Exception cause = new Exception("My own fault");
    databaseHealth.panic(cause);
    databaseHealth.panic(cause);
    // THEN
    verify(generator, times(1)).generateEvent(TX_MANAGER_NOT_OK, cause);
}
Also used : DatabasePanicEventGenerator(org.neo4j.kernel.impl.core.DatabasePanicEventGenerator) Test(org.junit.Test)

Example 2 with DatabasePanicEventGenerator

use of org.neo4j.kernel.impl.core.DatabasePanicEventGenerator in project neo4j by neo4j.

the class Runner method createBatchingTransactionAppender.

private BatchingTransactionAppender createBatchingTransactionAppender(TransactionIdStore transactionIdStore, TransactionMetadataCache transactionMetadataCache, LogFile logFile) {
    Log log = NullLog.getInstance();
    KernelEventHandlers kernelEventHandlers = new KernelEventHandlers(log);
    DatabasePanicEventGenerator panicEventGenerator = new DatabasePanicEventGenerator(kernelEventHandlers);
    DatabaseHealth databaseHealth = new DatabaseHealth(panicEventGenerator, log);
    LogRotationImpl logRotation = new LogRotationImpl(NOOP_LOGROTATION_MONITOR, logFile, databaseHealth);
    return new BatchingTransactionAppender(logFile, logRotation, transactionMetadataCache, transactionIdStore, IdOrderingQueue.BYPASS, databaseHealth);
}
Also used : DatabaseHealth(org.neo4j.kernel.internal.DatabaseHealth) KernelEventHandlers(org.neo4j.kernel.internal.KernelEventHandlers) Log(org.neo4j.logging.Log) NullLog(org.neo4j.logging.NullLog) BatchingTransactionAppender(org.neo4j.kernel.impl.transaction.log.BatchingTransactionAppender) DatabasePanicEventGenerator(org.neo4j.kernel.impl.core.DatabasePanicEventGenerator) LogRotationImpl(org.neo4j.kernel.impl.transaction.log.rotation.LogRotationImpl)

Aggregations

DatabasePanicEventGenerator (org.neo4j.kernel.impl.core.DatabasePanicEventGenerator)2 Test (org.junit.Test)1 BatchingTransactionAppender (org.neo4j.kernel.impl.transaction.log.BatchingTransactionAppender)1 LogRotationImpl (org.neo4j.kernel.impl.transaction.log.rotation.LogRotationImpl)1 DatabaseHealth (org.neo4j.kernel.internal.DatabaseHealth)1 KernelEventHandlers (org.neo4j.kernel.internal.KernelEventHandlers)1 Log (org.neo4j.logging.Log)1 NullLog (org.neo4j.logging.NullLog)1