Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 18427 invoked from network); 5 Jan 2011 15:54:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Jan 2011 15:54:16 -0000 Received: (qmail 30880 invoked by uid 500); 5 Jan 2011 15:54:13 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 30711 invoked by uid 500); 5 Jan 2011 15:54:13 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 30696 invoked by uid 99); 5 Jan 2011 15:54:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jan 2011 15:54:12 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of goberman@msn.com designates 65.54.190.91 as permitted sender) Received: from [65.54.190.91] (HELO bay0-omc2-s16.bay0.hotmail.com) (65.54.190.91) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jan 2011 15:54:04 +0000 Received: from BAY146-W36 ([65.54.190.125]) by bay0-omc2-s16.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 5 Jan 2011 07:53:43 -0800 Message-ID: Content-Type: multipart/alternative; boundary="_44a566a6-30e7-459d-befc-9f1714cdb127_" X-Originating-IP: [209.120.151.138] From: ilya goberman To: Subject: need guidance on threading model/ functionality of CometProcessor Date: Wed, 5 Jan 2011 09:53:43 -0600 Importance: Normal MIME-Version: 1.0 X-OriginalArrivalTime: 05 Jan 2011 15:53:43.0856 (UTC) FILETIME=[BAEF3B00:01CBACF0] --_44a566a6-30e7-459d-befc-9f1714cdb127_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi=2C I am trying to use NIO HTTP Tomcat connector org.apache.coyote.Http11NioPro= tocol to implement Comet streaming to browsers and mobile devices (using To= mcat org.apache.catalina.comet.CometProcessor).=20 The application opens a persistent Comet connection to receive data from th= e server.=20 Server then sends data to the client periodically. My server application has several threads to send data to the clients. One = thread is assigned a set of clients. It will be possible that one of the clients is "slow reader" for various re= asons.=20 If I call PrintWriter.print("message") to send data to such client=2C the t= hread apparently may block causing all clients assigned to the thread to st= op receiving updates. Clearly=2C this is not going to fly and I need to make some changes to addr= ess it. I am looking for 2 things: 1) I need to understand threading for Http11NioProtocol/CometProcessor. Are= there any articles/ docs describing how it works? Could someone point me to it? It will help any developer using this in the future if it is properly docum= ented.=20 Apparently there are buffers associated with clients. There is a buffer of = 32K(?) associated with the client that causes writes to block when full (?)= . Mark Thomas gave me some pointers=2C but I am still far from understanding = the whole picture. 2) I need to detect if client is "slow reader". I do not see any way to do = it besides accessing the client queue and checking its size. Will it be possible to expose it in the Comet API? I should be able to conf= igure its size and disconnect clients with queue reaching a threshold. I suppose I can spawn a thread for each client=2C but this is ugly. Any suggestions will be appreciated. Thanks=20 = --_44a566a6-30e7-459d-befc-9f1714cdb127_--