Esempio n. 1
0
 @Start
 public void startJmdnsGroup() throws IOException {
   super.startRestGroup();
   jmdns = new ArrayList<JmDnsComponent>();
   thread = new Thread(this);
   updateDico();
   alive = true;
   thread.start();
 }
Esempio n. 2
0
 @Stop
 public void stopJmdnsGroup() {
   alive = false;
   thread.interrupt();
   for (JmDnsComponent _jmdns : jmdns) {
     _jmdns.close();
   }
   jmdns = null;
   super.stopRestGroup();
 }
Esempio n. 3
0
  @Override
  public void run() {
    ArrayList<InetAddress> ips = getIps();
    ContainerRoot model = getModelService().getLastModel();
    // update local address interfaces
    for (InetAddress ip : ips) {
      KevoreePlatformHelper.instance$.updateNodeLinkProp(
          model,
          this.getNodeName(),
          this.getNodeName(),
          org.kevoree.framework.Constants.instance$.getKEVOREE_PLATFORM_REMOTE_NODE_IP(),
          ip.getHostAddress(),
          "LAN" + ip.getHostName(),
          100);
      //
      // KevoreePlatformHelper.updateNodeLinkProp(model,this.getNodeName(),this.getNodeName(),
      // org.kevoree.framework.Constants.KEVOREE_MODEL_PORT(),this.getDictionary().get("port").toString(), "LAN", 100);
    }
    getModelService().updateModel(model);

    for (InetAddress ip : ips) {
      jmdns.add(
          new JmDnsComponent(
              this.getNodeName(),
              this.getName(),
              Integer.parseInt(this.getDictionary().get("port").toString()),
              this.getModelService(),
              "JmDNSNanoRestGroup",
              ip));
    }
    while (alive) {
      for (JmDnsComponent _jmdns : jmdns) {
        _jmdns.requestUpdateList(timer);
      }
      try {
        Thread.sleep(timer);
      } catch (InterruptedException e) {
        logger.debug("requestUpdateList: " + e.getMessage());
      }
    }
  }