public void awaitStartup() { startupLatch.await(); }
public void awaitTermination() { shutdownLatch.await(); }
/** * Halts this flusher, making it stop flushing. The current call to {@link PageCache#flushAndForce()} * will complete before exiting this method call. If there was an error in the thread doing the flushes * that exception will be thrown from this method as a {@link RuntimeException}. */ void halt() { halted = true; halt.await(); if ( error != null ) { throwIfUnchecked( error ); throw new RuntimeException( error ); } } }
@Override public void waitTermination() throws ExecutionException, InterruptedException { handleRelease.await(); JobHandle handleDelegate = this.latestHandle; if ( handleDelegate != null ) { handleDelegate.waitTermination(); } if ( get() == FAILED ) { Throwable exception = this.lastException; if ( exception != null ) { throw new ExecutionException( exception ); } else { throw new CancellationException(); } } }
public void awaitUpdateApplication() { BinaryLatch updateLatch = new BinaryLatch(); scheduler.schedule( Group.INDEX_UPDATING, updateLatch::release ); updateLatch.await(); } }
public void lock( int recordId ) { Integer record = recordId; BinaryLatch myLatch = new BinaryLatch(); for (;;) { BinaryLatch existingLatch = map.putIfAbsent( record, myLatch ); if ( existingLatch == null ) { break; } else { existingLatch.await(); } } }
@Override public void apply( Adder adder ) { super.apply( adder ); startLatch.release(); blockLatch.await(); } } ) );
@Test( timeout = 10_000 ) public void scheduledTasksThatThrowsShouldStop() throws Exception { CentralJobScheduler scheduler = new CentralJobScheduler(); scheduler.init(); BinaryLatch triggerLatch = new BinaryLatch(); RuntimeException boom = new RuntimeException( "boom" ); AtomicInteger triggerCounter = new AtomicInteger(); Runnable job = () -> { triggerCounter.incrementAndGet(); triggerLatch.release(); throw boom; }; scheduler.scheduleRecurring( Group.INDEX_POPULATION, job, 1, TimeUnit.MILLISECONDS ); triggerLatch.await(); Thread.sleep( 50 ); assertThat( triggerCounter.get(), is( 1 ) ); }
@Test void releaseThenAwaitDoesNotBlock() { assertTimeout( ofSeconds( 3 ), () -> { BinaryLatch latch = new BinaryLatch(); latch.release(); latch.await(); } ); }
blockLatch.await(); };
while ( (latch = latchRef.get()) != null ) latch.await();
startLatch.await(); Collection<FutureTask<Void>> tasks = new ArrayList<>(); tasks.add( blocker );
tx.acquireReadLock( node ); nodeLockAcquired.set( true ); lockerPause.await();
latch.await(); machine.process( new RunMessage( "MATCH (n:A) SET n.prop = 'two'", EMPTY_MAP ), nullResponseHandler() ); machine.process( PullAllMessage.INSTANCE, nullResponseHandler() );