{
_logger.debug("Message Id: " + messageId + " Removing");
}
// first we need to look up the header to get the chunk count
MessageMetaData mmd = getMessageMetaData(storeContext, messageId);
try
{
PreparedStatement stmt = conn.prepareStatement(DELETE_FROM_MESSAGE_META_DATA);
stmt.setLong(1,messageId);
wrapper.setRequiresCommit();
int results = stmt.executeUpdate();
if (results == 0)
{
if (localTx)
{
abortTran(storeContext);
}
throw new AMQException("Message metadata not found for message id " + messageId);
}
stmt.close();
if (_logger.isDebugEnabled())
{
_logger.debug("Deleted metadata for message " + messageId);
}
stmt = conn.prepareStatement(DELETE_FROM_MESSAGE_CONTENT);
stmt.setLong(1,messageId);
results = stmt.executeUpdate();
if(results != mmd.getContentChunkCount())
{
if (localTx)
{
abortTran(storeContext);
}
throw new AMQException("Unexpected number of content chunks when deleting message. Expected " + mmd.getContentChunkCount() + " but found " + results);
}
if (localTx)
{