Skip to content

GH Issue 1795: Make shared Formats number formats thread-safe - #1240

Merged
labkey-adam merged 2 commits into
developfrom
fb_safe_decimal_format_1795
Nov 10, 2026
Merged

labkey-adam merged 2 commits into
developfrom
fb_safe_decimal_format_1795

Conversation

@labkey-adam

@labkey-adam labkey-adam commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

This PR makes the shared number formats in Formats safe for concurrent use. They were single DecimalFormat instances used by many threads at once, and DecimalFormat isn't thread-safe, so concurrent formatting could render wrong digits. Fixes GH Issue 1795.

Related Pull Requests

Changes

  • Clinical history formatting goes through the thread-safe wrapper instead of holding the shared format directly
  • Billing notification formats are thread-safe
  • Clinical history keeps full precision, omits missing units, and checks and reads fields with the same key

labkey-adam added a commit to LabKey/commonAssays that referenced this pull request Nov 10, 2026
## Rationale
This PR makes the shared number formats in `Formats` safe for concurrent
use. They were single `DecimalFormat` instances used by many threads at
once, and `DecimalFormat` isn't thread-safe, so concurrent formatting
could render wrong digits. Fixes [GH Issue
1795](LabKey/internal-issues#1795).

## Related Pull Requests
- LabKey/platform#8314
- LabKey/ehrModules#1240
- LabKey/onprcEHRModules#1994
- LabKey/premiumModules#857
- LabKey/targetedms#1304

## Changes
- MS2 protein views format through the shared wrappers directly
- The MS2 charge filter format moves out of `Formats` and into MS2
- The protein group page no longer fails when an iTRAQ error value is
missing
- The remaining MS2 number formats are thread-safe
labkey-adam added a commit to LabKey/targetedms that referenced this pull request Nov 10, 2026
## Rationale
This PR makes the shared number formats in `Formats` safe for concurrent
use. They were single `DecimalFormat` instances used by many threads at
once, and `DecimalFormat` isn't thread-safe, so concurrent formatting
could render wrong digits. Fixes [GH Issue
1795](LabKey/internal-issues#1795).

## Related Pull Requests
- LabKey/platform#8314
- LabKey/commonAssays#1106
- LabKey/ehrModules#1240
- LabKey/onprcEHRModules#1994
- LabKey/premiumModules#857

## Changes
- Precursor transition labels build the signed mass index directly
instead of through a shared formatter
labkey-adam added a commit to LabKey/onprcEHRModules that referenced this pull request Nov 10, 2026
## Rationale
This PR makes the shared number formats in `Formats` safe for concurrent
use. They were single `DecimalFormat` instances used by many threads at
once, and `DecimalFormat` isn't thread-safe, so concurrent formatting
could render wrong digits. Fixes [GH Issue
1795](LabKey/internal-issues#1795).

## Related Pull Requests
- LabKey/platform#8314
- LabKey/commonAssays#1106
- LabKey/ehrModules#1240
- LabKey/premiumModules#857
- LabKey/targetedms#1304

## Changes
- The finance notification's shared dollar format is now thread-safe
@labkey-adam
labkey-adam merged commit 97b50bf into develop Nov 10, 2026
6 of 9 checks passed
@labkey-adam
labkey-adam deleted the fb_safe_decimal_format_1795 branch November 10, 2026 05:47
labkey-adam added a commit to LabKey/platform that referenced this pull request Nov 10, 2026
## Rationale
This PR makes the shared number formats in `Formats` safe for concurrent
use. They were single `DecimalFormat` instances used by many threads at
once, and `DecimalFormat` isn't thread-safe, so concurrent formatting
could render wrong digits. Fixes [GH Issue
1795](LabKey/internal-issues#1795).

## Related Pull Requests
- LabKey/commonAssays#1106
- LabKey/ehrModules#1240
- LabKey/onprcEHRModules#1994
- LabKey/premiumModules#857
- LabKey/targetedms#1304

## Changes
- Each shared format is now a synchronized `SafeDecimalFormat` wrapper,
and the fields are final
- Code that needs a `Format` object gets its own copy instead of the
shared instance
- Study sequence-number and module version formats use the wrapper too
- Unit test for concurrent formatting
- `Formats` fields change type and `chargeFilter` is removed, so
external modules that assign these fields to a `DecimalFormat` or
`Format`, or use `chargeFilter`, need updating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants