Java Code Examples for com.alipay.sofa.rpc.common.utils.CommonUtils#isNotEmpty()

The following examples show how to use com.alipay.sofa.rpc.common.utils.CommonUtils#isNotEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZookeeperProviderObserver.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
private void notifyListeners(ConsumerConfig config, String providerPath, List<ChildData> currentData, boolean add)
    throws UnsupportedEncodingException {
    List<ProviderInfoListener> providerInfoListeners = providerListenerMap.get(config);
    if (CommonUtils.isNotEmpty(providerInfoListeners)) {
        List<ProviderInfo> providerInfos = ZookeeperRegistryHelper.convertUrlsToProviders(providerPath,
            currentData);
        List<ProviderInfo> providerInfosForProtocol = RegistryUtils.matchProviderInfos(config, providerInfos);
        for (ProviderInfoListener listener : providerInfoListeners) {
            if (add) {
                listener.addProvider(new ProviderGroup(providerInfosForProtocol));
            } else {
                listener.updateProviders(new ProviderGroup(providerInfosForProtocol));
            }
        }
    }
}
 
Example 2
Source File: MockTestRegistry.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
@Override
public void register(ProviderConfig config) {
    String key = buildKey(config);
    ProviderGroup group = memoryCache.get(key);
    if (group == null) {
        group = buildProviderGroup();
        ProviderGroup old = memoryCache.putIfAbsent(key, group);
        if (old != null) {
            group = old;
        }
    }
    List<ServerConfig> serverConfigs = config.getServer();
    if (CommonUtils.isNotEmpty(serverConfigs)) {
        for (ServerConfig server : serverConfigs) {
            group.add(ProviderHelper.toProviderInfo(convertProviderToUrls(config, server)));
        }
    }
    Map<ConsumerConfig, ProviderInfoListener> listeners = notifyListeners.get(key);
    if (listeners != null) {
        for (ProviderInfoListener listener : listeners.values()) {
            listener.updateProviders(group);
        }
    }
}
 
Example 3
Source File: SofaResteasyClientBuilder.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
/**
 * 注册jaxrs Provider
 *
 * @return SofaResteasyClientBuilder
 */
public SofaResteasyClientBuilder registerProvider() {
    ResteasyProviderFactory providerFactory = getProviderFactory();
    // 注册内置
    Set<Class> internalProviderClasses = JAXRSProviderManager.getInternalProviderClasses();
    if (CommonUtils.isNotEmpty(internalProviderClasses)) {
        for (Class providerClass : internalProviderClasses) {
            providerFactory.register(providerClass);
        }
    }
    // 注册自定义
    Set<Object> customProviderInstances = JAXRSProviderManager.getCustomProviderInstances();
    if (CommonUtils.isNotEmpty(customProviderInstances)) {
        for (Object provider : customProviderInstances) {
            PropertyInjector propertyInjector = providerFactory.getInjectorFactory()
                .createPropertyInjector(
                    JAXRSProviderManager.getTargetClass(provider), providerFactory);
            propertyInjector.inject(provider);
            providerFactory.registerProviderInstance(provider);
        }
    }

    return this;
}
 
Example 4
Source File: DefaultConsumerBootstrap.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
@Override
public List<ProviderGroup> subscribe() {
    List<ProviderGroup> result = null;
    String directUrl = consumerConfig.getDirectUrl();
    if (StringUtils.isNotEmpty(directUrl)) {
        // 如果走直连
        result = subscribeFromDirectUrl(directUrl);
    } else {
        // 没有配置url直连
        List<RegistryConfig> registryConfigs = consumerConfig.getRegistry();
        if (CommonUtils.isNotEmpty(registryConfigs)) {
            // 从多个注册中心订阅服务列表
            result = subscribeFromRegistries();
        }
    }
    return result;
}
 
Example 5
Source File: LocalPreferenceLoadBalancer.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
@Override
public ProviderInfo doSelect(SofaRequest invocation, List<ProviderInfo> providerInfos) {
    String localhost = SystemInfo.getLocalHost();
    if (StringUtils.isEmpty(localhost)) {
        return super.doSelect(invocation, providerInfos);
    }
    List<ProviderInfo> localProviderInfo = new ArrayList<ProviderInfo>();
    for (ProviderInfo providerInfo : providerInfos) { // 解析IP,看是否和本地一致
        if (localhost.equals(providerInfo.getHost())) {
            localProviderInfo.add(providerInfo);
        }
    }
    if (CommonUtils.isNotEmpty(localProviderInfo)) { // 命中本机的服务端
        return super.doSelect(invocation, localProviderInfo);
    } else { // 没有命中本机上的服务端
        return super.doSelect(invocation, providerInfos);
    }
}
 
