Ignore:
Timestamp:
11/11/13 12:11:51 (11 years ago)
Author:
stoda
Message:

Broker:

tryconnection won't be used
DOMConfigurator won't be used


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/supervisor/src/main/java/omq/common/broker/Broker.java

    r106 r111  
    33import java.io.IOException;
    44import java.lang.reflect.Proxy;
    5 import java.net.URL;
    65import java.util.HashMap;
    76import java.util.Hashtable;
     
    2322
    2423import org.apache.log4j.Logger;
    25 import org.apache.log4j.xml.DOMConfigurator;
    26 
     24
     25import com.rabbitmq.client.AMQP.BasicProperties;
    2726import com.rabbitmq.client.Channel;
    2827import com.rabbitmq.client.Connection;
    2928import com.rabbitmq.client.QueueingConsumer;
    30 import com.rabbitmq.client.AMQP.BasicProperties;
    3129import com.rabbitmq.client.QueueingConsumer.Delivery;
    3230import com.rabbitmq.client.ShutdownListener;
     
    6058        public Broker(Properties env) throws Exception {
    6159                // Load log4j configuration
    62                 URL log4jResource = Broker.class.getResource("/log4j.xml");
    63                 DOMConfigurator.configure(log4jResource);
     60                // URL log4jResource = Broker.class.getResource("/log4j.xml");
     61                // DOMConfigurator.configure(log4jResource);
    6462
    6563                remoteObjs = new HashMap<String, RemoteObject>();
     
    6967                channel = connection.createChannel();
    7068                addFaultTolerance();
    71                 try {
    72                         tryConnection(env);
    73                 } catch (Exception e) {
    74                         channel.close();
    75                         connection.close();
     69                if (!connection.isOpen() || !channel.isOpen()) {
     70                        if (connection.isOpen()) {
     71                                connection.close();
     72                        }
    7673                        throw new InitBrokerException("The connection didn't work");
    7774                }
     75
     76                // try {
     77                // tryConnection(env);
     78                // } catch (Exception e) {
     79                // channel.close();
     80                // connection.close();
     81                // throw new InitBrokerException("The connection didn't work");
     82                // }
    7883        }
    7984
     
    99104
    100105                clientStarted = false;
    101                 connectionClosed = false;
     106                // connectionClosed = false;
    102107                environment = null;
    103108                remoteObjs = null;
     
    121126                connectionClosed = true;
    122127                connection.close();
    123                 connectionClosed = false;
     128                // connectionClosed = false;
    124129        }
    125130
     
    154159         * @throws IOException
    155160         */
    156         public synchronized void publishMessge(String exchange, String routingKey, BasicProperties props, byte[] bytesRequest) throws IOException {
     161        public synchronized void publishMessge(String exchange, String routingKey, BasicProperties props, byte[] bytesRequest)
     162                        throws IOException {
    157163                if (!channel.isOpen()) {
    158164                        logger.error("Broker's channel is closed opening a new one", channel.getCloseReason());
Note: See TracChangeset for help on using the changeset viewer.