forked from resteasy/resteasy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FinalizedClientResponse.java
32 lines (27 loc) · 1.05 KB
/
FinalizedClientResponse.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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.
*
* @deprecated {@linkplain #finalize() finalizers} should no longer be used and this type will be removed in the future
*/
@Deprecated
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) {
}
}
}