public void send(byte[] data, int offset, int length) throws Exception {
        if(out == null)
            return;
        writers.incrementAndGet();
        send_lock.lock();
        try {
            doSend(data, offset, length);
            updateLastAccessed();
        }
        catch(InterruptedException iex) {
            Thread.currentThread().interrupt(); // set interrupt flag again
        }
        finally {
            if(writers.decrementAndGet() == 0) // only the last active writer thread calls flush()
                flush(); // won't throw an exception
            send_lock.unlock();
        }
    }
public void send ( byte [ ] data , int offset , int length ) throws Exception { if ( out == null ) return ; writers . incrementAndGet ( ) ; send_lock . lock ( ) ; try { doSend ( data , offset , length ) ; updateLastAccessed ( ) ; } catch ( InterruptedException iex ) { Thread . currentThread ( ) . interrupt ( ) ; } finally { if ( writers . decrementAndGet ( ) == 0 ) flush ( ) ; send_lock . unlock ( ) ; } }
@param data Guaranteed to be non null
@param offset
@param length