示例#1
0
  /**
   * @param host
   * @param notify
   * @return
   */
  private boolean remove(SiteHost host, boolean notify) {
    Logger.info("WorkPool.remove, work site %s", host);

    boolean success = false;
    this.lockSingle();
    try {
      mapTime.remove(host);
      WorkSite site = mapSite.remove(host);
      if (site != null) {
        for (Naming naming : site.list()) {
          SiteSet set = mapNaming.get(naming);
          if (set != null) {
            set.remove(host);
          }
          if (set == null || set.isEmpty()) {
            mapNaming.remove(naming);
          }
        }
        success = true;

        if (notify) {
          CallPool.getInstance().refreshWorkSite();
        }
      }
    } catch (Throwable exp) {
      Logger.error(exp);
    } finally {
      this.unlockSingle();
    }
    return success;
  }