Domanda di colloquio di LinkedIn

Write put/get methods for a BlockingQueue

Risposta di colloquio

Anonimo

13 apr 2012

In Java, just make the methods synchronized.When one thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object block (suspend execution) until the first thread is done with the object. }