synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ind...@apache.org
Subject svn commit: r506848 - in /webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: core/axis2/ProxyServiceMessageReceiver.java statistics/impl/ProxyServiceStatisticsStack.java statistics/impl/SequenceStatisticsStack.java
Date Tue, 13 Feb 2007 04:05:13 GMT
Author: indika
Date: Mon Feb 12 20:05:12 2007
New Revision: 506848

URL: http://svn.apache.org/viewvc?view=rev&rev=506848
Log:
fixed issue in SequenceStatisticsStack 
fixed issue in fault count

Modified:
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/ProxyServiceStatisticsStack.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/SequenceStatisticsStack.java

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java?view=diff&rev=506848&r1=506847&r2=506848
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
Mon Feb 12 20:05:12 2007
@@ -71,7 +71,19 @@
         log.debug("Body : \n" + mc.getEnvelope());
 
         MessageContext synCtx = Axis2MessageContextFinder.getSynapseMessageContext(mc);
-
+        
+        // Setting Required property to collect the proxy service statistics
+        boolean statisticsEnable;
+        ProxyService currentProxyService = synCtx.getConfiguration().getProxyService(name);
+        if (currentProxyService != null) {
+            statisticsEnable = (org.apache.synapse.Constants.STATISTICS_ON == currentProxyService.getStatisticsEnable());
+            if (statisticsEnable) {
+                ProxyServiceStatisticsStack proxyServiceStatisticsStack = new ProxyServiceStatisticsStack();
+                boolean isFault = synCtx.getEnvelope().getBody().hasFault();
+                proxyServiceStatisticsStack.put(name, System.currentTimeMillis(), !synCtx.isResponse(),
statisticsEnable, isFault);
+                synCtx.setCorrelationProperty(org.apache.synapse.Constants.PROXYSERVICE_STATISTICS_STACK,
proxyServiceStatisticsStack);
+            }
+        }
         // if a target endpoint is specified, directly forward to that
         if (targetEndpoint != null) {
             Endpoint endpoint = synCtx.getConfiguration().getNamedEndpoint(targetEndpoint);
@@ -109,12 +121,12 @@
                 log.debug("Reply Body : \n" + axisOutMsgContext.getEnvelope());
                 // Setting Required property to collect the proxy service statistics
                 String endPointName = endpoint.getName();
-                boolean statisticsEnable;
-                statisticsEnable = (org.apache.synapse.Constants.STATISTICS_ON == endpoint.getStatisticsEnable());
-                if (endPointName != null && statisticsEnable) {
+                boolean endPointStatisticsEnable;
+                endPointStatisticsEnable = (org.apache.synapse.Constants.STATISTICS_ON ==
endpoint.getStatisticsEnable());
+                if (endPointName != null && endPointStatisticsEnable) {
                     EndPointStatisticsStack endPointStatisticsStack = new EndPointStatisticsStack();
                     boolean isFault =synCtx.getEnvelope().getBody().hasFault();
-                    endPointStatisticsStack.put(endPointName, System.currentTimeMillis(),
!synCtx.isResponse(), statisticsEnable,isFault);
+                    endPointStatisticsStack.put(endPointName, System.currentTimeMillis(),
!synCtx.isResponse(), endPointStatisticsEnable,isFault);
                     synCtx.setCorrelationProperty(org.apache.synapse.Constants.ENDPOINT_STATISTICS_STACK,
endPointStatisticsStack);
                 }
                 AxisEngine ae = new AxisEngine(axisOutMsgContext.getConfigurationContext());
@@ -132,7 +144,7 @@
                     log.error("Axis fault encountered while forwarding message to endpoint
: "
                             + targetEndpoint, e);
                 } finally {
-                    if (statisticsEnable) {
+                    if (endPointStatisticsEnable) {
                         StatisticsUtils.processEndPointStatistics(synCtx);
                     }
                 }
@@ -146,18 +158,6 @@
                         + " for the proxy set to the MessageContext");
                 synCtx.setProperty(org.apache.synapse.Constants.OUT_SEQUENCE, targetOutSequence);
             }
