Return-Path: X-Original-To: apmail-incubator-lucy-dev-archive@www.apache.org Delivered-To: apmail-incubator-lucy-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 1C54070AE for ; Tue, 27 Dec 2011 21:39:58 +0000 (UTC) Received: (qmail 29285 invoked by uid 500); 27 Dec 2011 21:39:58 -0000 Delivered-To: apmail-incubator-lucy-dev-archive@incubator.apache.org Received: (qmail 29256 invoked by uid 500); 27 Dec 2011 21:39:58 -0000 Mailing-List: contact lucy-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucy-dev@incubator.apache.org Delivered-To: mailing list lucy-dev@incubator.apache.org Received: (qmail 29248 invoked by uid 99); 27 Dec 2011 21:39:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Dec 2011 21:39:58 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [68.116.39.62] (HELO rectangular.com) (68.116.39.62) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Dec 2011 21:39:51 +0000 Received: from marvin by rectangular.com with local (Exim 4.69) (envelope-from ) id 1Rfecb-0003Dd-7g for lucy-dev@incubator.apache.org; Tue, 27 Dec 2011 13:31:45 -0800 Date: Tue, 27 Dec 2011 13:31:45 -0800 From: Marvin Humphrey To: lucy-dev@incubator.apache.org Message-ID: <20111227213145.GA12342@rectangular.com> References: <4EF3CA27.9070501@aevum.de> <20111223025236.GA30915@rectangular.com> <4EF4D822.7020804@aevum.de> <20111224043452.GA13704@rectangular.com> <4EF9E942.6000701@aevum.de> <20111227203328.GA12191@rectangular.com> <4EFA3555.5020506@aevum.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EFA3555.5020506@aevum.de> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [lucy-dev] Improving the ClusterSearcher On Tue, Dec 27, 2011 at 10:15:01PM +0100, Nick Wellnhofer wrote: > On 27/12/11 21:33, Marvin Humphrey wrote: >> Ah, I see that you have a process_request() method in the LUCY-205 patch >> already -- and though it does not take a socket-handle/fileno as an argument, >> it can be modified easily to do so. > > That's an implementaion detail of Net::Server. To use Net::Server, you > simply subclass it and implement a process_request method. You can write a Net::Server::PreFork subclass which has-a LucyX::Search::SearchServer and implements process_request() like so: sub process_request { my $self = shift; my $client_sock = $self->get_property('client'); $self->{search_server}->handle_request($client_sock); } >> I think that means that we cannot simply delete SearchServer#serve -- though >> we can improve on things by making it possible to override serve() or >> otherwise avoid it. > > IMO subclassing SearchServer as it is now wouldn't be the best solution > if it's possible at all. It's not possible to subclass it in the context of Net::Server, but you can e.g. write a simple subclass which invokes fork() on each request. > First, we can't use the SearchServer > constructor because we don't want the sockets to be created there. Then, > AFAIU classes derived from Lucy::Object::Obj must be inside-out. Is it > safe to subclass additional Perl classes like Net::Server that use their > own hashref attributes in the traditional way? No, that won't work. (But hash-based classes are dangerous to subclass too because of collisions within the hash's flat namespace.) > Another solution would be to simply duplicate the SearchServer request > handling code in an external module. That's not very elegant but maybe > it's the easiest way to go, at least for now. Isn't that pretty much what we get if we implement handle_request($sock) as a method on SearchServer? Marvin Humphrey