Exemplo n.º 1
0
  private static void testSyncIncrement() {
    count = 0;

    ExecutorService executor = Executors.newFixedThreadPool(2);

    IntStream.range(0, NUM_INCREMENTS).forEach(i -> executor.submit(Synchronized2::incrementSync));

    ConcurrentUtils.stop(executor);

    System.out.println(count);
  }
 /**
  * Creates a new instance of {@code ConcurrentRuntimeException} and initializes it with the given
  * message and cause.
  *
  * @param msg the error message
  * @param cause the cause of this exception
  * @throws IllegalArgumentException if the cause is not a checked exception
  */
 public ConcurrentRuntimeException(String msg, Throwable cause) {
   super(msg, ConcurrentUtils.checkedException(cause));
 }
 /**
  * Creates a new instance of {@code ConcurrentRuntimeException} and initializes it with the given
  * cause.
  *
  * @param cause the cause of this exception
  * @throws IllegalArgumentException if the cause is not a checked exception
  */
 public ConcurrentRuntimeException(Throwable cause) {
   super(ConcurrentUtils.checkedException(cause));
 }
Exemplo n.º 4
0
 /**
  * Creates a new instance of {@code ConcurrentException} and initializes it with the given message
  * and cause.
  *
  * @param msg the error message
  * @param cause the cause of this exception
  * @throws IllegalArgumentException if the cause is not a checked exception
  */
 public ConcurrentException(final String msg, final Throwable cause) {
   super(msg, ConcurrentUtils.checkedException(cause));
 }
Exemplo n.º 5
0
 /**
  * Creates a new instance of {@code ConcurrentException} and initializes it with the given cause.
  *
  * @param cause the cause of this exception
  * @throws IllegalArgumentException if the cause is not a checked exception
  */
 public ConcurrentException(final Throwable cause) {
   super(ConcurrentUtils.checkedException(cause));
 }