// queue for other operations (e.g. puts by other threads) to complete before returning null.
//item = localQueue.getTemporarySession().take(0l);
// Option 2: Exits on timeout. (because of put contention or takes from another thread).
// Reschedules if queueSize is still non-zero.
QueueTake take = localQueue.getTemporarySession();
try {
item = take.take(dqm.getConfiguration().getRemotingTakeTimeout());
} catch (QueueTimeoutException te) {
dqm.incrementRemotingTakeTimeouts();
logger.debug("[{}] Timeout waiting to take from Queue. Size = {}. Item = {}", new Object[] { localQueue.getName(), localQueue.getSize(), item });
}