public T remove(long seqno) {
        lock.lock();
        try {
            if(seqno < low || seqno > high)
                return null;
            int index=index(seqno);
            T retval=buffer[index];
            if(retval != null && removes_till_compaction > 0)
                num_removes++;
            buffer[index]=null;
            if(seqno == low)
                advanceLow();
            if(removes_till_compaction > 0 && num_removes >= removes_till_compaction) {
                _compact();
                num_removes=0;
            }
            return retval;
        }
        finally {
            lock.unlock();
        }
    }