//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void asyncWorkThatThrowsMustRememberException() internal virtual void AsyncWorkThatThrowsMustRememberException() { Exception boo = new Exception("boo"); AsyncApply asyncApply = _sync.applyAsync(new AddWorkAnonymousInnerClass2(this, boo)); try { asyncApply.Await(); fail("Should have thrown"); } catch (ExecutionException e) { assertThat(e.InnerException, sameInstance(boo)); } assertThat(_sum.sum(), @is(10L)); assertThat(_count.sum(), @is(1L)); try { asyncApply.Await(); fail("Should have thrown"); } catch (ExecutionException e) { assertThat(e.InnerException, sameInstance(boo)); } assertThat(_sum.sum(), @is(10L)); assertThat(_count.sum(), @is(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") private org.neo4j.util.concurrent.AsyncApply sendDownstream(long ticket, Object batch, org.neo4j.util.concurrent.AsyncApply downstreamAsync) private AsyncApply SendDownstream(long ticket, object batch, AsyncApply downstreamAsync) { if (Guarantees(Step_Fields.ORDER_SEND_DOWNSTREAM)) { AsyncApply async = DownstreamWorkSync.applyAsync(new SendDownstream(ticket, batch, DownstreamIdleTime)); if (downstreamAsync != null) { try { downstreamAsync.Await(); async.Await(); return(null); } catch (ExecutionException e) { IssuePanic(e.InnerException); } } else { return(async); } } else { DownstreamIdleTime.add(DownstreamConflict.receive(ticket, batch)); DoneBatches.incrementAndGet(); } return(null); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void mustApplyWorkAsync() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void MustApplyWorkAsync() { AsyncApply a = _sync.applyAsync(new AddWork(10)); a.Await(); assertThat(_sum.sum(), @is(10L)); AsyncApply b = _sync.applyAsync(new AddWork(20)); AsyncApply c = _sync.applyAsync(new AddWork(30)); b.Await(); c.Await(); assertThat(_sum.sum(), @is(60L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void asyncWorkThatThrowsInAwaitMustRememberException() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void AsyncWorkThatThrowsInAwaitMustRememberException() { Future <Void> stuckAtSemaphore = MakeWorkStuckAtSemaphore(1); Exception boo = new Exception("boo"); AsyncApply asyncApply = _sync.applyAsync(new AddWorkAnonymousInnerClass3(this, boo)); RefillSemaphore(); stuckAtSemaphore.get(); try { asyncApply.Await(); fail("Should have thrown"); } catch (ExecutionException e) { assertThat(e.InnerException, sameInstance(boo)); } assertThat(_sum.sum(), @is(11L)); assertThat(_count.sum(), @is(2L)); try { asyncApply.Await(); fail("Should have thrown"); } catch (ExecutionException e) { assertThat(e.InnerException, sameInstance(boo)); } assertThat(_sum.sum(), @is(11L)); assertThat(_count.sum(), @is(2L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void mustCombineWorkAsync() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void MustCombineWorkAsync() { MakeWorkStuckAtSemaphore(1); AsyncApply a = _sync.applyAsync(new AddWork(1)); AsyncApply b = _sync.applyAsync(new AddWork(1)); AsyncApply c = _sync.applyAsync(new AddWork(1)); _semaphore.release(2); a.Await(); b.Await(); c.Await(); assertThat(_sum.sum(), @is(4L)); assertThat(_count.sum(), @is(2L)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void applyPendingLabelAndIndexUpdates() throws java.io.IOException private void ApplyPendingLabelAndIndexUpdates() { AsyncApply labelUpdatesApply = null; if (_labelUpdates != null) { // Updates are sorted according to node id here, an artifact of node commands being sorted // by node id when extracting from TransactionRecordState. labelUpdatesApply = _labelScanStoreSync.applyAsync(new LabelUpdateWork(_labelUpdates)); _labelUpdates = null; } if (_indexUpdates != null && _indexUpdates.hasUpdates()) { try { _indexUpdatesSync.apply(new IndexUpdatesWork(_indexUpdates)); } catch (ExecutionException e) { throw new IOException("Failed to flush index updates", e); } _indexUpdates = null; } if (labelUpdatesApply != null) { try { labelUpdatesApply.Await(); } catch (ExecutionException e) { throw new IOException("Failed to flush label updates", e); } } }