I am using the NodeClient in a servlet where I create one instance of
the node. Then in every web request coming in I create a client from
that node and start searching etc with it. I.e the node (and client) is
shared among several sessions. For this to work the client need to be
thread safe. The question is - is it?
I wouldn't recommend creating a client on each and every request, as the
client is sort of a expensive resource. You should create it once for your
application and probably leave it in the servlet context available for all
the requests.
On Wed, Apr 13, 2011 at 4:23 PM, Kristian Jörg krjg@devo.se wrote:
Hi,
I am using the NodeClient in a servlet where I create one instance of the
node. Then in every web request coming in I create a client from that node
and start searching etc with it. I.e the node (and client) is shared among
several sessions. For this to work the client need to be thread safe. The
question is - is it?
Yes, the NodeClient is thread safe (any Client is thread safe, also the TransportClient) and its lifecycle should be similar to the application lifecycle.
On Wednesday, April 13, 2011 at 5:25 PM, Enrique Medina Montenegro wrote:
I wouldn't recommend creating a client on each and every request, as the client is sort of a expensive resource. You should create it once for your application and probably leave it in the servlet context available for all the requests.
On Wed, Apr 13, 2011 at 4:23 PM, Kristian Jörg krjg@devo.se wrote:
Hi,
I am using the NodeClient in a servlet where I create one instance of the node. Then in every web request coming in I create a client from that node and start searching etc with it. I.e the node (and client) is shared among several sessions. For this to work the client need to be thread safe. The question is - is it?
Hi Enrique,
yes I do create only one instance of the client in exactly the way
you describe.
/Kristian
Enrique Medina Montenegro skrev 2011-04-13 16:25:
<blockquote cite="mid:BANLkTim06=c8wPn88vsLyB5KrZH-wUukMA@mail.gmail.com" type="cite">
I wouldn't recommend creating a client on each and every request,
as the client is sort of a expensive resource. You should create
it once for your application and probably leave it in the servlet
context available for all the requests.
On Wed, Apr 13, 2011 at 4:23 PM, Kristian Jörg <krjg@devo.se>
wrote:
Hi,
I am using the NodeClient in a servlet where I create one
instance of the node. Then in every web request coming in I
create a client from that node and start searching etc with
it. I.e the node (and client) is shared among several
sessions. For this to work the client need to be thread safe.
The question is - is it?
/Kristian
Yes, the NodeClient is thread safe (any Client is
thread safe, also the TransportClient) and its lifecycle
should be similar to the application lifecycle.
On Wednesday, April 13, 2011 at 5:25 PM, Enrique Medina
Montenegro wrote:
I wouldn't recommend creating a client on each and
every request, as the client is sort of a expensive
resource. You should create it once for your
application and probably leave it in the servlet
context available for all the requests.
On Wed, Apr 13, 2011 at 4:23 PM, Kristian Jörg <krjg@devo.se>
wrote:
Hi,
I am using the NodeClient in a servlet where I
create one instance of the node. Then in every
web request coming in I create a client from
that node and start searching etc with it. I.e
the node (and client) is shared among several
sessions. For this to work the client need to be
thread safe. The question is - is it?
/Kristian
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.