@Override public Void call() throws ExecutionException { sync.apply( addWork ); return null; } }
indexUpdatesSync.apply( new IndexUpdatesWork( indexUpdates ) );
indexUpdatesSync.apply( new IndexUpdatesWork( indexUpdates ) );
@Override public void add( Collection<? extends IndexEntryUpdate<?>> updates ) throws IndexEntryConflictException { try { workSync.apply( new IndexUpdateWork( updates ) ); } catch ( ExecutionException e ) { Throwable cause = e.getCause(); if ( cause instanceof IOException ) { throw new UncheckedIOException( (IOException) cause ); } if ( cause instanceof IndexEntryConflictException ) { throw (IndexEntryConflictException) cause; } throw new RuntimeException( cause ); } }
@Override protected void done() { lastCallForEmittingOutstandingBatches( new Sender() ); if ( downstreamWorkSync != null ) { try { downstreamWorkSync.apply( new SendDownstream( -1, null, downstreamIdleTime ) ); } catch ( ExecutionException e ) { issuePanic( e.getCause() ); } } super.done(); }
@Test void mustApplyWorkEvenWhenInterrupted() throws Exception { Thread.currentThread().interrupt(); sync.apply( new AddWork( 10 ) ); assertThat( sum.sum(), is( 10L ) ); assertTrue( Thread.interrupted() ); }
sync.apply( new AddWork( 20 ) );
@Override public void add( Collection<? extends IndexEntryUpdate<?>> updates ) throws IndexEntryConflictException { try { workSync.apply( new IndexUpdateWork( updates ) ); } catch ( ExecutionException e ) { Throwable cause = e.getCause(); if ( cause instanceof IOException ) { throw new UncheckedIOException( (IOException) cause ); } if ( cause instanceof IndexEntryConflictException ) { throw (IndexEntryConflictException) cause; } throw new RuntimeException( cause ); } }
@Override protected void done() { lastCallForEmittingOutstandingBatches( new Sender() ); if ( downstreamWorkSync != null ) { try { downstreamWorkSync.apply( new SendDownstream( -1, null, downstreamIdleTime ) ); } catch ( ExecutionException e ) { issuePanic( e.getCause() ); } } super.done(); }