protected boolean _queueWithRetries(Connection conn, IQueueMessage<ID, DATA> msg,
            int numRetries, int maxRetries) {
        try {
            Date now = new Date();
            msg.setNumRequeues(0).setQueueTimestamp(now).setTimestamp(now);
            return putToQueueStorage(conn, msg);
        } catch (DuplicatedValueException dve) {
            LOGGER.warn(dve.getMessage(), dve);
            return true;
        } catch (DaoException de) {
            if (de.getCause() instanceof DuplicateKeyException) {
                LOGGER.warn(de.getMessage(), de);
                return true;
            }
            if (de.getCause() instanceof ConcurrencyFailureException) {
                if (numRetries > maxRetries) {
                    throw new QueueException(de);
                } else {
                    incRetryCounter("_queueWithRetries");
                    return _queueWithRetries(conn, msg, numRetries + 1, maxRetries);
                }
            }
            throw de;
        } catch (Exception e) {
            throw e instanceof QueueException ? (QueueException) e : new QueueException(e);
        }
    }
protected boolean _queueWithRetries ( Connection conn , IQueueMessage < ID , DATA > msg , int numRetries , int maxRetries ) { try { Date now = new Date ( ) ; msg . setNumRequeues ( 0 ) . setQueueTimestamp ( now ) . setTimestamp ( now ) ; return putToQueueStorage ( conn , msg ) ; } catch ( DuplicatedValueException dve ) { LOGGER . warn ( dve . getMessage ( ) , dve ) ; return true ; } catch ( DaoException de ) { if ( de . getCause ( ) instanceof DuplicateKeyException ) { LOGGER . warn ( de . getMessage ( ) , de ) ; return true ; } if ( de . getCause ( ) instanceof ConcurrencyFailureException ) { if ( numRetries > maxRetries ) { throw new QueueException ( de ) ; } else { incRetryCounter ( "_queueWithRetries" ) ; return _queueWithRetries ( conn , msg , numRetries + 1 , maxRetries ) ; } } throw de ; } catch ( Exception e ) { throw e instanceof QueueException ? ( QueueException ) e : new QueueException ( e ) ; } }
Queue a message, retry if deadlock.

<p>
Note: http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html
</p>
<p>
InnoDB uses automatic row-level locking. You can get deadlocks even in
the case of transactions that just insert or delete a single row. That is
because these operations are not really "atomic"; they automatically set
locks on the (possibly several) index records of the row inserted or
deleted.
</p>

<p>
Note: the supplied queue message is mutable.
</p>

@param conn
@param msg
@param numRetries
@param maxRetries
@return