[wsas-java-dev] svn commit r9642 -
branches/wsas/java/2.1/commons/throttle/src/main/java/org/wso2/throttle/module/handler
svn at wso2.org
svn at wso2.org
Sun Nov 11 19:58:39 PST 2007
Author: indika
Date: Sun Nov 11 19:58:33 2007
New Revision: 9642
Modified:
branches/wsas/java/2.1/commons/throttle/src/main/java/org/wso2/throttle/module/handler/ThrottleHandler.java
Log:
avoid possible concurrency issues
Modified: branches/wsas/java/2.1/commons/throttle/src/main/java/org/wso2/throttle/module/handler/ThrottleHandler.java
==============================================================================
--- branches/wsas/java/2.1/commons/throttle/src/main/java/org/wso2/throttle/module/handler/ThrottleHandler.java (original)
+++ branches/wsas/java/2.1/commons/throttle/src/main/java/org/wso2/throttle/module/handler/ThrottleHandler.java Sun Nov 11 19:58:33 2007
@@ -45,6 +45,17 @@
*/
protected abstract int getThrottleType();
+ private AccessController accessController;
+
+ public ThrottleHandler() {
+ try {
+ accessController = AccessControllerFactory.createAccessControler(ThrottleConstants.IP_BASE);
+ } catch (ThrottleException e) {
+ String msg = "Error occurred when creating accesscontroller. Handler initiating was failed.";
+ log.error(msg, e);
+ throw new InstantiationError(msg);
+ }
+ }
/**
* Load to throttle metadata for a particular throttle
*
@@ -53,6 +64,7 @@
* @return IPBaseThrottleConfiguration - The IPBaseThrottleConfiguration - load from AxisConfiguration
* @throws AxisFault
*/
+
public Throttle loadThrottle(MessageContext messageContext,
int throttleType) throws AxisFault, ThrottleException {
@@ -138,7 +150,6 @@
if (throttleContext == null) {
throw new AxisFault("Could not find the Throttle Context for IPBased Thottling");
}
- AccessController accessController = AccessControllerFactory.createAccessControler(ThrottleConstants.IP_BASE);
if (!accessController.canAccess(throttleContext, remoteIP)) {
throw new AxisFault("You cannot access this service since you have" +
" exceeded the allocated quota.");
More information about the Wsas-java-dev
mailing list