Changeset 49 for trunk/src/main/java/omq/server
- Timestamp:
- 06/19/13 15:59:53 (11 years ago)
- Location:
- trunk/src/main/java/omq/server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/server/InvocationThread.java
r47 r49 8 8 import omq.common.util.Serializer; 9 9 import omq.exception.OmqException; 10 11 import org.apache.log4j.Logger; 10 12 11 13 import com.rabbitmq.client.AMQP.BasicProperties; … … 19 21 */ 20 22 public class InvocationThread extends Thread { 23 private static final Logger logger = Logger.getLogger(InvocationThread.class.getName()); 21 24 private RemoteObject obj; 22 25 private BlockingQueue<Delivery> deliveryQueue; … … 44 47 String requestID = request.getId(); 45 48 46 System.out.println("Invoke method: " + methodName + " CorrID: " + requestID);49 logger.debug("Object: " + obj.getRef() + ", method: " + methodName + " corrID: " + requestID); 47 50 48 51 // Invoke the method … … 53 56 } catch (InvocationTargetException e) { 54 57 Throwable throwable = e.getTargetException(); 58 logger.error("Object: " + obj.getRef() + " at method: " + methodName + ", corrID" + requestID, throwable); 55 59 error = new OmqException(throwable.getClass().getCanonicalName(), throwable.getMessage()); 56 60 } catch (NoSuchMethodException e) { 61 logger.error("Object: " + obj.getRef() + " cannot find method: " + methodName); 57 62 error = new OmqException(e.getClass().getCanonicalName(), e.getMessage()); 58 63 } … … 75 80 76 81 } catch (InterruptedException i) { 77 i.printStackTrace();82 logger.error(i); 78 83 killed = true; 79 84 } catch (Exception e) { 80 System.out.println("Error a l'Invocation Thread \nException: " + e); 81 e.printStackTrace(); 85 logger.error("Object: " + obj.getRef(), e); 82 86 } 83 87 -
trunk/src/main/java/omq/server/RemoteObject.java
r44 r49 10 10 import java.util.Properties; 11 11 12 import org.apache.log4j.Logger; 13 12 14 import omq.Remote; 13 15 import omq.common.broker.Broker; … … 33 35 34 36 private static final long serialVersionUID = -1778953938739846450L; 37 private static final Logger logger = Logger.getLogger(RemoteObject.class.getName()); 35 38 36 39 private String UID; … … 85 88 try { 86 89 Delivery delivery = consumer.nextDelivery(); 87 System.out.println("RemoteObject: " + UID + " has received a message"); 90 91 logger.debug(UID + " has received a message"); 92 88 93 remoteWrapper.notifyDelivery(delivery); 89 94 } catch (InterruptedException i) { 90 i.printStackTrace();95 logger.error(i); 91 96 } catch (ShutdownSignalException e) { 92 e.printStackTrace();97 logger.error(e); 93 98 try { 94 99 if (channel.isOpen()) { … … 101 106 Thread.sleep(milis); 102 107 } catch (InterruptedException e2) { 103 e2.printStackTrace();104 } 105 e1.printStackTrace();108 logger.error(e2); 109 } 110 logger.error(e1); 106 111 } 107 112 } catch (ConsumerCancelledException e) { 108 e.printStackTrace();113 logger.error(e); 109 114 } catch (SerializerException e) { 110 e.printStackTrace();115 logger.error(e); 111 116 } catch (Exception e) { 112 e.printStackTrace();117 logger.error(e); 113 118 } 114 119 } … … 129 134 130 135 public void kill() throws IOException { 136 logger.warn("Killing objectmq: " + this.getRef()); 131 137 killed = true; 132 138 interrupt(); … … 218 224 219 225 // Declares and bindings 220 System.out.println("RemoteObject: " + UID + " declaring direct exchange: " + exchange + ", Queue: " + queue);226 logger.info("RemoteObject: " + UID + " declaring direct exchange: " + exchange + ", Queue: " + queue); 221 227 channel.exchangeDeclare(exchange, "direct"); 222 228 channel.queueDeclare(queue, durable, false, false, null); … … 224 230 225 231 // Declare the event topic fanout 226 System.out.println("RemoteObject: " + UID + " declaring fanout exchange: " + UID);232 logger.info("RemoteObject: " + UID + " declaring fanout exchange: " + UID); 227 233 channel.exchangeDeclare(UID, "fanout"); 228 234 -
trunk/src/main/java/omq/server/RemoteWrapper.java
r44 r49 4 4 import java.util.concurrent.BlockingQueue; 5 5 import java.util.concurrent.LinkedBlockingDeque; 6 7 import org.apache.log4j.Logger; 6 8 7 9 import com.rabbitmq.client.QueueingConsumer; … … 14 16 */ 15 17 public class RemoteWrapper { 18 private static final Logger logger = Logger.getLogger(RemoteWrapper.class.getName()); 19 16 20 private RemoteObject obj; 17 21 private int numThreads; … … 25 29 deliveryQueue = new LinkedBlockingDeque<QueueingConsumer.Delivery>(); 26 30 27 System.out.println("RemoteWrapper -> Object: " + obj.getRef() + ", numthreads listening = " + numThreads);31 logger.info("Object reference: " + obj.getRef() + ", numthreads listening = " + numThreads); 28 32 29 33 for (int i = 0; i < numThreads; i++) { … … 39 43 40 44 public void stopRemoteWrapper() { 45 logger.warn("Stopping Invocation threads vinculed to " + obj.getRef()); 41 46 for (InvocationThread thread : invocationList) { 42 47 thread.interrupt();
Note: See TracChangeset
for help on using the changeset viewer.