-            // Setting Required property to collect the proxy service statistics
-            boolean statisticsEnable;
-            ProxyService currentProxyService = synCtx.getConfiguration().getProxyService(name);
-            if (currentProxyService != null) {
-                statisticsEnable = (org.apache.synapse.Constants.STATISTICS_ON == currentProxyService.getStatisticsEnable());
-                if (statisticsEnable) {
-                    ProxyServiceStatisticsStack proxyServiceStatisticsStack = new ProxyServiceStatisticsStack();
-                    boolean isFault =synCtx.getEnvelope().getBody().hasFault();
-                    proxyServiceStatisticsStack.put(name, System.currentTimeMillis(), !synCtx.isResponse(),
statisticsEnable,isFault);
-                    synCtx.setCorrelationProperty(org.apache.synapse.Constants.PROXYSERVICE_STATISTICS_STACK,
proxyServiceStatisticsStack);
-                }
-            }
 
             // if a named inSequence is specified, use it for message mediation
             if (targetInSequence != null) {
@@ -184,7 +184,7 @@
         // else, response will be 202 OK without an http body
         // if smc.isFaultRespose = true then the response is a fault with 500 Internal Server
Error
 
-        if (synCtx.isResponse()) {
+        if (synCtx.isResponse()) {             
             mc.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
         }
         if (synCtx.isFaultResponse()) {

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/ProxyServiceStatisticsStack.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/ProxyServiceStatisticsStack.java?view=diff&rev=506848&r1=506847&r2=506848
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/ProxyServiceStatisticsStack.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/ProxyServiceStatisticsStack.java
Mon Feb 12 20:05:12 2007
@@ -65,8 +65,8 @@
             isOUTFault = isFault;
             statisticsCollector.reportForProxyService(proxyServiceName, false, inTimeForInFlow,
inTimeForOutFlow, isINFault);
             inTimeForInFlow = -1;
-        } else if (inTimeForOutFlow != -1) {
-            statisticsCollector.reportForProxyService(proxyServiceName, true, inTimeForOutFlow,
System.currentTimeMillis(), isOUTFault);
+        } else if (inTimeForOutFlow != -1) {            
+            statisticsCollector.reportForProxyService(proxyServiceName, true, inTimeForOutFlow,
System.currentTimeMillis(), isFault);
             inTimeForOutFlow = -1;
         }
     }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/SequenceStatisticsStack.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/SequenceStatisticsStack.java?view=diff&rev=506848&r1=506847&r2=506848
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/SequenceStatisticsStack.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/impl/SequenceStatisticsStack.java
Mon Feb 12 20:05:12 2007
@@ -47,7 +47,10 @@
      * @param isFault
      */
     public void reportToStatisticsCollector(StatisticsCollector statisticsCollector,boolean
isFault) {
-        popSequenceStatistics(sequenceStatisticsList.size() - 1, statisticsCollector);
+       int top = sequenceStatisticsList.size();
+       if (top > 0) {
+           popSequenceStatistics(sequenceStatisticsList.size() - 1, statisticsCollector);
+       }
     }
     /**
      * This method  used to unreported all statistics to the StatisticsCollector
@@ -67,12 +70,15 @@
      * @param statisticsCollector
      */
     private void popSequenceStatistics(int index, StatisticsCollector statisticsCollector)
{
-        SequenceStatistics sequenceStatistics = (SequenceStatistics) sequenceStatisticsList.get(index);
-        if (sequenceStatistics != null) {
-            if (sequenceStatistics.isStatisticsEnable && sequenceStatistics.sequenceName
!= null) {
-                statisticsCollector.reportForSequence(sequenceStatistics.sequenceName, !sequenceStatistics.isInFlow,
sequenceStatistics.initTime, System.currentTimeMillis(), sequenceStatistics.isFault);
+        if (index >= 0) {
+            SequenceStatistics sequenceStatistics = (SequenceStatistics) sequenceStatisticsList.get(index);
+            if (sequenceStatistics != null) {
+                if (sequenceStatistics.isStatisticsEnable && sequenceStatistics.sequenceName
!= null)
+                {
+                    statisticsCollector.reportForSequence(sequenceStatistics.sequenceName,
!sequenceStatistics.isInFlow, sequenceStatistics.initTime, System.currentTimeMillis(), sequenceStatistics.isFault);
+                }
+                sequenceStatisticsList.remove(index);
             }
-            sequenceStatisticsList.remove(index);
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message