- Timestamp:
- 06/19/13 15:59:53 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/common/util/OmqConnectionFactory.java
r44 r49 5 5 import java.security.NoSuchAlgorithmException; 6 6 import java.util.Properties; 7 8 import org.apache.log4j.Logger; 7 9 8 10 import com.rabbitmq.client.Channel; … … 16 18 */ 17 19 public class OmqConnectionFactory { 20 private static final Logger logger = Logger.getLogger(OmqConnectionFactory.class.getName()); 21 18 22 private static Connection connection; 19 23 private static int connectionTimeout = 2 * 1000; … … 34 38 working = true; 35 39 } catch (Exception e) { 36 e.printStackTrace();40 logger.error(e); 37 41 long milis = Long.parseLong(env.getProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000")); 38 42 Thread.sleep(milis); … … 64 68 factory.useSslProtocol(); 65 69 } 66 return factory.newConnection(); 70 71 Connection connection = factory.newConnection(); 72 logger.info("New connection created using: username: " + username + ", host: " + host + ", port: " + port + ", connection timeout: " 73 + connectionTimeout + " SSL enabled: " + ssl); 74 return connection; 67 75 } 68 76 69 77 public static Channel getNewChannel() throws IOException { 70 return connection.createChannel(); 78 Channel channel = connection.createChannel(); 79 logger.info("New channel created using the default connection"); 80 return channel; 71 81 } 72 82 }
Note: See TracChangeset
for help on using the changeset viewer.