Filter löschen
Filter löschen

(Why) Is Java not available in a thread-based environment?

14 Ansichten (letzte 30 Tage)
Xiaoxing Zhang
Xiaoxing Zhang am 15 Mär. 2024
Kommentiert: Jan Kappen am 22 Mai 2024
From my experience, using Java features (e.g. java.util.LinkedList) is smooth within MATLAB. However, these features are unavailable when called from a thread-based environment. A simplified example would be:
msgbase=javachk('jvm');
ph=parpool('Threads',2);
f=parfeval(ph,@jthreads,1);
[~,msgth]=f.fetchNext();
delete(ph);
function MSG=jthreads()
MSG=javachk('jvm');
end
Where msgbase would be empty, indicating Java is usable, but msgth would be 'This feature is not supported because:Java is not currently available.' I was not able to find a official statement on this issue, or a previous insightful discussion.
  1. Is this expected behavior?
  2. Can I modified settings or append some parameters to enable Java features inside a thread-based environment?
  3. I'm not familar with C MEX funtions but I could learn. However, is C MEX functions supported inside a thread-based environment?
Thanks and regards!

Antworten (1)

Damian Pietrus
Damian Pietrus am 19 Mär. 2024
Currently, thread pools do not support all functions and features that process pools do. Stealing from our doc page here:
  1 Kommentar
Jan Kappen
Jan Kappen am 22 Mai 2024
Does this work with C/C++ and Java interfaces, too? Where exactly are the limitations?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Platform and License finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by