if Client implementations are thread-safe, shouldn't a single instance be
enough? Thus having a single instance for the whole app would do it. I
don't think it's the case.

On Mon, Oct 27, 2014 at 10:21 PM, Savvas Andreas Moysidis <
savvas.andreas.moysi...@gmail.com> 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> 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>
>> 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
>> 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
>
>
------------------------------------------------------------------------------
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to