Task #7638
Story #7635: thread-safety in libclient_java
Task #7633: refactor libclient to remove synchronized from the 2 key methods
deprecate the RestClient header methods
100%
Description
RestClient holds a key-value map of headers to add to Request objects. It is inherently thread unsafe, since the RestClient instance is likely to be shared between threads. A keyword scan of CN projects shows that it is not in use, so there is little impact.
Add the @Deprecated annotation to the applicable methods, and a javadoc @deprecated comment.
For users that want more control over the HTTP requests, they should instead build an HttpRequestInterceptor and add it to the HttpClient at build time, like so:
HttpClientBuilder builder = org.dataone.client.utils.HttpUtils.getHttpClientBuilder(certificateOrTokenMaterial);
builder.addInterceptorLast(new HttpRequestInterceptor() {
@Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { // custom header additions here request.addHeader(key, value); } });
Associated revisions
fixes #7638. Deprecated RestClient http header mechanisms, due to thread safety issues (and lack of use).
fixes #7638. Deprecated RestClient http header mechanisms, due to thread safety issues (and lack of use).
History
#1 Updated by Rob Nahf almost 9 years ago
- Description updated (diff)
#2 Updated by Rob Nahf almost 9 years ago
- Status changed from In Progress to Closed
- % Done changed from 30 to 100
- translation missing: en.field_remaining_hours set to 0.0
Applied in changeset d1-python:d1_python|r17505.