Example 6
Source File: ZookeeperConfigObserver.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
/**
 * 接口配置修改子节点Data列表
 *
 * @param config      接口配置
 * @param configPath  配置Path
 * @param currentData 子节点Data列表
 */
public void updateConfigAll(AbstractInterfaceConfig config, String configPath, List<ChildData> currentData) {
    if (CommonUtils.isEmpty(currentData)) {
        if (LOGGER.isInfoEnabled(config.getAppName())) {
            LOGGER.infoWithApp(config.getAppName(), "Receive updateAll data is null");
        }
    } else {
        if (LOGGER.isInfoEnabled(config.getAppName())) {
            for (ChildData data : currentData) {
                LOGGER.infoWithApp(config.getAppName(), "Receive updateAll data: path=["
                    + data.getPath() + "], data=[" + StringSerializer.decode(data.getData()) + "]"
                    + ", stat=[" + data.getStat() + "]");
            }
        }
        List<ConfigListener> configListeners = configListenerMap.get(config);
        if (CommonUtils.isNotEmpty(configListeners)) {
            List<Map<String, String>> attributes = ZookeeperRegistryHelper.convertConfigToAttributes(configPath,
                currentData);
            for (ConfigListener listener : configListeners) {
                for (Map<String, String> attribute : attributes) {
                    listener.configChanged(attribute);
                }
            }
        }
    }
}
 
Example 7
Source File: ProviderConfig.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
/**
 * 是否有并发控制需求,有就打开过滤器
 * 配置-1关闭并发过滤器,等于0表示开启过滤但是不限制
 *
 * @return 是否配置了concurrents boolean
 */
@Override
public boolean hasConcurrents() {
    if (concurrents > 0) {
        return true;
    }
    if (CommonUtils.isNotEmpty(methods)) {
        for (MethodConfig methodConfig : methods.values()) {
            if (methodConfig.getConcurrents() != null
                && methodConfig.getConcurrents() > 0) {
                return true;
            }
        }
    }
    return false;
}
 
Example 8
Source File: ZookeeperRegistryDataCacheImpl.java    From sofa-dashboard with Apache License 2.0 5 votes vote down vote up
@Override
public List<RpcConsumer> fetchConsumersByService(String serviceName) {
    List<RpcConsumer> result = new ArrayList<>();
    if (StringUtils.isEmpty(serviceName)) {
        return result;
    }
    RpcService rpcService = services.get(serviceName);
    if (rpcService != null) {
        result = consumers.get(rpcService);
        if (CommonUtils.isNotEmpty(result)) {
            return result;
        }
    }
    return result;
}
 
Example 9
Source File: ProviderInfo.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
/**
 * Sets static attribute.
 *
 * @param staticAttrs the static attribute
 * @return the static attribute
 */
public ProviderInfo setStaticAttrs(Map<String, String> staticAttrs) {
    this.staticAttrs.clear();
    if (CommonUtils.isNotEmpty(staticAttrs)) {
        this.staticAttrs.putAll(staticAttrs);
    }
    return this;
}
 
Example 10
Source File: ZookeeperConfigObserver.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
private void notifyListeners(AbstractInterfaceConfig config, String configPath, ChildData data, boolean removeType) {
    List<ConfigListener> configListeners = configListenerMap.get(config);
    if (CommonUtils.isNotEmpty(configListeners)) {
        //转换子节点Data为接口级配置<配置属性名,配置属性值>,例如<timeout,200>
        Map<String, String> attribute = ZookeeperRegistryHelper.convertConfigToAttribute(configPath, data,
            removeType);
        for (ConfigListener listener : configListeners) {
            listener.configChanged(attribute);
        }
    }
}
 
Example 11
Source File: RouterChain.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
/**
 * 判断是否需要排除系统过滤器
 *
 * @param customRouters 自定义Router
 * @return 是否排除
 */
