@Override public void start() { stopped = false; unblockNewTransactions(); }
@Test( timeout = TEST_TIMEOUT ) public void unblockNewTransactionsFromWrongThreadThrows() throws Throwable { KernelTransactions kernelTransactions = newKernelTransactions(); kernelTransactions.blockNewTransactions(); Future<KernelTransaction> txOpener = t2.execute( state -> kernelTransactions.newInstance( explicit, AnonymousContext.write(), 0L ) ); t2.get().waitUntilWaiting( location -> location.isAt( KernelTransactions.class, "newInstance" ) ); assertNotDone( txOpener ); Future<?> wrongUnblocker = unblockTxsInSeparateThread( kernelTransactions ); try { wrongUnblocker.get(); } catch ( Exception e ) { assertThat( e, instanceOf( ExecutionException.class ) ); assertThat( e.getCause(), instanceOf( IllegalStateException.class ) ); } assertNotDone( txOpener ); kernelTransactions.unblockNewTransactions(); assertNotNull( txOpener.get() ); }
@Test( timeout = TEST_TIMEOUT ) public void blockNewTransactions() throws Throwable { KernelTransactions kernelTransactions = newKernelTransactions(); kernelTransactions.blockNewTransactions(); Future<KernelTransaction> txOpener = t2.execute( state -> kernelTransactions.newInstance( explicit, AnonymousContext.write(), 0L ) ); t2.get().waitUntilWaiting( location -> location.isAt( KernelTransactions.class, "newInstance" ) ); assertNotDone( txOpener ); kernelTransactions.unblockNewTransactions(); assertNotNull( txOpener.get() ); }
@Override public void start() { stopped = false; unblockNewTransactions(); }
kernelTransactions.unblockNewTransactions();