You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Grant Ingersoll <gs...@apache.org> on 2007/11/28 22:30:58 UTC

RequestHandler shared resources

I have an object that I would like to share between two or more  
RequestHandlers.  One request handler will be responsible for the  
object and the other I would like to handle information requests about  
what the object is doing.  Thus, I need to share the object between  
the handlers.  Short of using a static, does anyone have any  
recommended way of doing this?  In a pure servlet, I could use the  
ServletContext.  Or am I missing something?

Thanks,
Grant

Re: RequestHandler shared resources

Posted by Chris Hostetter <ho...@fucit.org>.
: Yeah, I think that would work.  Actually, I should be able to get all the
: request handlers and then look for instances of the req handlers that I need.

or configure reqHandler "B" with the name of reqHandler "A" that owns the 
resource so it knows who to ask.


-Hoss


Re: RequestHandler shared resources

Posted by Grant Ingersoll <gs...@apache.org>.
Yeah, I think that would work.  Actually, I should be able to get all  
the request handlers and then look for instances of the req handlers  
that I need.

Thanks!

-Grant

On Nov 28, 2007, at 4:42 PM, Ryan McKinley wrote:

> Grant Ingersoll wrote:
>> I have an object that I would like to share between two or more  
>> RequestHandlers.  One request handler will be responsible for the  
>> object and the other I would like to handle information requests  
>> about what the object is doing.  Thus, I need to share the object  
>> between the handlers.  Short of using a static, does anyone have  
>> any recommended way of doing this?  In a pure servlet, I could use  
>> the ServletContext.  Or am I missing something?
>
> RequestHandlers can know about each other by asking SolrCore
>
>    core.getRequestHandler( "myhandler" )
>
> If you are using 1.3-dev, make the RequestHandler implement  
> SolrCoreAware and then inform( SolrCore ) will be called *after*  
> everything is initialized.
>
> is that what you need?
>
> ryan



Re: RequestHandler shared resources

Posted by Ryan McKinley <ry...@gmail.com>.
Grant Ingersoll wrote:
> I have an object that I would like to share between two or more 
> RequestHandlers.  One request handler will be responsible for the object 
> and the other I would like to handle information requests about what the 
> object is doing.  Thus, I need to share the object between the 
> handlers.  Short of using a static, does anyone have any recommended way 
> of doing this?  In a pure servlet, I could use the ServletContext.  Or 
> am I missing something?
> 

RequestHandlers can know about each other by asking SolrCore

     core.getRequestHandler( "myhandler" )

If you are using 1.3-dev, make the RequestHandler implement 
SolrCoreAware and then inform( SolrCore ) will be called *after* 
everything is initialized.

is that what you need?

ryan