private static HashSet<String> parseExcludeRouter(List<Router> customRouters) {
    HashSet<String> excludeKeys = new HashSet<String>();
    if (CommonUtils.isNotEmpty(customRouters)) {
        for (Router router : customRouters) {
            if (router instanceof ExcludeRouter) {
                // 存在需要排除的过滤器
                ExcludeRouter excludeRouter = (ExcludeRouter) router;
                String excludeName = excludeRouter.getExcludeName();
                if (StringUtils.isNotEmpty(excludeName)) {
                    String excludeRouterName = startsWithExcludePrefix(excludeName) ? excludeName.substring(1)
                        : excludeName;
                    if (StringUtils.isNotEmpty(excludeRouterName)) {
                        excludeKeys.add(excludeRouterName);
                    }
                }
                customRouters.remove(router);
            }
        }
    }
    if (!excludeKeys.isEmpty()) {
        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Find exclude routers: {}", excludeKeys);
        }
    }
    return excludeKeys;
}
 
Example 12
Source File: BaggageResolver.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
/**
 * 从请求里获取透传数据
 *
 * @param context RpcInvokeContext
 * @param request 请求
 * @param init    传入上下文为空时,是否初始化
 */
public static void pickupFromRequest(RpcInvokeContext context, SofaRequest request, boolean init) {
    if (context == null && !init) {
        return;
    }
    // 解析请求 
    Map<String, String> requestBaggage = (Map<String, String>) request
        .getRequestProp(RemotingConstants.RPC_REQUEST_BAGGAGE);
    if (CommonUtils.isNotEmpty(requestBaggage)) {
        if (context == null) {
            context = RpcInvokeContext.getContext();
        }
        context.putAllRequestBaggage(requestBaggage);
    }
}
 
Example 13
Source File: SofaRegistryHelper.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
/**
 * 解析服务地址列表,从字符串,统一适配到ProviderInfo对象
 *
 * @param urls 地址列表
 * @return 地址列表,最多为空,不会返回null
 */
public static List<ProviderInfo> parseProviderInfos(List<String> urls) {
    List<ProviderInfo> providers = new ArrayList<ProviderInfo>();
    if (CommonUtils.isNotEmpty(urls)) {
        for (String object : urls) {
            providers.add(parseProviderInfo(object));
        }
    }
    return providers;
}
 
Example 14
Source File: EventBus.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
/**
 * 给事件总线中丢一个事件
 *
 * @param event 事件
 */
public static void post(final Event event) {
    if (!isEnable()) {
        return;
    }
    CopyOnWriteArraySet<Subscriber> subscribers = SUBSCRIBER_MAP.get(event.getClass());
    if (CommonUtils.isNotEmpty(subscribers)) {
        for (final Subscriber subscriber : subscribers) {
            if (subscriber.isSync()) {
                handleEvent(subscriber, event);
            } else { // 异步
                final RpcInternalContext context = RpcInternalContext.peekContext();
                final ThreadPoolExecutor asyncThreadPool = AsyncRuntime.getAsyncThreadPool();
                try {
                    asyncThreadPool.execute(
                        new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    RpcInternalContext.setContext(context);
                                    handleEvent(subscriber, event);
                                } finally {
                                    RpcInternalContext.removeContext();
                                }
                            }
                        });
                } catch (RejectedExecutionException e) {
                    LOGGER
                        .warn("This queue is full when post event to async execute, queue size is " +
                            asyncThreadPool.getQueue().size() +
                            ", please optimize this async thread pool of eventbus.");
                }
            }
        }
    }
}
 
Example 15
Source File: RpcConfigs.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
/**
 * Put value.
 *
 * @param key      the key
 * @param newValue the new value
 */
public static void putValue(String key, Object newValue) {
    Object oldValue = CFG.get(key);
    if (changed(oldValue, newValue)) {
        CFG.put(key, newValue);
        List<RpcConfigListener> rpcConfigListeners = CFG_LISTENER.get(key);
        if (CommonUtils.isNotEmpty(rpcConfigListeners)) {
            for (RpcConfigListener rpcConfigListener : rpcConfigListeners) {
                rpcConfigListener.onChange(oldValue, newValue);
            }
        }
    }
}
 
Example 16
Source File: FilterChain.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
/**
 * 判断是否需要排除自定义过滤器
 *
 * @param customFilters 自定义filter列表
 * @return 需要排除的过滤器的key列表
 */
