Ignore:
Timestamp:
07/08/13 13:29:24 (11 years ago)
Author:
stoda
Message:

J

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/main/java/omq/common/util/OmqConnectionFactory.java

    r77 r83  
    1313
    1414/**
     15 * This class creates RabbitMQ connections
    1516 *
    1617 * @author Sergi Toda <sergi.toda@estudiants.urv.cat>
     
    2324        private static int connectionTimeout = 2 * 1000;
    2425
     26        /**
     27         * If this class is wanted to use as a singleton class this is the init
     28         * function
     29         *
     30         * @param env
     31         *            - environment that sets the properties needed by RabbitMQ
     32         * @throws KeyManagementException
     33         * @throws NoSuchAlgorithmException
     34         * @throws IOException
     35         */
    2536        public static void init(Properties env) throws KeyManagementException, NoSuchAlgorithmException, IOException {
    2637                if (connection == null) {
     
    2940        }
    3041
     42        /**
     43         * This function returns a working connection.
     44         *
     45         * @param env
     46         *            - used if it's necessary to create a new connection
     47         * @return workingConnection
     48         * @throws Exception
     49         */
    3150        public static Connection getNewWorkingConnection(Properties env) throws Exception {
    3251                Connection connection = null;
     
    5069        }
    5170
     71        /**
     72         * This function creates a new rabbitmq connection using the properties set
     73         * in env
     74         *
     75         * @param env
     76         *            - Properties needed to create a new connection: username,
     77         *            password, rabbit_host, rabbit_port, enable_ssl (optional)
     78         * @return new Connection
     79         * @throws IOException
     80         * @throws KeyManagementException
     81         * @throws NoSuchAlgorithmException
     82         */
    5283        public static Connection getNewConnection(Properties env) throws IOException, KeyManagementException, NoSuchAlgorithmException {
    5384                // Get login info of rabbitmq
     
    5990                int port = Integer.parseInt(env.getProperty(ParameterQueue.RABBIT_PORT));
    6091
    61                 boolean ssl = Boolean.parseBoolean(env.getProperty(ParameterQueue.ENABLE_SSL));
     92                boolean ssl = Boolean.parseBoolean(env.getProperty(ParameterQueue.ENABLE_SSL, "false"));
    6293
    6394                // Start a new connection and channel
     
    78109        }
    79110
     111        /**
     112         * This method creates a new channel if the singleton pattern is used
     113         *
     114         * @return new Channel
     115         * @throws IOException
     116         */
    80117        public static Channel getNewChannel() throws IOException {
    81118                Channel channel = connection.createChannel();
Note: See TracChangeset for help on using the changeset viewer.