Package org.sonatype.nexus.bootstrap.monitor

Examples of org.sonatype.nexus.bootstrap.monitor.CommandMonitorTalker


  private void sendStopToNexus(final int commandPort) {
    log.debug("Sending stop command to Nexus");
    try {
      // FIXME HOSTNAME should be configurable
      new CommandMonitorTalker(LOCALHOST, commandPort).send(StopApplicationCommand.NAME);
    }
    catch (Exception e) {
      log.debug(
          "Skipping exception got while sending stop command to Nexus {}:{}",
          e.getClass().getName(), e.getMessage()
View Full Code Here


    // First attempt graceful shutdown
    sendStopToNexus(commandPort);

    // FIXME LOCALHOST should be getHostName
    CommandMonitorTalker talker = new CommandMonitorTalker(LOCALHOST, commandPort);
    long started = System.currentTimeMillis();
    long max = 5 * 60 * 1000; // wait 5 minutes for NX to shutdown, before attempting to halt it
    long period = 1000;

    // Then ping for a bit and finally give up and ask it to halt
    while (true) {
      try {
        talker.send(PingCommand.NAME);
      }
      catch (ConnectException e) {
        // likely its shutdown already
        break;
      }
      catch (Exception e) {
        // ignore, not sure there is much we can do
      }

      // If we have waited long enough, then ask remote to halt
      if (System.currentTimeMillis() - started > max) {
        try {
          talker.send(HaltCommand.NAME);
          break;
        }
        catch (Exception e) {
          // ignore, not sure there is much we can do
          break;
View Full Code Here

  private void sendStopToKeepAlive(final int commandPort) {
    log.debug("Sending stop command to keep alive thread");
    try {
      // FIXME replace LOCALHOST with getHostName
      new CommandMonitorTalker(LOCALHOST, commandPort).send(StopMonitorCommand.NAME);
    }
    catch (Exception e) {
      log.debug(
          "Skipping exception got while sending stop command to keep alive thread {}:{}",
          e.getClass().getName(), e.getMessage()
View Full Code Here

        @Override
        protected boolean isSatisfied()
            throws Exception
        {
          // FIXME replace LOCALHOST with getHostName() after making default hostname be 127.0.0.1
          new CommandMonitorTalker(LOCALHOST, commandMonitorPort).send(PingCommand.NAME);
          return true;
        }
      }.await(Time.seconds(10), Time.seconds(DEFAULT_START_TIMEOUT), Time.seconds(1));
      if (monitorInstalled) {
        log.debug("{} ({}) command monitor detected at {}:{}", getName(), getConfiguration().getId(),
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.bootstrap.monitor.CommandMonitorTalker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.