Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/161#discussion_r17530849
  
    --- Diff: usage/rest-api/src/main/java/brooklyn/rest/api/ServerApi.java ---
    @@ -53,7 +53,8 @@
         @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
         public void shutdown(
             @FormParam("stopAppsFirst") @DefaultValue("false") boolean 
stopAppsFirst,
    -        @FormParam("delayMillis") @DefaultValue("250") long delayMillis);
    +        @FormParam("delayMillis") @DefaultValue("250") long delayMillis,
    --- End diff --
    
    dunno about you but i feel that the logic here is messy (my fault) and 
getting messier (your fault :) ) --
    
    i wonder if the arguments and semantics should be something like:
    
    * `stopAppsFirst` -- whether apps are stopped or left running (as is, 
default false)
    * `forceShutdownOnError` -- whether to shutdown the system if apps fail to 
stop or timeout (default false)
    * `shutdownTimeout` -- a maximum delay to wait for apps to gracefully stop 
before giving up or forcibly exiting (default 20s)
    * `httpReturnTimeout` -- a maximum delay to wait for apps and mgmt context 
to stop before returning from the REST call; if this is >= the shutdownTimeout 
and the shutdownTimeout is exceeded the call will return with an error (and 
setting > shutdownTimeout has no difference to setting =shutdownTimeout) 
(default 20s)
    * `delayForHttpReturn` -- a delay applied after the REST call is returning 
and before any `System.exit`, to permit the REST response to be returned 
(default 5s)
    
    If there is an error stopping apps before restTimeout, or the 
httpReturnTimeout >= the shutdownTimeout and any app shutdown calls did not 
return, then the call returns an error.  If force is true, it invokes the 
`mgmt.terminate` and `System.exit` sequence after 
`shutdownTimeout+delayForHttpReturn` the `delayForHttpReturn`.
    
    Just thinking aloud ... wdyt?  If you think this is overkill for now, maybe 
just paste these comments (or your thoughts on it) in the code for discussion 
at a later date.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to