Changeset 49 for trunk/src/main/java/omq/common/broker/Broker.java
- Timestamp:
- 06/19/13 15:59:53 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/common/broker/Broker.java
r47 r49 2 2 3 3 import java.io.IOException; 4 import java.net.URL; 4 5 import java.util.HashMap; 5 6 import java.util.Map; … … 20 21 import omq.server.RemoteObject; 21 22 23 import org.apache.log4j.Logger; 24 import org.apache.log4j.xml.DOMConfigurator; 25 22 26 import com.rabbitmq.client.Channel; 23 27 import com.rabbitmq.client.Connection; … … 28 32 29 33 public class Broker { 34 35 private static final Logger logger = Logger.getLogger(Broker.class.getName()); 36 30 37 private static Connection connection; 31 38 private static Channel channel; … … 45 52 public static synchronized void initBroker(Properties env) throws Exception { 46 53 if (environment == null) { 54 55 // Load log4j configuration 56 URL log4jResource = Broker.class.getResource("/log4j.xml"); 57 DOMConfigurator.configure(log4jResource); 58 47 59 remoteObjs = new HashMap<String, RemoteObject>(); 48 60 environment = env; … … 58 70 } 59 71 } else { 60 throw new InitBrokerException("Broker already started"); 72 logger.error("Broker is already started"); 73 throw new InitBrokerException("Broker is already started"); 61 74 } 62 75 } 63 76 64 77 public static void stopBroker() throws Exception { 78 logger.warn("Stopping broker"); 65 79 // Stop the client 66 80 if (clientStarted) { … … 93 107 94 108 public static void closeConnection() throws IOException { 109 logger.warn("Clossing connection"); 95 110 connectionClosed = true; 96 111 connection.close(); … … 241 256 @Override 242 257 public void shutdownCompleted(ShutdownSignalException cause) { 258 logger.warn("Shutdown message received. Cause: " + cause.getMessage()); 243 259 if (!connectionClosed) 244 260 if (cause.isHardError()) {
Note: See TracChangeset
for help on using the changeset viewer.