private static HashSet<String> parseExcludeFilter(List<Filter> customFilters) {
    HashSet<String> excludeKeys = new HashSet<String>();
    if (CommonUtils.isNotEmpty(customFilters)) {
        for (Filter filter : customFilters) {
            if (filter instanceof ExcludeFilter) {
                // 存在需要排除的过滤器
                ExcludeFilter excludeFilter = (ExcludeFilter) filter;
                String excludeName = excludeFilter.getExcludeName();
                if (StringUtils.isNotEmpty(excludeName)) {
                    String excludeFilterName = startsWithExcludePrefix(excludeName) ?
                        excludeName.substring(1)
                        : excludeName;
                    if (StringUtils.isNotEmpty(excludeFilterName)) {
                        excludeKeys.add(excludeFilterName);
                    }
                }
                customFilters.remove(filter);
            }
        }
    }
    if (!excludeKeys.isEmpty()) {
        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Find exclude filters: {}", excludeKeys);
        }
    }
    return excludeKeys;
}
 
Example 17
Source File: MockTestRegistry.java    From sofa-rpc with Apache License 2.0 4 votes vote down vote up
/**
 * Convert provider to url.
 *
 * @param providerConfig the ProviderConfig
 * @return the url list
 */
public static String convertProviderToUrls(ProviderConfig providerConfig, ServerConfig server) {
    StringBuilder sb = new StringBuilder(200);
    String appName = providerConfig.getAppName();
    String host = server.getVirtualHost(); // 虚拟ip
    if (host == null) {
        host = server.getHost();
        if (NetUtils.isLocalHost(host) || NetUtils.isAnyHost(host)) {
            host = SystemInfo.getLocalHost();
        }
    } else {
        if (LOGGER.isWarnEnabled(appName)) {
            LOGGER.warnWithApp(appName,
                "Virtual host is specified, host will be change from {} to {} when register",
                server.getHost(), host);
        }
    }
    Integer port = server.getVirtualPort(); // 虚拟port
    if (port == null) {
        port = server.getPort();
    } else {
        if (LOGGER.isWarnEnabled(appName)) {
            LOGGER.warnWithApp(appName,
                "Virtual port is specified, host will be change from {} to {} when register",
                server.getPort(), port);
        }
    }

    String protocol = server.getProtocol();
    sb.append(host).append(":").append(port).append(server.getContextPath());
    sb.append("?").append(ATTR_RPC_VERSION).append("=").append(Version.RPC_VERSION);
    sb.append(getKeyPairs(ATTR_SERIALIZATION, providerConfig.getSerialization()));
    sb.append(getKeyPairs(ATTR_WEIGHT, providerConfig.getWeight()));
    if (providerConfig.getTimeout() > 0) {
        sb.append(getKeyPairs(ATTR_TIMEOUT, providerConfig.getTimeout()));
    }
    sb.append(getKeyPairs(ATTR_APP_NAME, appName));
    sb.append(getKeyPairs(ATTR_WARMUP_TIME, providerConfig.getParameter(ATTR_WARMUP_TIME.toString())));
    sb.append(getKeyPairs(ATTR_WARMUP_WEIGHT, providerConfig.getParameter(ATTR_WARMUP_WEIGHT.toString())));

    Map<String, MethodConfig> methodConfigs = providerConfig.getMethods();
    if (CommonUtils.isNotEmpty(methodConfigs)) {
        for (Map.Entry<String, MethodConfig> entry : methodConfigs.entrySet()) {
            String methodName = entry.getKey();
            MethodConfig methodConfig = entry.getValue();
            sb.append(getKeyPairs("." + methodName + "." + ATTR_TIMEOUT, methodConfig.getTimeout()));

            // 方法级配置,只能放timeout 
            String key = "[" + methodName + "]";
            String value = "[clientTimeout" + "#" + methodConfig.getTimeout() + "]";
            sb.append(getKeyPairs(key, value));
        }
    }
    sb.append(getKeyPairs(ATTR_START_TIME, RpcRuntimeContext.now()));
    return sb.toString();
}
 
Example 18
Source File: ProviderHelper.java    From sofa-rpc with Apache License 2.0 4 votes vote down vote up
/**
 * Compare two provider group list, return add list and remove list
 *
 * @param oldGroups old provider group list
 * @param newGroups new provider group list
 * @param add       provider list need add
 * @param remove    provider list need remove
 */
