//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout=10000) public void shouldNotBlockIfSignalAvailable() public virtual void shouldNotBlockIfSignalAvailable() { SingleConsumerCondition condition = new SingleConsumerCondition(Thread.CurrentThread); // given condition.signal(); // then condition.await(100000); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void cannotAwaitFromDifferentThread() public virtual void cannotAwaitFromDifferentThread() { // given SingleConsumerCondition condition = new SingleConsumerCondition(new Thread()); // when then try { condition.await(0); Assert.fail("expected exception"); } catch (Exception) { // expected } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout=10000) public void shouldNotBlockIfSignalAvailableDifferentThread() throws InterruptedException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void shouldNotBlockIfSignalAvailableDifferentThread() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.util.SingleConsumerCondition condition = new org.camunda.bpm.engine.impl.util.SingleConsumerCondition(Thread.currentThread()); SingleConsumerCondition condition = new SingleConsumerCondition(Thread.CurrentThread); Thread consumer = new Thread(() => { condition.signal(); }); consumer.Start(); consumer.Join(); // then condition.await(100000); }
protected internal virtual void suspendAcquisition(long millis) { try { if (queue.Empty && isRunning) { LOG.log(Level.FINEST, "Suspend acquisition for {0}ms", millis); condition.await(millis); LOG.log(Level.FINEST, "Acquisition woke up"); } } finally { if (handlerThread.Interrupted) { Thread.CurrentThread.Interrupt(); } } }