Great, thanks for the input Bill. On 29 October 2014 13:20, Bill Burke <bbu...@redhat.com> wrote:
> By default, Resteasy only allows one connection per Client. You have to > use ResteadyClient(Builder) to expand this. Other than that, it should > be threadsafe. > > Personally, I'd create the Client as an application-scoped CDI bean and > inject it, or create one with SPring and inject it, or create one in a > servlet listener and add it to ServletContext. If you create per > request, then you lose any socket connection pooling that Apache Http > Client does. > > On 10/27/2014 8:21 PM, Savvas Andreas Moysidis wrote: > > The question, I suppose, is whether Client implementations are > > thread-safe or not which is something that is not stipulated by the > > interface contract. > > > > If they are(something which is sort of implied by the javadoc), then you > > could maybe declare and use a single instance like the following? (in a > > JavaEE context) > > > > @Singleton > > public class SomeService { > > > > private Client restClient; > > > > @PostConstruct > > private void init() { > > restClient = ClientBuilder.newClient(); > > } > > > ..................................................................... > > // Use restClient object here > > > ..................................................................... > > > > @PreDestroy > > private void cleanUp() { > > restClient.close(); > > } > > } > > > > On 27 October 2014 23:24, Mario Diana <mariodi...@gmail.com > > <mailto:mariodi...@gmail.com>> wrote: > > > > I'd be interested in hearing what common practice is regarding > > pooled Client objects, too. Do people use the Apache objects pool > > library? That's the only option I've heard of. Are there other > > mainstream solutions? > > > > Mario > > > > > On Oct 27, 2014, at 12:39 PM, Rodrigo Uchôa > > <rodrigo.uc...@gmail.com <mailto:rodrigo.uc...@gmail.com>> wrote: > > > > > > [...] > > > > > How should we implement a pool of Client objects in this scenario? > Is there a common solution? > > > > > > Regards, > > > Rodrigo Uchoa. > > > > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > > Resteasy-users mailing list > > Resteasy-users@lists.sourceforge.net > > <mailto:Resteasy-users@lists.sourceforge.net> > > https://lists.sourceforge.net/lists/listinfo/resteasy-users > > > > > > > > > > > ------------------------------------------------------------------------------ > > > > > > > > _______________________________________________ > > Resteasy-users mailing list > > Resteasy-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/resteasy-users > > > > -- > Bill Burke > JBoss, a division of Red Hat > http://bill.burkecentral.com > > > ------------------------------------------------------------------------------ > _______________________________________________ > Resteasy-users mailing list > Resteasy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/resteasy-users >
------------------------------------------------------------------------------
_______________________________________________ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users