protected boolean tryCheckStartPid() {
    if (getPidFile() == null) return false;

    // if it's still up after 5s assume we are good (default behaviour)
    Time.sleep(Duration.FIVE_SECONDS);
    if (!DynamicTasks.queue(SshEffectorTasks.isPidFromFileRunning(getPidFile()).runAsRoot())
        .get()) {
      throw new IllegalStateException(
          "The process for "
              + entity()
              + " appears not to be running (pid file "
              + getPidFile()
              + ")");
    }

    // and set the PID
    entity()
        .sensors()
        .set(
            Attributes.PID,
            Integer.parseInt(
                DynamicTasks.queue(SshEffectorTasks.ssh("cat " + getPidFile()).runAsRoot())
                    .block()
                    .getStdout()
                    .trim()));
    return true;
  }
  protected boolean tryCheckStartService() {
    if (getServiceName() == null) return false;

    // if it's still up after 5s assume we are good (default behaviour)
    Time.sleep(Duration.FIVE_SECONDS);
    if (!((Integer) 0)
        .equals(
            DynamicTasks.queue(
                    SshEffectorTasks.ssh("/etc/init.d/" + getServiceName() + " status").runAsRoot())
                .get())) {
      throw new IllegalStateException(
          "The process for "
              + entity()
              + " appears not to be running (service "
              + getServiceName()
              + ")");
    }

    return true;
  }
  static {
    RendererHints.register(REGISTERED_AT, RendererHints.displayValue(Time.toDateString()));

    RendererHints.register(
        MEMORY_AVAILABLE,
        RendererHints.displayValue(
            Functionals.chain(MathFunctions.times(1024L * 1024L), ByteSizeStrings.iso())));
    RendererHints.register(
        MEMORY_USED,
        RendererHints.displayValue(
            Functionals.chain(MathFunctions.times(1024L * 1024L), ByteSizeStrings.iso())));
    RendererHints.register(
        DISK_AVAILABLE,
        RendererHints.displayValue(
            Functionals.chain(MathFunctions.times(1024L * 1024L), ByteSizeStrings.iso())));
    RendererHints.register(
        DISK_USED,
        RendererHints.displayValue(
            Functionals.chain(MathFunctions.times(1024L * 1024L), ByteSizeStrings.iso())));
  }
  static {
    RendererHints.register(
        MESOS_SLAVES, RendererHints.openWithUrl(DelegateEntity.EntityUrl.entityUrl()));
    RendererHints.register(
        MESOS_FRAMEWORKS, RendererHints.openWithUrl(DelegateEntity.EntityUrl.entityUrl()));
    RendererHints.register(
        MESOS_TASKS, RendererHints.openWithUrl(DelegateEntity.EntityUrl.entityUrl()));
    RendererHints.register(
        MESOS_APPLICATIONS, RendererHints.openWithUrl(DelegateEntity.EntityUrl.entityUrl()));
    RendererHints.register(
        SDN_PROVIDER, RendererHints.openWithUrl(DelegateEntity.EntityUrl.entityUrl()));

    RendererHints.register(START_TIME, RendererHints.displayValue(Time.toDateString()));

    RendererHints.register(LOAD_1MIN, RendererHints.displayValue(MathFunctions.percent(2)));
    RendererHints.register(LOAD_5MIN, RendererHints.displayValue(MathFunctions.percent(2)));
    RendererHints.register(LOAD_15MIN, RendererHints.displayValue(MathFunctions.percent(2)));

    RendererHints.register(MEMORY_FREE_BYTES, RendererHints.displayValue(ByteSizeStrings.iso()));
    RendererHints.register(MEMORY_TOTAL_BYTES, RendererHints.displayValue(ByteSizeStrings.iso()));
  }
  protected boolean tryCheckStartWindowsService() {
    if (getWindowsServiceName() == null) return false;

    // if it's still up after 5s assume we are good (default behaviour)
    Time.sleep(Duration.FIVE_SECONDS);
    if (!((Integer) 0)
        .equals(
            DynamicTasks.queue(
                    SshEffectorTasks.ssh(
                            "sc query \"" + getWindowsServiceName() + "\" | find \"RUNNING\"")
                        .runAsCommand())
                .get())) {
      throw new IllegalStateException(
          "The process for "
              + entity()
              + " appears not to be running (windowsService "
              + getWindowsServiceName()
              + ")");
    }

    return true;
  }