public static void compareGroups(List<ProviderGroup> oldGroups, List<ProviderGroup> newGroups,
                                 List<ProviderInfo> add,
                                 List<ProviderInfo> remove) {
    // 比较老列表和当前列表
    if (CommonUtils.isEmpty(oldGroups)) {
        // 空变成非空
        if (CommonUtils.isNotEmpty(newGroups)) {
            for (ProviderGroup newGroup : newGroups) {
                add.addAll(newGroup.getProviderInfos());
            }
        }
        // 空到空,忽略
    } else {
        // 非空变成空
        if (CommonUtils.isEmpty(newGroups)) {
            for (ProviderGroup oldGroup : oldGroups) {
                remove.addAll(oldGroup.getProviderInfos());
            }
        } else {
            // 非空变成非空,比较
            if (CommonUtils.isNotEmpty(oldGroups)) {
                Map<String, List<ProviderInfo>> oldMap = convertToMap(oldGroups);
                Map<String, List<ProviderInfo>> mapTmp = convertToMap(newGroups);
                // 遍历新的
                for (Map.Entry<String, List<ProviderInfo>> oldEntry : oldMap.entrySet()) {
                    String key = oldEntry.getKey();
                    List<ProviderInfo> oldList = oldEntry.getValue();
                    if (mapTmp.containsKey(key)) {
                        // 老的有,新的也有,比较变化的部分
                        final List<ProviderInfo> newList = mapTmp.remove(key);
                        compareProviders(oldList, newList, add, remove);
                        mapTmp.remove(key);
                    } else {
                        // 老的有,新的没有
                        remove.addAll(oldList);
                    }
                }
                // 新的有,老的没有
                for (Map.Entry<String, List<ProviderInfo>> entry : mapTmp.entrySet()) {
                    add.addAll(entry.getValue());
                }
            }
        }
    }
}
 
Example 19
Source File: FilterChain.java    From sofa-rpc with Apache License 2.0 4 votes vote down vote up
/**
 * 获取真正的过滤器列表
 *
 * @param config            provider配置或者consumer配置
 * @param autoActiveFilters 系统自动激活的过滤器映射
 * @return 真正的过滤器列表
 */
private static List<Filter> selectActualFilters(AbstractInterfaceConfig config,
                                                Map<String, ExtensionClass<Filter>> autoActiveFilters) {
    /*
     * 例如自动装载扩展 A(a),B(b),C(c)  filter=[-a,d]  filterRef=[new E, new Exclude(b)]
     * 逻辑如下:
     * 1.解析config.getFilterRef(),记录E和-b
     * 2.解析config.getFilter()字符串,记录 d 和 -a,-b
     * 3.再解析自动装载扩展,a,b被排除了,所以拿到c,d
     * 4.对c d进行排序
     * 5.拿到C、D实现类
     * 6.加上自定义,返回C、D、E
     */
    // 用户通过自己new实例的方式注入的filter,优先级高
    List<Filter> customFilters = config.getFilterRef() == null ?
        new ArrayList<Filter>() : new CopyOnWriteArrayList<Filter>(config.getFilterRef());
    // 先解析是否有特殊处理
    HashSet<String> excludes = parseExcludeFilter(customFilters);

    // 准备数据:用户通过别名的方式注入的filter,需要解析
    List<ExtensionClass<Filter>> extensionFilters = new ArrayList<ExtensionClass<Filter>>();
    List<String> filterAliases = config.getFilter(); //
    if (CommonUtils.isNotEmpty(filterAliases)) {
        for (String filterAlias : filterAliases) {
            if (startsWithExcludePrefix(filterAlias)) { // 排除用的特殊字符
                excludes.add(filterAlias.substring(1));
            } else {
                ExtensionClass<Filter> filter = EXTENSION_LOADER.getExtensionClass(filterAlias);
                if (filter != null) {
                    extensionFilters.add(filter);
                }
            }
        }
    }
    // 解析自动加载的过滤器
    if (!excludes.contains(StringUtils.ALL) && !excludes.contains(StringUtils.DEFAULT)) { // 配了-*和-default表示不加载内置
        for (Map.Entry<String, ExtensionClass<Filter>> entry : autoActiveFilters.entrySet()) {
            if (!excludes.contains(entry.getKey())) {
                extensionFilters.add(entry.getValue());
            }
        }
    }
    // 按order从小到大排序
    if (extensionFilters.size() > 1) {
        Collections.sort(extensionFilters, new OrderedComparator<ExtensionClass<Filter>>());
    }
    List<Filter> actualFilters = new ArrayList<Filter>();
    for (ExtensionClass<Filter> extensionFilter : extensionFilters) {
        actualFilters.add(extensionFilter.getExtInstance());
    }
    // 加入自定义的过滤器
    actualFilters.addAll(customFilters);
    return actualFilters;
}
 
