guava/src/com/google/common/collect/Queues.java
public static <E> Queue<E> synchronizedQueue(Queue<E> queue) {
    return Synchronized.queue(queue, null);
  }
public static <E> Queue<E> synchronizedQueue(Queue<E> queue) {
    return Synchronized.queue(queue, null);
  }
Returns a synchronized (thread-safe) queue backed by the specified queue. In order to guarantee
serial access, it is critical that <b>all</b> access to the backing queue is accomplished
through the returned queue.

<p>It is imperative that the user manually synchronize on the returned queue when accessing the
queue's iterator:

<pre>{@code
Queue<E> queue = Queues.synchronizedQueue(MinMaxPriorityQueue.<E>create());
...
queue.add(element);  // Needn't be in synchronized block
...
synchronized (queue) {  // Must synchronize on queue!
Iterator<E> i = queue.iterator(); // Must be in synchronized block
while (i.hasNext()) {
foo(i.next());
}
}
}</pre>

<p>Failure to follow this advice may result in non-deterministic behavior.

<p>The returned queue will be serializable if the specified queue is serializable.

@param queue the queue to be wrapped in a synchronized view
@return a synchronized view of the specified queue
@since 14.0