Examples of ThrottlingActionInfo


Examples of org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo

        TenantThrottlingInfo tenantThrottlingInfo =
                ThrottlingAgentServiceComponent.getThrottlingAgent().getThrottlingInfoCache()
                        .getTenantThrottlingInfo(tenantId);
        if(tenantThrottlingInfo!=null){
            ThrottlingActionInfo actionInfo = tenantThrottlingInfo.getThrottlingActionInfo(action);

            if (actionInfo != null && actionInfo.isBlocked()) {
                String blockedMsg = actionInfo.getMessage();
                String msg =
                        "The throttling action is blocked. message: " + blockedMsg + ", action: " +
                                action + ".";
                log.error(msg);
                // we are only throwing the blocked exception, as it is a error
View Full Code Here

Examples of org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo

        String[] actions = new String[]{StratosConstants.THROTTLING_SERVICE_IN_BANDWIDTH_ACTION,
                                        StratosConstants.THROTTLING_SERVICE_OUT_BANDWIDTH_ACTION,
                                        StratosConstants.THROTTLING_SERVICE_REQUEST_ACTION,
                                        StratosConstants.THROTTLING_SERVICE_RESPONSE_ACTION
                                        };
        ThrottlingActionInfo actionInfo = throttlingInfoCache.getTenantThrottlingInfo(tenantId).getThrottlingActionInfo(actions);

        if (actionInfo.isBlocked()) {
            String blockedMsg = actionInfo.getMessage();
            String msg = "The throttling action is blocked. message: " + blockedMsg;
            log.error(msg);
            // we are only throwing the blocked exception, as it is a error message for the user
            throw new AxisFault(blockedMsg);
        }
View Full Code Here

Examples of org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo

            throw new UserStoreException(msg, e1);
        }
        TenantThrottlingInfo throttlingInfo = ThrottlingAgentServiceComponent.getThrottlingAgent()
                .getThrottlingInfoCache().getTenantThrottlingInfo(tenantId);
        if(throttlingInfo!=null){
            ThrottlingActionInfo actionInfo = throttlingInfo.getThrottlingActionInfo(StratosConstants.THROTTLING_ADD_USER_ACTION);

            if (actionInfo!=null && actionInfo.isBlocked()) {
                String blockedMsg = actionInfo.getMessage();
                String msg = "The add user action is blocked. message: " + blockedMsg + ".";
                log.error(msg);
                // we are only throwing the blocked exception, as it is a error message for the user
                throw new UserStoreException(blockedMsg);
            }
View Full Code Here

Examples of org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo

                                                getTenantThrottlingInfo(tenantId);
                                if (throttlingInfo != null) {
                                    String[] actions =
                                            new String[]{StratosConstants.THROTTLING_WEBAPP_IN_BANDWIDTH_ACTION,
                                                         StratosConstants.THROTTLING_WEBAPP_OUT_BANDWIDTH_ACTION};
                                    ThrottlingActionInfo actionInfo;

                                    actionInfo = throttlingInfo.getThrottlingActionInfo(actions);
                                    if (actionInfo != null && actionInfo.isBlocked()) {
                                        String blockedMsg = actionInfo.getMessage();
                                        String msg = "This action is blocked. Reason: "
                                                     + blockedMsg;
                                        log.error(msg);
                                        response.sendError(509, msg);
                                    }
                                }
                            } catch (Exception ex) {
                                String msg = "Error in sending throttling rule violation message." +
                                             " Tenant Domain: " + tenantDomainName;
                                log.error(msg, ex);
                                return;
                            }
                        } else if (CONTEXT_SERVICES.equals(urlContext)) {
                            try {
                                TenantThrottlingInfo throttlingInfo =
                                        throttlingAgent.getThrottlingInfoCache().
                                                getTenantThrottlingInfo(tenantId);
                                if (throttlingInfo != null) {
                                    String[] actions =
                                            new String[]{StratosConstants.THROTTLING_SERVICE_IN_BANDWIDTH_ACTION,
                                                         StratosConstants.THROTTLING_SERVICE_OUT_BANDWIDTH_ACTION};
                                    ThrottlingActionInfo actionInfo;

                                    actionInfo = throttlingInfo.getThrottlingActionInfo(actions);
                                    if (actionInfo != null && actionInfo.isBlocked()) {
                                        String blockedMsg = actionInfo.getMessage();
                                        String msg = "This action is blocked. Reason: " +
                                                     blockedMsg;
                                        log.error(msg);
                                        response.sendError(509, msg);
                                    }
View Full Code Here

Examples of org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo

                    if (tenantThrottlingInfo == null) {
                        throttlingInfoCache.addTenant(tenantId);
                        tenantThrottlingInfo = throttlingInfoCache.getTenantThrottlingInfo(tenantId);
                    }
                    tenantThrottlingInfo.updateThrottlingActionInfo(action,
                            new ThrottlingActionInfo("true".equals(blocked), blockMessage));
                }
            }
        } catch (RegistryException re) {
            String msg =
                    "Error while getting throttling info for tenant " + tenantId + ".";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.