incubator-lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Wellnhofer <wellnho...@aevum.de>
Subject Re: [lucy-dev] Improving the ClusterSearcher
Date Tue, 27 Dec 2011 22:14:51 GMT
On 27/12/11 22:31, Marvin Humphrey wrote:
> 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);
>    }

Yes, that's exactly what I want to do. But we still have to instantiate 
the SearchServer somewhere, and we can't use the current SearchServer 
constructor because it would create additional sockets.

>> 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?

It's mainly the SearchServer constructor that doesn't play well with 
subclassing.

Nick

Mime
View raw message