Luke Daley-2 wrote
>> 
>> That's what is expected yes. If the client process terminates abnormally,
>> then the daemon tears itself down.
>> 
>> To “fix” this, we'd have to add some signal handling stuff to Gradle. The
>> daemon client would have to catch the signal, forward it to the daemon
>> server and give the Jetty code a chance to interpret this as a request to
>> shutdown Jetty and nothing else. I'll assume we could simulate this kind
>> of signalling on windows somehow.
>> 
>> I guess this is something we want to be able to do on our way to a
>> generic 'continous' feature.
> 
> The problem exists anytime something launches a blocking process that runs
> indefinitely.
> 
> We have no way of differentiating between “stop the blocking thing that
> the build launched” vs. “stop gradle”.

Is the goal here to fix the bug represented by this incident
http://issues.gradle.org/browse/GRADLE-2263 ?

Or, to do something more generic for OTHER processes that may be ran
indefinitely?

If the goal is to fix GRADLE-2263, then the solution is much simpler than
this conversation is suggesting.  The code block that returns when in daemon
mode (AbstractJettyRunTask.startJettyInternal():249) just needs to be moved
to execute AFTER the next code block that starts the monitor thread.  The
monitor has already been updated to remove the call it used to make to
System.exit() (documentation of that class should be updated).  This thread
is responsible ONLY for the jetty server it was instantiated to monitor and
will ensure it is shut down when proper request comes on the listening port. 
This should have no impact on any other gradle thread.

There perhaps is an even better placement of the block, or removal of the
simple return and better use of the 'daemon' property.  Because I don't use
the auto-scan features of Jetty, I'm not sure whether or not it makes sense
to have run configureScanner() and startScanner() in daemon mode (it seems
like it may), but startConsoleScanner() wouldn't need to be run.



--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Jetty-and-the-daemon-tp5710214p5710231.html
Sent from the gradle-dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to