Java Code Examples for net.openhft.chronicle.core.Jvm#resetExceptionHandlers()

The following examples show how to use net.openhft.chronicle.core.Jvm#resetExceptionHandlers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueueTestCommon.java    From Chronicle-Queue with Apache License 2.0 5 votes vote down vote up
public void checkExceptions() {
    // find any discarded resources.
    System.gc();
    Jvm.pause(10);

    for (Map.Entry<Predicate<ExceptionKey>, String> expectedException : expectedExceptions.entrySet()) {
        if (!exceptions.keySet().removeIf(expectedException.getKey()))
            Slf4jExceptionHandler.WARN.on(getClass(), "No error for " + expectedException.getValue());
    }
    if (Jvm.hasException(exceptions)) {
        Jvm.dumpException(exceptions);
        Jvm.resetExceptionHandlers();
        Assert.fail();
    }
}
 
Example 2
Source File: RollCycleMultiThreadStressTest.java    From Chronicle-Queue with Apache License 2.0 5 votes vote down vote up
@After
public void after() {
    threadDump.assertNoNewThreads();
    // warnings are often expected
    exceptionKeyIntegerMap.entrySet().removeIf(entry -> entry.getKey().level.equals(LogLevel.WARN));
    if (Jvm.hasException(exceptionKeyIntegerMap)) {
        Jvm.dumpException(exceptionKeyIntegerMap);
        fail();
    }
    Jvm.resetExceptionHandlers();
    AbstractReferenceCounted.assertReferencesReleased();
}
 
Example 3
Source File: ToEndTest.java    From Chronicle-Queue with Apache License 2.0 5 votes vote down vote up
@After
public void after() {
    threadDump.assertNoNewThreads();

    if (Jvm.hasException(exceptionKeyIntegerMap)) {
        Jvm.dumpException(exceptionKeyIntegerMap);
        fail();
    }
    Jvm.resetExceptionHandlers();
}