synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ind...@apache.org
Subject svn commit: r592020 - /webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
Date Mon, 05 Nov 2007 14:43:26 GMT
Author: indika
Date: Mon Nov  5 06:43:26 2007
New Revision: 592020

URL: http://svn.apache.org/viewvc?rev=592020&view=rev
Log:
fixed NPE issue in throttle mediator

Modified:
    webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java

Modified: webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java?rev=592020&r1=592019&r2=592020&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
(original)
+++ webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/throttle/ThrottleMediator.java
Mon Nov  5 06:43:26 2007
@@ -352,32 +352,34 @@
                 }
             }
 
-            includesIPThrottling = (
-                throttle.getThrottleContext(ThrottleConstants.IP_BASED_THROTTLE_KEY) != null);
+            if (throttle != null) {
 
-            if (id != null) {
-                concurrentAccessController = throttle.getConcurrentAccessController();
-                concurrentLimit = concurrentAccessController.getLimit();
+                includesIPThrottling = (
+                    throttle.getThrottleContext(ThrottleConstants.IP_BASED_THROTTLE_KEY)
!= null);
 
-                if (traceOrDebugOn) {
-                    traceOrDebug(traceOn,
-                        "Initiating ConcurrentAccessControler for throttle group id : " +
id
-                            + " limit : " + concurrentLimit);
-                }
-                
-                org.apache.axis2.context.MessageContext axis2MessageContext
-                    = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
-                ConfigurationContext configctx = axis2MessageContext.getConfigurationContext();
-                Map accessContollers = (Map) configctx.getProperty(KEY);
+                if (id != null) {
+                    concurrentAccessController = throttle.getConcurrentAccessController();
 
-                if(accessContollers == null){
-                    accessContollers = new HashMap();
-                    configctx.setProperty(KEY,accessContollers);
-                }
-                if (concurrentAccessController == null) {
-                    accessContollers.remove(id);
-                } else {
-                    accessContollers.put(id, concurrentAccessController);
+                    org.apache.axis2.context.MessageContext axis2MessageContext
+                        = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
+                    ConfigurationContext configctx = axis2MessageContext.getConfigurationContext();
+                    Map accessContollers = (Map) configctx.getProperty(KEY);
+
+                    if (accessContollers == null) {
+                        accessContollers = new HashMap();
+                        configctx.setProperty(KEY, accessContollers);
+                    }
+                    if (concurrentAccessController == null) {
+                        accessContollers.remove(id);
+                    } else {
+                        concurrentLimit = concurrentAccessController.getLimit();
+                        if (traceOrDebugOn) {
+                            traceOrDebug(traceOn,
+                                "Initiating ConcurrentAccessControler for throttle group
id : " + id
+                                    + " limit : " + concurrentLimit);
+                        }
+                        accessContollers.put(id, concurrentAccessController);
+                    }
                 }
             }
         }



---------------------------------------------------------------------
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