Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DF1A483DE for ; Fri, 26 Aug 2011 17:21:17 +0000 (UTC) Received: (qmail 93565 invoked by uid 500); 26 Aug 2011 17:21:17 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 93460 invoked by uid 500); 26 Aug 2011 17:21:17 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 93439 invoked by uid 99); 26 Aug 2011 17:21:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2011 17:21:16 +0000 X-ASF-Spam-Status: No, hits=3.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bill.speirs@gmail.com designates 209.85.160.179 as permitted sender) Received: from [209.85.160.179] (HELO mail-gy0-f179.google.com) (209.85.160.179) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2011 17:21:08 +0000 Received: by gyd8 with SMTP id 8so2647122gyd.10 for ; Fri, 26 Aug 2011 10:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=tqe4tEoEvZXg+GC4qXv9kl7w5jvuBziyjKSLnx+bxIM=; b=sZGJ7wvcHcIBWr7DXrdDDIeMr4pYx6mNVRzPNjfW9YIuAoYl0uaoHL3i9aDbgSG6Id N/ZWJ5qXTbxJlboYPUPWaD92u0Y+ZYKE5VkXp4iWE5CMTF5dAN9RhX0hgFu3Nq8ssCMr mkowUI2tQCYwGPBsPLr3zfkD4MEJRwcbcm69I= MIME-Version: 1.0 Received: by 10.42.158.70 with SMTP id g6mr1198720icx.140.1314379247724; Fri, 26 Aug 2011 10:20:47 -0700 (PDT) Received: by 10.42.228.69 with HTTP; Fri, 26 Aug 2011 10:20:47 -0700 (PDT) Received: by 10.42.228.69 with HTTP; Fri, 26 Aug 2011 10:20:47 -0700 (PDT) In-Reply-To: <1314378043.4578.57.camel@ubuntu> References: <1314196752.1969.92.camel@ubuntu> <1314365389.4578.39.camel@ubuntu> <1314378043.4578.57.camel@ubuntu> Date: Fri, 26 Aug 2011 13:20:47 -0400 Message-ID: Subject: Re: HttpParams appear to be static/global From: Bill Speirs To: HttpComponents Project Content-Type: multipart/alternative; boundary=90e6ba6e8a88292a1a04ab6bc42d X-Virus-Checked: Checked by ClamAV on apache.org --90e6ba6e8a88292a1a04ab6bc42d Content-Type: text/plain; charset=ISO-8859-1 Agreed... doing all IO through one thread is prob dumb. Like Synapse, I have a few threads listening, then I put the request through an "assembly line" to modify the request, then I proxy the request to the back-end server using another pool of threads, finally modifying the response before sending it back to the requestor. Hopefully we will open-source this at some point as it is fairly generic. Bill- On Aug 26, 2011 1:01 PM, "Oleg Kalnichevski" wrote: > On Fri, 2011-08-26 at 11:55 -0400, Bill Speirs wrote: >> I'm not trying to be pedantic, just trying to understand this... >> >> From the Synapse source code for HttpCoreNIOListener: >> 250 Thread t = new Thread(new Runnable() { >> 251 public void run() { >> 252 try { >> 253 ioReactor.execute(ioEventDispatch); >> >> From the source code for HttpCoreNIOSender: >> 195 Thread t = new Thread(new Runnable() { >> 196 public void run() { >> 197 try { >> 198 ioReactor.execute(ioEventDispatch); >> >> It appears to me that two threads are created for two different >> IOReactor objects: one for listening to incoming requests, and another >> for sending requests. While this is 100% acceptable (and close to what >> I'm currently doing), is it possible to have both running in one >> thread? How would the IOEventDispatch which would be handling >> everything know that connected() one time would mean that someone has >> connected to the server, and another time it meant a connection was >> made to the back-end service. Maybe through an attribute (and >> associated getAttribute call) in the IOSession? >> >> Thanks... >> >> Bill- >> > > You could do that, albeit with a bit of custom coding. You could extend > BaseIOReactor and add methods to open outgoing connections and listen > for incoming ones. The question is whether or not that would make a lot > of sense. Multi-core systems are commonplace nowadays. If all i/o events > were handled by one thread only one core could be utilized for i/o > operations, thus making the system less scalable. > > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org > For additional commands, e-mail: dev-help@hc.apache.org > --90e6ba6e8a88292a1a04ab6bc42d--