Dear Wiki user, You have subscribed to a wiki page or wiki category on "Jakarta-httpclient Wiki" for change notification.
The following page has been changed by RolandWeber: http://wiki.apache.org/jakarta-httpclient/HttpAsyncThreadingDesign The comment on the change is: added descriptions of red and cyan design ------------------------------------------------------------------------------ === Red Design === - ''describe the original design, which maximizes responsibilites for application threads'' + This extreme design is based on the following premises: + * Background threads are a shared resource that should be used only for what is absolutely necessary. + * Application code is unstable and should be executed by application threads whenever possible. attachment:reddesign.png + Preprocessing and postprocessing is done by application threads because these steps + execute application code. Consuming the response is also done by an application thread, + because it is a potentially long-running task that does not necessarily have to be executed + by a background thread. + [[BR]] + With this design, notification handling does not have access to the postprocessed response. + The notification handler can not close the handle either. + Errors in preprocessing will not generate load in the background threads. + The code for pre- and postprocessing can use blocking operations, including user interaction. + Only an application thread will be blocked, but the dispatcher continues operation. + === Cyan Design === - ''describe an alternative design, which maximizes responsibilities for background threads'' + This extreme design is based on the following premise: + * If it can be done by a background thread, let it be done by a background thread. attachment:cyandesign.png + Preprocessing and postprocessing are done by background threads, as is consuming the response. + Postprocessing is done before notification, since that is the last chance to detect and report + a problem in a background thread. + [[BR]] + The notification handler has access to the postprocessed response, and it can close the handle. + Errors in preprocessing will trigger a problem notification. + Pre- and postprocessing are subject to the same restrictions as notification handling. + In particular, they can not use long-running blocking operations, since they would block a + background thread and thereby interfere with processing of other requests and responses. + == Non-blocking IO Implementation == --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]