All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.util.CountDownLatch.scala Maven / Gradle / Ivy

The newest version!
package com.twitter.util

import java.util.concurrent.TimeUnit

class CountDownLatch(val initialCount: Int) {
  val underlying = new java.util.concurrent.CountDownLatch(initialCount)
  def count = underlying.getCount
  def isZero = count == 0
  def countDown() = underlying.countDown()
  def await() = underlying.await()
  def await(timeout: Duration) = underlying.await(timeout.inMillis, TimeUnit.MILLISECONDS)
  def within(timeout: Duration) = await(timeout) || {
    throw new TimeoutException(timeout.toString)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy