Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] ApacheConnector, PoolingHttpClientConnectionManager and WebTarget.register()

Thanks.

Would this work and do the final cleanup as well? Or do I still need
to invoke something?

        connManager = new PoolingHttpClientConnectionManager(getSchemeRegistry(
                originalUri, sslContext)) {

            @Override
            public void close() {
                super.shutdown();
            }

            @Override
            public void shutdown() {
                // Disable shutdown of the pool. This will be done
later, when this factory is closed
                // This is a workaround for finalize method on jerseys
ClientRuntime which
                // closes the client and shuts down the connection
pool when it is garbage collected
            }
        };

Found here: https://github.com/13567370952/docker-java-test/blob/master/src/main/java/com/github/dockerjava/jaxrs/JerseyDockerCmdExecFactory.java#L206

On Tue, Aug 11, 2020 at 9:12 PM Jan Supol <jan.supol@xxxxxxxxxx> wrote:
>
> Hi,
>
> you have two options:
>
> a) Use ApacheClientProperties.CONNECTION_MANAGER_SHARED.
>
> b) Use new PoolingHttpClientConnectionManager() {
>
> @Override public void shutdown() {
>     //do nothing
> }
>
> }.
>
> Thanks,
>
> Jan
>
> On 11.08.2020 18:24, Martynas Jusevičius wrote:
> > Hi,
> >
> > can someone show me an example of Jersey Client being configured with
> > ApacheConnector and PoolingHttpClientConnectionManager which does not
> > cause "Connection pool shutdown" as in
> > https://urldefense.com/v3/__https://github.com/eclipse-ee4j/jersey/issues/4449?__;!!GqivPVa7Brio!LfHU35-piHiGK2K0ThfGfGG8JYZgZc_IzcUP069c-_S22F3WKbXD2i0I_HtSSpTn$
> >
> > I emphasize that there was no such problem using the
> > ThreadSafeClientConnManager with Jersey 1.19.
> >
> > Also, is this content still valid?
> > https://blogs.oracle.com/japod/how-to-use-jersey-client-efficiently
> > It recommends avoiding WebTarget::property and WebTarget::register for
> > performance reasons.
> > If so, then WebTarget-specific ClientRequestFilters become useless,
> > and require a less cleaner implementation by explicitly setting header
> > values.
> >
> >
> > Martynas
> > _______________________________________________
> > jersey-dev mailing list
> > jersey-dev@xxxxxxxxxxx
> > To unsubscribe from this list, visit https://urldefense.com/v3/__https://www.eclipse.org/mailman/listinfo/jersey-dev__;!!GqivPVa7Brio!LfHU35-piHiGK2K0ThfGfGG8JYZgZc_IzcUP069c-_S22F3WKbXD2i0I_B2jPlVh$
> _______________________________________________
> jersey-dev mailing list
> jersey-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jersey-dev


Back to the top