Project

General

Profile

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

Added by Rob Nahf almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
d1_libclient_java
Target version:
Start date:
2016-02-05
Due date:
% Done:

100%

Milestone:
None
Product Version:
*
Story Points:
Sprint:

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

Revision 17505
Added by Rob Nahf almost 9 years ago

fixes #7638. Deprecated RestClient http header mechanisms, due to thread safety issues (and lack of use).

Revision 17505
Added by Rob Nahf almost 9 years ago

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.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)