Examples of WeightRandom


Examples of com.taobao.tddl.common.WeightRandom

  public EquityDbManager(Map<String, DataSourceWrapper> dataSourceWrapperMap, Map<String, Integer> weightMap) {
    this.dataSourceMap = new HashMap<String, DataSourceHolder>(dataSourceWrapperMap.size());
    for (Map.Entry<String, DataSourceWrapper> e : dataSourceWrapperMap.entrySet()) {
      this.dataSourceMap.put(e.getKey(), new DataSourceHolder(e.getValue()));
    }
    this.weightRandom = new WeightRandom(weightMap);
  }
View Full Code Here

Examples of com.taobao.tddl.common.WeightRandom

    super.groupExtraConfig = groupExtraConfig;
    this.dataSourceMap = new HashMap<String, DataSourceHolder>(dataSourceWrapperMap.size());
    for (Map.Entry<String, DataSourceWrapper> e : dataSourceWrapperMap.entrySet()) {
      this.dataSourceMap.put(e.getKey(), new DataSourceHolder(e.getValue()));
    }
    this.weightRandom = new WeightRandom(weightMap);
  }
View Full Code Here

Examples of com.taobao.tddl.common.WeightRandom

      int times, Object... args) throws SQLException {
    //�����֧�����ԣ���times��Ϊ1�Ϳ�����
    if (!this.isSupportRetry) {
      times = 1;
    }
    WeightRandom wr = this.weightRandom;
    List<SQLException> exceptions = new ArrayList<SQLException>(0);
    List<String> excludeKeys = new ArrayList<String>(0);
    if (failedDataSources != null) {
      exceptions.addAll(failedDataSources.values());
      times = times - failedDataSources.size(); //�۳��Ѿ�ʧ�ܵ������Դ���
      for (SQLException e : failedDataSources.values()) {
        if (!exceptionSorter.isExceptionFatal(e)) {
          //��һ���쳣����ʵ����������쳣����map�޷�֪��˳��ֻ�ܱ������������ݿⲻ�����쳣�����׳�
          //�Dz���Ӧ���ڷ��ַ����ݿ�fatal֮��������׳��������Ƿŵ�failedDataSources���map��?(guangxia)
          return tryer.onSQLException(exceptions, exceptionSorter, args);
        }
      }
    }
    for (int i = 0; i < times; i++) {
      String name = selectAliveKey(wr, excludeKeys);
      if (name == null) {
        // Ϊ����չ
        exceptions.add(new NoMoreDataSourceException("tryTime:" + i + ", excludeKeys:" + excludeKeys
            + ", weightConfig:" + wr.getWeightConfig()));
        break;
      }

      DataSourceHolder dsHolder = dataSourceMap.get(name);
      if (dsHolder == null) {
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.