if (trace)
{
log.trace("Inserted " + rows + " rows");
}
Message m = ref.getMessage();
synchronized (m)
{
if (!m.isPersisted())
{
if (psInsertMessage == null)
{
psInsertMessage = conn
.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
}
// First time so add message
// And in case of clustered queues/topics, the message
// could possibly be already persisted on the different
// node
// so we persist also using the Conditional Update
if (trace)
{
log
.trace("Message does not already exist so inserting it");
}
storeMessage(m, psInsertMessage, true);
rows = psInsertMessage.executeUpdate();
if (trace)
{
log.trace("Inserted " + rows + " rows");
}
m.setPersisted(true);
messagesStored.add(m);
//We only cache the first id in a tx - this is enough to determine if the tx succeeded
if (first && m instanceof JBossMessage)