- Timestamp:
- 07/08/13 13:29:24 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/common/util/OmqConnectionFactory.java
r77 r83 13 13 14 14 /** 15 * This class creates RabbitMQ connections 15 16 * 16 17 * @author Sergi Toda <sergi.toda@estudiants.urv.cat> … … 23 24 private static int connectionTimeout = 2 * 1000; 24 25 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 */ 25 36 public static void init(Properties env) throws KeyManagementException, NoSuchAlgorithmException, IOException { 26 37 if (connection == null) { … … 29 40 } 30 41 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 */ 31 50 public static Connection getNewWorkingConnection(Properties env) throws Exception { 32 51 Connection connection = null; … … 50 69 } 51 70 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 */ 52 83 public static Connection getNewConnection(Properties env) throws IOException, KeyManagementException, NoSuchAlgorithmException { 53 84 // Get login info of rabbitmq … … 59 90 int port = Integer.parseInt(env.getProperty(ParameterQueue.RABBIT_PORT)); 60 91 61 boolean ssl = Boolean.parseBoolean(env.getProperty(ParameterQueue.ENABLE_SSL ));92 boolean ssl = Boolean.parseBoolean(env.getProperty(ParameterQueue.ENABLE_SSL, "false")); 62 93 63 94 // Start a new connection and channel … … 78 109 } 79 110 111 /** 112 * This method creates a new channel if the singleton pattern is used 113 * 114 * @return new Channel 115 * @throws IOException 116 */ 80 117 public static Channel getNewChannel() throws IOException { 81 118 Channel channel = connection.createChannel();
Note: See TracChangeset
for help on using the changeset viewer.