You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ru...@apache.org on 2009/08/01 09:07:29 UTC

svn commit: r799812 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints: AbstractEndpoint.java IndirectEndpoint.java LoadbalanceEndpoint.java

Author: ruwan
Date: Sat Aug  1 07:07:28 2009
New Revision: 799812

URL: http://svn.apache.org/viewvc?rev=799812&view=rev
Log:
Fixing the logs and minor code refactoring

Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AbstractEndpoint.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AbstractEndpoint.java?rev=799812&r1=799811&r2=799812&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AbstractEndpoint.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AbstractEndpoint.java Sat Aug  1 07:07:28 2009
@@ -158,9 +158,7 @@
 
         if (children != null) {
             for (Endpoint e : children) {
-                if (e instanceof ManagedLifecycle) {
-                    ((ManagedLifecycle) e).init(synapseEnvironment);
-                }
+                e.init(synapseEnvironment);
             }
         }
     }
@@ -241,8 +239,9 @@
             } else {
                 if (definition.getTimeoutErrorCodes().contains(errorCode)) {
                     if (log.isDebugEnabled()) {
-                        log.debug("Encountered a mark for suspension error : " + errorCode + " defined " +
-                            "error codes are : " + definition.getTimeoutErrorCodes());    
+                        log.debug("Encountered a mark for suspension error : " + errorCode
+                                + " defined " + "error codes are : "
+                                + definition.getTimeoutErrorCodes());    
                     }
                     return true;
                 }
@@ -250,8 +249,8 @@
         }
 
         if (log.isDebugEnabled()) {
-            log.debug("Encountered a non-timeout error sending to endpoint : " + endpointName +
-                " error code : " + errorCode);
+            log.debug("Encountered a non-timeout error sending to " + this.toString() +
+                ", error code : " + errorCode);
         }
         return false;
     }
@@ -267,7 +266,7 @@
             if (definition.getSuspendErrorCodes().isEmpty()) {
                 // if suspend codes are not defined, any error will be fatal for the endpoint
                 if (log.isDebugEnabled()) {
-                    log.debug("Endpoint : " + endpointName + " encountered a fatal error : " + errorCode);
+                    log.debug(this.toString() + " encountered a fatal error : " + errorCode);
                 }
                 return true;
 
@@ -283,8 +282,9 @@
         }
 
         if (log.isDebugEnabled()) {
-            log.debug("Encountered a non-fatal error sending to endpoint : " + endpointName +
-                " error code : " + errorCode + " Error will be handled, but endpoint will not fail");
+            log.debug("Encountered a non-fatal error sending to " + this.toString()
+                    + ", error code : " + errorCode
+                    + ". Error will be handled, but endpoint will not fail");
         }
         return false;
     }
@@ -380,9 +380,10 @@
 
     protected void logOnChildEndpointFail(Endpoint endpoint, MessageContext synMessageContext) {
         if (log.isDebugEnabled()) {
-            log.debug(this + " Detect a Failure in a child endpoint : " + endpoint);
-            log.debug(this + " Retry Attempt for Request with [Message ID : " + synMessageContext.getMessageID()
-                    + "], [To : " + synMessageContext.getTo() + "]");
+            log.debug(this.toString() + " detected a failure in a child endpoint : " + endpoint);
+            log.debug(this.toString() + " retrying request [[Message ID : "
+                    + synMessageContext.getMessageID() + "], [To : "
+                    + synMessageContext.getTo() + "]]");
         }
     }
 

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java?rev=799812&r1=799811&r2=799812&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java Sat Aug  1 07:07:28 2009
@@ -110,7 +110,7 @@
 
     @Override
     public String toString() {
-        return "[Indirect Endpoint [ " + key + "]]";
+        return "Indirect Endpoint [" + key + "]";
     }
 
     /**

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java?rev=799812&r1=799811&r2=799812&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java Sat Aug  1 07:07:28 2009
@@ -61,7 +61,7 @@
     public void send(MessageContext synCtx) {
 
         if (log.isDebugEnabled()) {
-            log.debug("Load-balance Endpoint :  " + getName());
+            log.debug("Sending using Load-balance " + toString());
         }
 
         Endpoint endpoint = getNextChild(synCtx); 
@@ -85,8 +85,8 @@
 
         } else {
             // if this is not a retry
-            informFailure(synCtx, SynapseConstants.ENDPOINT_LB_NONE_READY, "Loadbalance endpoint : " +
-                    getName() + " - no ready child endpoints");
+            informFailure(synCtx, SynapseConstants.ENDPOINT_LB_NONE_READY,
+                    "Load-balance " + this.toString() + " - no child endpoints at ready state");
         }
     }
 
@@ -102,13 +102,15 @@
         for (Endpoint endpoint : getChildren()) {
             if (endpoint.readyToSend()) {
                 if (log.isDebugEnabled()) {
-                    log.debug("Endpoint : " + getName() + " has at least one ready endpoint");
+                    log.debug("Load-balance " + this.toString()
+                            + " has at least one endpoint at ready state");
                 }
                 return true;
             }
         }
 
-        log.warn("Endpoint : " + getName() + " has no ready endpoints to process message");
+        log.warn("Load-balance " + this.toString()
+                + " has no endpoints at ready state to process message");
 
         return false;
     }
@@ -146,7 +148,7 @@
 
     public void setAlgorithm(LoadbalanceAlgorithm algorithm) {
         if (log.isDebugEnabled()) {
-            log.debug("Endpoint : " + getName() + " will be using the "
+            log.debug("Load-balance " + this.toString() + " will be using the algorithm "
                 + algorithm.getName() + " for load distribution");
         }
         this.algorithm = algorithm;