Example #1
0
  public void messageIn(Message m) {
    if (m instanceof Reply) {
      if (m.getDest().equals(this.getSOID())) {
        WebSim.traceObjectOperation("Client", getName(), "Recieved reply " + m);

        in++;
        replies.add(((Reply) m).requestTimeToNow());
      } else {
        WebSim.warning(
            "There is probably a routing error in your system specification.\n"
                + "Client "
                + getName()
                + " has recieved a reply destined for  "
                + m.getDest()
                + "\n"
                + "It will be ignored.");

        faultyIn++;
      }
    } else if (m instanceof Refusal) {
      WebSim.traceObjectOperation("Client", getName(), "Recieved refusal " + m);
      refusals++;
    } else {
      WebSim.warning(
          "WARNING: There is probably a routing error in your system specification.\n"
              + "Client "
              + getName()
              + " has recieved the message  "
              + m
              + "\n"
              + "It will be ignored.");

      faultyIn++;
    }
  }
Example #2
0
  public void runProcess() throws InterruptedException {
    while (true) {
      hold(interarrivalTime.next());

      SystemObjectID destination = destinations[random.nextInt(destinations.length)];

      String fileName =
          WebSim.isTraceObjectOperation()
              ? "/testFile_" + random.nextInt(FILE_RANDOM_NAME_EXCLUSIVEMAX) + ".html"
              : "/testFile_uncalculated.html";

      Request r = new Request(fileName, this.getSOID(), destination);

      WebSim.traceObjectOperation("Client", getName(), "Created " + r + ": finding route.");

      Connection c = findRoute(r);

      if (c != null) {
        WebSim.traceObjectOperation("Client", getName(), "Route found. Sending " + r + " via " + c);
        c.sendMessageVia(r);
        out++;
      }
    }
  }