Examples of TenantThrottlingInfo


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

        }
        CurrentSession.setAttribute(StratosConstants.REGISTRY_ACTION_VALIDATED_SESSION_ATTR, true);

        int tenantId = CurrentSession.getTenantId();

        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: " +
View Full Code Here

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

        } catch (Exception e1) {
            String msg = "Error in executing the throttling rules in manager.";
            log.error(msg + " tenantId: " + tenantId + ".", e1);
            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);
View Full Code Here

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

                    } else {
                        //check weather request come to webapps
                        if (CONTEXT_WEBAPPS.equals(urlContext)) {
                            //if tenant is active we will throttle other parameters such as bandwidth in/out
                            try {
                                TenantThrottlingInfo throttlingInfo =
                                        throttlingAgent.getThrottlingInfoCache().
                                                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);
View Full Code Here

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

                                    .generateIsBlockedPropertyKey(action));

                    String blockMessage =
                            tenantValidationInfoResource.getProperty(MeteringAccessValidationUtils
                                    .generateErrorMsgPropertyKey(action));
                    TenantThrottlingInfo tenantThrottlingInfo = throttlingInfoCache.getTenantThrottlingInfo(tenantId);
                    if (tenantThrottlingInfo == null) {
                        throttlingInfoCache.addTenant(tenantId);
                        tenantThrottlingInfo = throttlingInfoCache.getTenantThrottlingInfo(tenantId);
                    }
                    tenantThrottlingInfo.updateThrottlingActionInfo(action,
                            new ThrottlingActionInfo("true".equals(blocked), blockMessage));
                }
            }
        } catch (RegistryException re) {
            String msg =
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.