Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0049435Openbravo ERPA. Platformpublic2022-05-30 08:372022-10-04 08:19
alostale 
alostale 
normalminorhave not tried
closedfixed 
5
 
PR23Q1 
Core
No
0049435: don't use java.lang.ThreadGroup
In JDK19's JEP 425: Virtual Threads (Preview), there is a section for ThreadGroup where they comment:

"
java.lang.ThreadGroup is a legacy API for grouping threads that is rarely used in modern applications and unsuitable for grouping virtual threads. We deprecate and degrade it now, and expect to introduce a new thread-organizing construct in the future as part of structured concurrency.
"


We should prevent using it.

---
[1] https://openjdk.java.net/jeps/425#java-lang-ThreadGroup [^]
It is currently used in ImportEntryManager and ClusterServiceManager.
No tags attached.
blocks feature request 0049432 new Triage Platform Base Support JDK19 
Issue History
2022-05-30 08:37alostaleNew Issue
2022-05-30 08:37alostaleAssigned To => Triage Platform Base
2022-05-30 08:37alostaleModules => Core
2022-05-30 08:37alostaleTriggers an Emergency Pack => No
2022-05-30 08:37alostaleTypedefect => design defect
2022-05-30 08:37alostaleRelationship addedblocks 0049432
2022-07-29 13:28shuehnerNote Added: 0139728
2022-07-29 13:28shuehnerTarget Version => PR22Q4
2022-09-29 14:16alostaleAssigned ToTriage Platform Base => caristu
2022-09-29 17:37shuehnerTarget VersionPR22Q4 =>
2022-09-29 17:37shuehnerIssue Monitored: shuehner
2022-09-30 08:23hgbotNote Added: 0141533
2022-09-30 10:34caristuAssigned Tocaristu => alostale
2022-10-04 08:19hgbotNote Added: 0141620
2022-10-04 08:19hgbotResolutionopen => fixed
2022-10-04 08:19hgbotStatusnew => closed
2022-10-04 08:19hgbotFixed in Version => PR23Q1
2022-10-04 08:19hgbotNote Added: 0141621

Notes
(0139728)
shuehner   
2022-07-29 13:28   
Adding SLA date after checking ALO/SHU
(0141533)
hgbot   
2022-09-30 08:23   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/720 [^]
(0141620)
hgbot   
2022-10-04 08:19   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/720 [^]
(0141621)
hgbot   
2022-10-04 08:19   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 83995fe261a9eaeeae0e83108785e94803d48c85
Author: Asier Lostalé <asier.lostale@openbravo.com>
Date: 04-10-2022 06:19:26
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/83995fe261a9eaeeae0e83108785e94803d48c85 [^]

fixes ISSUE-49435: prevents using legacy ThreadGroup

The only direct use in the code was to assign the newly created thread
to the group, which was obtainged from the current thread that was
creaing the new thread.

The Thread super constructor we are using Thread(ThreadGroup, Runnable, String name, long)
documents [1] that if the group is null and there is no security manager,
the group is set to the current thread's thread group. Which is, in
practice, the same that was done before. Also the stackSize parameter
was always 0 which indicates to be ignored.

Taking into account all this, it is possible to use the simpler
constructor Thread(Runnable target, String name).

---
[1] https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html#%3Cinit%3E(java.lang.ThreadGroup,java.lang.Runnable,java.lang.String,long) [^]

---
M src/org/openbravo/cluster/ClusterServiceManager.java
M src/org/openbravo/service/importprocess/ImportEntryManager.java
---