modules/andes-core/broker/src/main/java/org/wso2/andes/store/rdbms/RDBMSMessageStoreImpl.java
private void createNewQueue(final Connection connection, final String destinationQueueName) throws SQLException {

        PreparedStatement preparedStatement = null;
        Context contextWrite = MetricManager.timer(MetricsConstants.DB_WRITE, Level.INFO).start();

        try {

            //Add the queue to the database
            preparedStatement = connection.prepareStatement(RDBMSConstants.PS_INSERT_QUEUE);
            preparedStatement.setString(1, destinationQueueName);
            preparedStatement.executeUpdate();
            connection.commit();
            preparedStatement.close();

            //Add the queue to the internal map as well
            int queueId = getQueueID(destinationQueueName);
            if (-1 != queueId) {
                queueMappings.put(destinationQueueName, queueId);
            }

        } catch (SQLException e) {
            AndesException andesException = rdbmsStoreUtils
                    .convertSQLException("Error occurred while creating queue", e);

            if (andesException instanceof AndesDataIntegrityViolationException) {
                // This exception occurred because some other node has created the queue in parallel.
                // Therefore no need to create the queue. It's already created.
                // Nothing need to be done if this exception occur.
                log.warn("Queue already created. Skipping insert destination queue [" + destinationQueueName +
                        "] to database ");
            } else {
                log.error("Error occurred while inserting destination queue [" + destinationQueueName +
                        "] to database ");
                throw e;
            }
        } finally {
            contextWrite.stop();
            String task = RDBMSConstants.TASK_CREATING_QUEUE + destinationQueueName;
            close(preparedStatement, task);
        }
    }
/**
     * Using the provided connection create a new queue with queue id in database
     *
     * @param connection           Connection
     * @param destinationQueueName queue name
     * @throws SQLException
     */
Using the provided connection create a new queue with queue id in database
@param connection           Connection
@param destinationQueueName queue name
@throws SQLException
Using the provided connection create a new queue with queue id in database @param connection Connection @param destinationQueueName queue name @throws SQLException
private void createNewQueue(final Connection connection, final String destinationQueueName) throws SQLException {
        PreparedStatement preparedStatement = null;
        Context contextWrite = MetricManager.timer(MetricsConstants.DB_WRITE, Level.INFO).start();
        try {
            preparedStatement = connection.prepareStatement(RDBMSConstants.PS_INSERT_QUEUE);
            preparedStatement.setString(1, destinationQueueName);
            preparedStatement.executeUpdate();
            connection.commit();
            preparedStatement.close();
            int queueId = getQueueID(destinationQueueName);
            if (-1 != queueId) {
                queueMappings.put(destinationQueueName, queueId);
            }
        } catch (SQLException e) {
            AndesException andesException = rdbmsStoreUtils
                    .convertSQLException("Error occurred while creating queue", e);
            if (andesException instanceof AndesDataIntegrityViolationException) {
                log.warn("Queue already created. Skipping insert destination queue [" + destinationQueueName +
                        "] to database ");
            } else {
                log.error("Error occurred while inserting destination queue [" + destinationQueueName +
                        "] to database ");
                throw e;
            }
        } finally {
            contextWrite.stop();
            String task = RDBMSConstants.TASK_CREATING_QUEUE + destinationQueueName;
            close(preparedStatement, task);
        }
    }
private void createNewQueue ( final Connection connection , final String destinationQueueName ) throws SQLException { PreparedStatement preparedStatement = null ; Context contextWrite = MetricManager . timer ( MetricsConstants . DB_WRITE , Level . INFO ) . start ( ) ; try { preparedStatement = connection . prepareStatement ( RDBMSConstants . PS_INSERT_QUEUE ) ; preparedStatement . setString ( 1 , destinationQueueName ) ; preparedStatement . executeUpdate ( ) ; connection . commit ( ) ; preparedStatement . close ( ) ; int queueId = getQueueID ( destinationQueueName ) ; if ( - 1 != queueId ) { queueMappings . put ( destinationQueueName , queueId ) ; } } catch ( SQLException e ) { AndesException andesException = rdbmsStoreUtils . convertSQLException ( "Error occurred while creating queue" , e ) ; if ( andesException instanceof AndesDataIntegrityViolationException ) { log . warn ( "Queue already created. Skipping insert destination queue [" + destinationQueueName + "] to database " ) ; } else { log . error ( "Error occurred while inserting destination queue [" + destinationQueueName + "] to database " ) ; throw e ; } } finally { contextWrite . stop ( ) ; String task = RDBMSConstants . TASK_CREATING_QUEUE + destinationQueueName ; close ( preparedStatement , task ) ; } }
Using the provided connection create a new queue with queue id in database
 @param connection           Connection
 @param destinationQueueName queue name
 @throws SQLException
Using the provided connection create a new queue with queue id in database @param connection Connection @param destinationQueueName queue name @throws SQLException
//Add the queue to the database //Add the queue to the internal map as well // This exception occurred because some other node has created the queue in parallel. // Therefore no need to create the queue. It's already created. // Nothing need to be done if this exception occur.