Search in sources :

Example 1 with ExceptionSaverExceptionHandler

use of org.apache.apex.malhar.lib.appdata.ThreadUtils.ExceptionSaverExceptionHandler in project apex-malhar by apache.

the class SimpleDoneQueryQueueManagerTest method simpleExpireBlockThenUnblock.

@Test
public void simpleExpireBlockThenUnblock() throws Exception {
    SimpleDoneQueueManager<Query, Void> sdqqm = new SimpleDoneQueueManager<Query, Void>();
    sdqqm.setup(null);
    sdqqm.beginWindow(0);
    Query query = new MockQuery("1");
    MutableBoolean expire = new MutableBoolean(false);
    sdqqm.enqueue(query, null, expire);
    sdqqm.endWindow();
    sdqqm.beginWindow(1);
    // Expire
    expire.setValue(true);
    ExceptionSaverExceptionHandler eseh = new ExceptionSaverExceptionHandler();
    testBlockingNoStop(sdqqm, eseh);
    query = new MockQuery("2");
    sdqqm.enqueue(query, null, new MutableBoolean(false));
    Thread.sleep(1000);
    Assert.assertNull(eseh.getCaughtThrowable());
    sdqqm.endWindow();
    sdqqm.teardown();
}
Also used : ExceptionSaverExceptionHandler(org.apache.apex.malhar.lib.appdata.ThreadUtils.ExceptionSaverExceptionHandler) Query(org.apache.apex.malhar.lib.appdata.schemas.Query) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean) Test(org.junit.Test)

Aggregations

ExceptionSaverExceptionHandler (org.apache.apex.malhar.lib.appdata.ThreadUtils.ExceptionSaverExceptionHandler)1 Query (org.apache.apex.malhar.lib.appdata.schemas.Query)1 MutableBoolean (org.apache.commons.lang3.mutable.MutableBoolean)1 Test (org.junit.Test)1