public void put ( Object o ) throws InterruptedException { synchronized ( lock ) { while ( size == maxSize ) lock . wait ( ) ; elements [ tail ] = o ; if ( ++ tail == maxSize ) tail = 0 ; size ++ ; lock . notify ( ) ; } }
Put object in queue .