public void tryPut(E e) throws InterruptedException, SynchException
    {
        if (e == null)
        {
            throw new IllegalArgumentException("The 'e' parameter may not be null.");
        }

        // final Queue<E> items = this.buffer;
        ReentrantLock lock = this.lock;
        lock.lockInterruptibly();

        try
        {
            while (getBufferRemainingCapacity() == 0)
            {
                // Release the lock and wait until the queue is not full.
                notFull.await();
            }
        }
        catch (InterruptedException ie)
        {
            notFull.signal(); // propagate to non-interrupted thread
            throw ie;
        }

        // There is room in the queue so insert must succeed. Insert into the queu, release the lock and block
        // the producer until its data is taken.
        insert(e, true);
    }
public void tryPut ( E e ) throws InterruptedException , SynchException { if ( e == null ) { throw new IllegalArgumentException ( "The 'e' parameter may not be null." ) ; } ReentrantLock lock = this . lock ; lock . lockInterruptibly ( ) ; try { while ( getBufferRemainingCapacity ( ) == 0 ) { notFull . await ( ) ; } } catch ( InterruptedException ie ) { notFull . signal ( ) ; throw ie ; } insert ( e , true ) ; }
Tries a synchronous put into the queue. If a consumer encounters an exception condition whilst processing the
data that is put, then this is returned to the caller wrapped inside a {@link SynchException}.

@param  e The data element to put into the queue, may not be null.

@throws InterruptedException     If the thread is interrupted whilst waiting to write to the queue or whilst
waiting on its entry in the queue being consumed.
@throws SynchException           If a consumer encounters an error whilst processing the data element.
@throws IllegalArgumentException If the specified element is <tt>null</tt>.