コード例 #1
0
  public synchronized void solicitaRegistroDeParteDeDominio() {
    try {
      String content =
          this.address
              + " "
              + this.port
              + " "
              + environment.getDomainPartName()
              + " "
              + environment.getDomainName();

      ControlMessage m =
          new ControlMessage(
              ControlMessage.REGISTER_DOMAIN_PART, this.address, this.mainPlatformAddress, content);

      sendMessageToMainDomain(m);

      m = null;

      SemantiCore.notification.print("[ I ] ControlBridge > Mensagem de registro enviada");
    } catch (Exception e) {
      System.err.println("[ E ] ControlBridge > Erro ao enviar mensagem de registro");
      e.printStackTrace();
    }
  }
コード例 #2
0
  public void printInterDomainRoutingTable() {
    Enumeration<Domain> e = interDomainRoutingTable.elements();

    SemantiCore.notification.print("--------------------------------------");
    while (e.hasMoreElements()) {
      Domain d = e.nextElement();
      if (d.isSubDomain())
        SemantiCore.notification.print(environment.getDomainName() + "." + d.getDomainName());
      else SemantiCore.notification.print(d.getDomainName() + "." + environment.getDomainName());

      SemantiCore.notification.print("		Address : " + d.getAddress());
      SemantiCore.notification.print("		Port 	: " + d.getPort());
    }
    SemantiCore.notification.print("--------------------------------------");
  }
コード例 #3
0
  public void run() {
    if (environment.isPartOfDomain()) {
      SemantiCore.notification.print("> Bridge : Enviando mensagem de registro");

      this.solicitaRegistroDeParteDeDominio();
    }

    Vector messages;
    ControlMessage cm;

    while (true) {
      messages = listener.getMessages();

      for (int i = 0; i < messages.size(); i++) {
        cm = (ControlMessage) messages.get(i);

        (new ControlBridgeServiceThread(cm, this)).start();
      }

      try {
        Thread.sleep(80);
      } catch (InterruptedException ex) {
        SemantiCore.notification.print(">>>> ControlBridge | Error : (run) : " + ex.getMessage());
      }
    }
  }