Package net.jodah.concurrentunit

Examples of net.jodah.concurrentunit.Waiter.await()


    // Call initial shutdown listener
    callShutdownListener(initialResource,
        initialResource instanceof ConnectionHandler ? connectionShutdownSignal()
            : channelShutdownSignal());
    if (expectedResumes > 0)
      waiter.await(1000);
    Thread.sleep(100);
  }

  /** Mock recovery for the resource, with recovery attempts failing because of {@code e}. */
  abstract void mockRecovery(Exception e, RetryableResource retryableResource) throws IOException;
View Full Code Here


          waiter.fail(t);
        }
      }
    });

    waiter.await(1000);
  }

  void performThrowableInvocation(ShutdownSignalException invocationFailure) throws Throwable {
    performThrowableInvocation(invocationFailure, null);
  }
View Full Code Here

        }
      }).start();

    Thread.sleep(100);
    iw.interruptWaiters();
    waiter.await(500);
  }

  public void shouldInterruptTimedWaiters() throws Throwable {
    final InterruptableWaiter iw = new InterruptableWaiter();
    final Waiter waiter = new Waiter();
View Full Code Here

        }
      }).start();

    Thread.sleep(100);
    iw.interruptWaiters();
    waiter.await(500);
  }

  public void timedWaiterShouldTimeoutQuietly() throws Throwable {
    final InterruptableWaiter iw = new InterruptableWaiter();
    iw.await(Duration.millis(100));
View Full Code Here

        }
      }).start();

      Thread.sleep(500);
      circuit.close();
      waiter.await(500);
    }
  }

  public void shouldHandleConcurrentWaiters() throws Throwable {
    circuit.open();
View Full Code Here

        }
      }).start();

    Thread.sleep(1000);
    circuit.close();
    waiter.await(500);
  }

  public void shouldInterruptWaiters() throws Throwable {
    circuit.open();
View Full Code Here

        }
      }).start();

    Thread.sleep(300);
    circuit.interruptWaiters();
    waiter.await(500);
  }

  public void shouldNotBlockOpenWhenSyncAcquired() throws Throwable {
    circuit.open();
View Full Code Here

    }).start();

    Thread.sleep(300);
    circuit.open();
    circuit.close();
    waiter.await(500);
  }
}
View Full Code Here

            waiter.fail(t);
          }
        }
      });

    waiter.await(2000);

    // Even though both threads will fail twice, only one thread will perform recovery
    verifyCxnCreations(1);
    verifyChannelCreations(1, 3);
    verifyChannelCreations(2, 1);
View Full Code Here

        waiter.assertNull(error);
        waiter.resume();
      });
    }

    waiter.await(10000, contexts.size());
  }

  /**
   * Starts a cluster of uniquely named CopyCat contexts.
   */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.