Author: azeez
Date: Wed Jan 16 01:29:09 2008
New Revision: 12327

Log:

Increasing the tracer buffer size
Reversing the message buffer before sending so that the latest messages appear 
at the top



Modified:
   trunk/commons/tracer/src/main/java/org/wso2/tracer/TracerConstants.java
   trunk/commons/tracer/src/main/java/org/wso2/tracer/service/TracerService.java

Modified: 
trunk/commons/tracer/src/main/java/org/wso2/tracer/TracerConstants.java
==============================================================================
--- trunk/commons/tracer/src/main/java/org/wso2/tracer/TracerConstants.java     
(original)
+++ trunk/commons/tracer/src/main/java/org/wso2/tracer/TracerConstants.java     
Wed Jan 16 01:29:09 2008
@@ -21,7 +21,7 @@
 public final class TracerConstants {
 
     public static final String MSG_SEQ_BUFFER = "wso2tracer.msg.seq.buff";
-    public static final int MSG_BUFFER_SZ = 50;
+    public static final int MSG_BUFFER_SZ = 250;
     public static final String TRACING_STATUS = "wso2tracer.status";
 
     public static final String TRACE_PERSISTER_IMPL = 
"wso2tracer.trace.persister.impl";

Modified: 
trunk/commons/tracer/src/main/java/org/wso2/tracer/service/TracerService.java
==============================================================================
--- 
trunk/commons/tracer/src/main/java/org/wso2/tracer/service/TracerService.java   
    (original)
+++ 
trunk/commons/tracer/src/main/java/org/wso2/tracer/service/TracerService.java   
    Wed Jan 16 01:29:09 2008
@@ -29,6 +29,7 @@
 import org.wso2.utils.CircularBuffer;
 
 import java.util.ArrayList;
+import java.util.Collections;
 /*
  * 
  */
@@ -77,7 +78,7 @@
                 return tracerServiceInfo;
 
             } else {
-                ArrayList messageInfoList = new ArrayList();
+                ArrayList msgInfoList = new ArrayList();
                 boolean filterStatus = (filter != null && filter.length() != 
0);
                 tracerServiceInfo.setFilter(filterStatus);
 
@@ -88,43 +89,40 @@
                                                               
mi.getOperationName(),
                                                               
mi.getMessageSequence());
                         if (miPayload.getRequest().indexOf(filter) > -1) {
-                            messageInfoList.add(mi);
+                            msgInfoList.add(mi);
                         }
                         continue;
                     }
-                    messageInfoList.add(mi);
+                    msgInfoList.add(mi);
                 }
 
                 if (filterStatus) {
                     tracerServiceInfo.setFilterString(filter);
-                    if (messageInfoList.size() == 0) {
+                    if (msgInfoList.size() == 0) {
                         tracerServiceInfo.setEmpty(true);
                         return tracerServiceInfo;
                     }
                 }
 
-                MessageInfo lastMessageInfo = (MessageInfo) 
messageInfoList.get(0);
+                Collections.reverse(msgInfoList);
+                MessageInfo lastMessageInfo = (MessageInfo) msgInfoList.get(0);
                 tracerServiceInfo.setMessageInfo(
-                        (MessageInfo[]) messageInfoList.toArray(new 
MessageInfo[messageInfoList.size()]));
-                MessagePayload messagePayload = 
getMessage(lastMessageInfo.getServiceId(),
-                                                           
lastMessageInfo.getOperationName(),
-                                                           
lastMessageInfo.getMessageSequence());
-                tracerServiceInfo.setLastMessage(messagePayload);
+                        (MessageInfo[]) msgInfoList.toArray(new 
MessageInfo[msgInfoList.size()]));
+                MessagePayload lastMsg = 
getMessage(lastMessageInfo.getServiceId(),
+                                                    
lastMessageInfo.getOperationName(),
+                                                    
lastMessageInfo.getMessageSequence());
+                tracerServiceInfo.setLastMessage(lastMsg);
                 tracerServiceInfo.setEmpty(false);
-
             }
-
-
         }
-
-
         return tracerServiceInfo;
-
     }
 
     /**
      * @param flag; support ON or OFF.
+     *
      * @return The information about the Tracer service
+     *
      * @throws AxisFault If the tracer module is not found
      */
     public TracerServiceInfo setMonitoring(String flag) throws AxisFault {

_______________________________________________
Commons-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev

Reply via email to