示例#1
0
  /**
   * find work site by naming
   *
   * @param naming
   * @return
   */
  public SiteHost[] find(String naming) {
    Naming s = new Naming(naming);

    Logger.info("WorkPool.find, find work site by '%s'", s);

    ArrayList<SiteHost> a = new ArrayList<SiteHost>();
    this.lockSingle();
    try {
      SiteSet set = mapNaming.get(s);
      if (set != null) {
        a.addAll(set.list());
      }
    } catch (Throwable exp) {
      Logger.error(exp);
    } finally {
      this.unlockSingle();
    }

    if (a.isEmpty()) return null;
    SiteHost[] hosts = new SiteHost[a.size()];
    return a.toArray(hosts);
  }
示例#2
0
 /** @return */
 public List<SiteHost> gather() {
   ArrayList<SiteHost> array = new ArrayList<SiteHost>();
   array.addAll(mapSite.keySet());
   return array;
 }