Class SynchronizedQueue

  • All Implemented Interfaces:
    java.util.Queue , kotlin.collections.Collection , kotlin.collections.Collection , kotlin.collections.Iterable , kotlin.collections.Iterable , kotlin.collections.MutableCollection , kotlin.collections.MutableCollection , kotlin.collections.MutableIterable , kotlin.collections.MutableIterable

    
    public class SynchronizedQueue<E extends Object>
    extends SynchronizedCollection<E> implements Queue<E>
                        

    Decorates another Queue to synchronize its behavior for a multithreaded environment.

    Methods are synchronized, then forwarded to the decorated queue. Iterators must be separately synchronized around the loop.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

      • SynchronizedQueue

        SynchronizedQueue(Queue<E> queue, Object lock)
        Constructor that wraps (not copies).
        Parameters:
        queue - the queue to decorate, must not be null
        lock - the lock to use, must not be null
      • SynchronizedQueue

        SynchronizedQueue(Queue<E> queue)
        Constructor that wraps (not copies).
        Parameters:
        queue - the queue to decorate, must not be null