/* (non-Javadoc)
   * @see net.xeoh.plugins.remotediscovery.impl.v4.probes.AbstractProbe#startup()
   */
  @Override
  public void startup() {
    super.startup();

    final Thread thread =
        new Thread(
            new Runnable() {

              @Override
              public void run() {
                backgroundInit();
              }
            });

    thread.setDaemon(true);
    thread.start();

    this.timer = new Timer();
    this.timer.schedule(
        new TimerTask() {

          @Override
          public void run() {
            discoverThread();
          }
        },
        0,
        260);
  }
  /* (non-Javadoc)
   * @see net.xeoh.plugins.remotediscovery.impl.v4.probes.AbstractProbe#shutdown()
   */
  @Override
  public void shutdown() {
    super.shutdown();

    try {
      this.timer.cancel();
    } catch (final Exception e) {
      //
    }

    final java.lang.Thread t =
        new java.lang.Thread(
            new Runnable() {

              public void run() {
                NetworkProbe.this.jmdnsLock.lock();

                // All of these statements tend to fail because of various reasons. During the
                // shutdown however,
                // we want to ignore them all ...
                try {
                  try {
                    NetworkProbe.this.localManagerExportServer.close();
                  } catch (final Exception e) {
                    //
                  }
                  try {
                    NetworkProbe.this.jmdns.unregisterAllServices();
                  } catch (final Exception e) {
                    //
                  }
                  try {
                    NetworkProbe.this.jmdns.close();
                  } catch (final Exception e) {
                    //
                  }
                } finally {
                  NetworkProbe.this.jmdnsLock.unlock();
                }
              }
            });
    t.setDaemon(true);
    t.start();
  }