コード例 #1
0
ファイル: P2PNetwork.java プロジェクト: Mars-Albert/osnvodsim
  public static void printOverlay() {
    // 输出服务器繁忙率
    Iterator<Server> its = Servers.iterator();
    Server tmp;
    while (its.hasNext()) {
      tmp = its.next();
      Output.printSTAT(
          "server"
              + tmp.getServerID()
              + ": percentage of busy time: "
              + Utilities.displayPercentage(tmp.getUtilizationRate())
              + "%");
    }

    // 输出每个Overlay信息。
    Iterator<Overlay> ito = p2pOverlay.iterator();

    while (ito.hasNext()) {
      ito.next().printInfo();
    }
  }
コード例 #2
0
ファイル: P2PNetwork.java プロジェクト: Mars-Albert/osnvodsim
  public static void dropService(User who) {

    Iterator<Video> itvr = who.getPlayedIterator();
    while (itvr.hasNext()) {
      getOverlay(itvr.next()).leaveOverlay(who);
    }
    who.leave();

    who.getPeer().destroy();

    Output.printTrack(
        who,
        "User"
            + who.getUserID()
            + " stayed in system for:"
            + Utilities.displayDouble(who.getLeaveTime() - who.getInitTime())
            + " network overload:"
            + Utilities.displayPercentage(who.getPeer().networkOverload())
            + "% be interrupted:"
            + who.getInterruptedTime()
            + "s");
    Output.stopTracing(who);
  }