Example 20
Source File: ServiceHorizontalMeasureStrategy.java    From sofa-rpc with Apache License 2.0 4 votes vote down vote up
@Override
public MeasureResult measure(MeasureModel measureModel) {

    MeasureResult measureResult = new MeasureResult();
    measureResult.setMeasureModel(measureModel);

    String appName = measureModel.getAppName();
    List<InvocationStat> stats = measureModel.getInvocationStats();
    if (!CommonUtils.isNotEmpty(stats)) {
        return measureResult;
    }

    //如果有被新剔除的InvocationStat,则不会存在于该次获取结果中。
    List<InvocationStat> invocationStats = getInvocationStatSnapshots(stats);

    long timeWindow = FaultToleranceConfigManager.getTimeWindow(appName);
    /* leastWindowCount在同一次度量中保持不变*/
    long leastWindowCount = FaultToleranceConfigManager.getLeastWindowCount(appName);
    leastWindowCount = leastWindowCount < LEGAL_LEAST_WINDOW_COUNT ? LEGAL_LEAST_WINDOW_COUNT
        : leastWindowCount;

    /* 计算平均异常率和度量单个ip的时候都需要使用到appWeight*/
    double averageExceptionRate = calculateAverageExceptionRate(invocationStats, leastWindowCount);

    double leastWindowExceptionRateMultiple = FaultToleranceConfigManager
        .getLeastWindowExceptionRateMultiple(appName);

    for (InvocationStat invocationStat : invocationStats) {
        MeasureResultDetail measureResultDetail = null;
        InvocationStatDimension statDimension = invocationStat.getDimension();

        long windowCount = invocationStat.getInvokeCount();
        long invocationLeastWindowCount = getInvocationLeastWindowCount(invocationStat,
            ProviderInfoWeightManager.getWeight(statDimension.getProviderInfo()),
            leastWindowCount);
        if (averageExceptionRate == -1) {
            measureResultDetail = new MeasureResultDetail(statDimension, MeasureState.IGNORE);
        } else {
            if (invocationLeastWindowCount != -1 && windowCount >= invocationLeastWindowCount) {
                double windowExceptionRate = invocationStat.getExceptionRate();
                if (averageExceptionRate == 0) {
                    measureResultDetail = new MeasureResultDetail(statDimension, MeasureState.HEALTH);
                } else {
                    double windowExceptionRateMultiple = CalculateUtils.divide(
                        windowExceptionRate, averageExceptionRate);
                    measureResultDetail = windowExceptionRateMultiple >= leastWindowExceptionRateMultiple ?
                        new MeasureResultDetail(statDimension, MeasureState.ABNORMAL) :
                        new MeasureResultDetail(statDimension, MeasureState.HEALTH);
                }
                measureResultDetail.setAbnormalRate(windowExceptionRate);
                measureResultDetail.setAverageAbnormalRate(averageExceptionRate);
                measureResultDetail.setLeastAbnormalRateMultiple(leastWindowExceptionRateMultiple);
            } else {
                measureResultDetail = new MeasureResultDetail(statDimension, MeasureState.IGNORE);
            }
        }

        measureResultDetail.setWindowCount(windowCount);
        measureResultDetail.setTimeWindow(timeWindow);
        measureResultDetail.setLeastWindowCount(invocationLeastWindowCount);
        measureResult.addMeasureDetail(measureResultDetail);
    }

    logMeasureResult(measureResult, timeWindow, leastWindowCount, averageExceptionRate,
        leastWindowExceptionRateMultiple);

    InvocationStatFactory.updateInvocationStats(invocationStats);
    return measureResult;
}