johnjhufnagle wrote:In a multithread Java client, if I execute:
1. omero.client c = new omero.client(map); //do this just once @startup
Can multiple threads share the ServiceFactoryPrx returned by a succeeding?:
omero.api.ServiceFactoryPrx s = c.createSession();
Definitely. The service factory and the services returned are all thread-safe, though there are of course operations which you will want to serialize.
johnjhufnagle wrote:Concerning multiple threads that wish to use a SearchPrx. ... Would it be best to create my stateful SearchPrx objects (createSearchService()) each time at the start of an Image search and release it once I have the collection of image id's or is it costly to create and perhaps just create a pool of SearchPrx objects at startup and just use them as needed by each thread.
Creating Search service instances is definitely not costly. Running many large queries and then keeping the results server-side would be a bad idea, but once you next'd the results, the resources will be freed. Then you can either release or reuse it. Nevertheless, you will have to be careful with multple threads.
johnjhufnagle wrote:Similarly since I will be using stateless IQueryPrx object can I use one instance of that across threads or should I have each thread perform a 'getQueryService()'?
One stateless instance per omero.client object is sufficient. In fact, two calls to getQueryService will return handles to the same server-side object.
Cheers,
~Josh.