com.fsist.util

concurrent

package concurrent

Visibility
  1. Public
  2. All

Type Members

  1. trait AsyncFunc[-A, +B] extends Func[A, B]

    The asynchronous case of Func.

  2. class AsyncQueue[T] extends AtomicReference[Either[Queue[Promise[T]], Queue[T]]] with LazyLogging

    An asynchronous concurrent unbounded queue.

    An asynchronous concurrent unbounded queue. Enqueueing completes immediately, while dequeueing returns a Future that is completed once an object can be removed from the queue.

    Attribution: base implementation (enqueue/dequeue part) copied from https://groups.google.com/forum/#!topic/scala-user/lyoAdNs3E1o Originally by Viktor Klang.

    Implementation notes:

    An instance holds either a sequence of enqueued values Seq[T], or a sequence of dequeue() promises waiting to be fulfilled.

    Operations are synchronized using AtomicReference. Each modification is attempted using compareAndSet, and if the comparison failed (i.e. another thread won at the race of modifying the AtomicReference) we start the dequeue/enqueue method from scratch.

    I replaced the Seq (implicit List) with a Queue to improve performance, since the original code was appending to the end of the List.

    T

    the queue element type

  3. class BoundedAsyncQueue[T] extends LazyLogging

    A queue where both insertion and removal are asynchronous, based on a maximum queue size.

  4. case class ComposedAsyncFunc[-A, +B, InnerA, InnerB](before: SyncFunc[A, InnerA], middle: AsyncFunc[InnerA, InnerB], after: SyncFunc[InnerB, B]) extends AsyncFunc[A, B] with Product with Serializable

    An async func sandwiched between two sync ones.

    An async func sandwiched between two sync ones. Enables efficient composing of sync funcs around async ones.

  5. sealed trait Func[-A, +B] extends AnyRef

    Abstracts over synchronous and asynchronous functions.

    Abstracts over synchronous and asynchronous functions. Instances can be composed efficiently, building new synchronous functionsn if all component functions are synchronous.

    A func is always either a SyncFunc or an AsyncFunc.

  6. class FutureOps[T] extends LazyLogging

    Extra methods on Future[T], with implicit PML conversion.

    Extra methods on Future[T], with implicit PML conversion. NOTE: this should be a value type, but that hits a known a bug in the Scala compiler that was only fixed in 2.11.

  7. trait SyncFunc[-A, +B] extends Func[A, B]

    The synchronous case of Func.

Value Members

  1. object AsyncFunc

  2. object Func extends LazyLogging

  3. object FutureOps extends LazyLogging

  4. object SyncFunc

Ungrouped