Package org.sonatype.sisu.bl.support

Examples of org.sonatype.sisu.bl.support.TimedCondition


    );

    if (getConfiguration().isSuspendOnStart()) {
      // verify the debugger socket has been opened and is waiting for a debugger to connect
      // command monitor thread is not started while suspended so this is the best we can do
      final boolean jvmSuspended = new TimedCondition()
      {
        @Override
        protected boolean isSatisfied()
            throws Exception
        {
          Socket socket = new Socket();
          socket.setSoTimeout(5000);
          socket.connect(
              new InetSocketAddress(getConfiguration().getHostName(), getConfiguration().getDebugPort()));
          return true;
        }
      }.await(Time.seconds(10), Time.seconds(DEFAULT_START_TIMEOUT), Time.seconds(1));
      if (jvmSuspended) {
        log.info("{} ({}) suspended for debugging at {}:{}", getName(), getConfiguration().getId(),
            getConfiguration().getHostName(), getConfiguration().getDebugPort());
      }
      else {
        throw new RuntimeException(
            format(
                "%s (%s) no open socket for debugging at %s:%s within 10 seconds", getName(),
                getConfiguration().getId(), getConfiguration().getHostName(),
                getConfiguration().getDebugPort()
            )
        );
      }
    }
    else {
      // when not suspending, we expect the internal command monitor thread to start well before bundle is ready
      // so we only give it 10 seconds to be available
      log.info("{} ({}) pinging command monitor at {}:{}", getName(), getConfiguration().getId(),
          getConfiguration().getHostName(), commandMonitorPort);
      final boolean monitorInstalled = new TimedCondition()
      {
        @Override
        protected boolean isSatisfied()
            throws Exception
        {
View Full Code Here


    // application may be in suspended state waiting for debugger to attach, if we can reasonably guess this is
    // the case, then we should resume the vm so that we can ask command monitor to immediately halt
    try {
      if (getConfiguration().isSuspendOnStart()) {

        boolean isSuspended = new TimedCondition()
        {
          @Override
          protected boolean isSatisfied()
              throws Exception
          {
View Full Code Here

TOP

Related Classes of org.sonatype.sisu.bl.support.TimedCondition

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.