Exemplo n.º 1
0
 private DaemonClientConnection connectToDaemonWithId(
     DaemonStartupInfo startupInfo, ExplainingSpec<DaemonContext> constraint)
     throws ConnectException {
   // Look for 'our' daemon among the busy daemons - a daemon will start in busy state so that
   // nobody else will grab it.
   for (DaemonInfo daemonInfo : daemonRegistry.getBusy()) {
     if (daemonInfo.getContext().getUid().equals(startupInfo.getUid())) {
       try {
         if (!constraint.isSatisfiedBy(daemonInfo.getContext())) {
           throw new GradleException(
               "The newly created daemon process has a different context than expected."
                   + "\nIt won't be possible to reconnect to this daemon. Context mismatch: "
                   + "\n"
                   + constraint.whyUnsatisfied(daemonInfo.getContext()));
         }
         return connectToDaemon(daemonInfo, startupInfo.getDiagnostics());
       } catch (ConnectException e) {
         throw new GradleException(
             "The forked daemon process died before we could connect.\n" + startupInfo.describe(),
             e);
       }
     }
   }
   return null;
 }
Exemplo n.º 2
0
  public DaemonClientConnection connect(ExplainingSpec<DaemonContext> constraint) {
    DaemonClientConnection connection = findConnection(daemonRegistry.getIdle(), constraint);
    if (connection != null) {
      return connection;
    }

    return startDaemon(constraint);
  }
Exemplo n.º 3
0
  public DaemonClientConnection connect(ExplainingSpec<DaemonContext> constraint) {
    DaemonClientConnection connection = findConnection(daemonRegistry.getIdle(), constraint);
    if (connection != null) {
      return connection;
    }

    if (!Boolean.getBoolean(DISABLE_STARTING_DAEMON_MESSAGE_PROPERTY)) {
      LOGGER.lifecycle(STARTING_DAEMON_MESSAGE);
    }
    return startDaemon(constraint);
  }
Exemplo n.º 4
0
 public DaemonClientConnection maybeConnect(ExplainingSpec<DaemonContext> constraint) {
   return findConnection(daemonRegistry.getAll(), constraint);
 }