Project

General

Profile

Task #7636

Story #7635: thread-safety in libclient_java

make singletons thread-safe

Added by Rob Nahf over 6 years ago. Updated about 6 years ago.

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

100%

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

Description

Make sure the singletons in d1_libclient_java are thread-safe

v1.D1Client
v2.D1Client
auth.CertificateManager

see http://stackoverflow.com/questions/7048198/thread-safe-singletons-in-java

History

#1 Updated by Rob Nahf over 6 years ago

  • Description updated (diff)
  • % Done changed from 0 to 30
  • Status changed from New to In Progress

CertificateManager holds a registry of nodes that should be universal - it would be confusing to have two instantiations of CertificateManager each holding half of the registry.

Refactoring to implement the SingletonHelper approach.

#2 Updated by Rob Nahf over 6 years ago

DataoneEMLParser is a singleton, but with negligible consequence for accidentally having two instantiations. Skipping refactoring.

#3 Updated by Rob Nahf over 6 years ago

refactored CertificateManager and ObjectFormatCache getInstance() methods as per above.

In ObjectFormatCache, made the refreshCache method synchronized, and the map a ConcurrentHashMap.

ObjectFormatInfo singleton has a reload() method that might make doing the same for that class difficult.

#4 Updated by Rob Nahf about 6 years ago

  • Status changed from In Progress to Closed
  • translation missing: en.field_remaining_hours set to 0.0
  • % Done changed from 30 to 100

progress made took care of the low-hanging fruit.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)