All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.resteasy.client.jaxrs.internal.FinalizedClientResponse Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha4
Show newest version
package org.jboss.resteasy.client.jaxrs.internal;

import org.jboss.resteasy.tracing.RESTEasyTracingLogger;

/**
 * A class that adds a {@link Object#finalize) method to the {@link ClientResponse} as a last ditch backstop to prevent
 * leaking resources with ill-behaved clients.  Use of finalize could incur a significant performance penalty.
 */
public abstract class FinalizedClientResponse extends ClientResponse {

    protected FinalizedClientResponse(final ClientConfiguration configuration,
                                      final RESTEasyTracingLogger tracingLogger)
    {
        super(configuration, tracingLogger);
    }

    @Override
    // This method is synchronized to protect against premature calling of finalize by the GC
    protected synchronized void finalize() throws Throwable
    {
        if (isClosed()) return;
        try {
            close();
        }
        catch (Exception ignored) {
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy