get object from queue . block if there are no objects to get . concode_field_sep Object[] elements concode_elem_sep int head concode_elem_sep Object lock concode_elem_sep int size concode_elem_sep int tail concode_elem_sep int maxSize concode_field_sep int size concode_elem_sep void clear concode_elem_sep int maxSize concode_elem_sep void put concode_elem_sep void put concode_elem_sep Object peek concode_elem_sep Object peek
Object function ( ) { synchronized ( lock ) { while ( size == 0 ) lock . wait ( ) ; Object loc0 = elements [ head ] ; elements [ head ] = null ; if ( ++ head == maxSize ) head = 0 ; if ( size == maxSize ) lock . notifyAll ( ) ; size -- ; return loc0 ; } }