Using JVisualVM shows the live thread count go up by one each time media is played. The thread never gets destroyed.
该提问来源于开源项目:caprica/vlcj
Using JVisualVM shows the live thread count go up by one each time media is played. The thread never gets destroyed.
该提问来源于开源项目:caprica/vlcj
When invoking stop, all that happens is the native media_player_stop method is called. When invoking play, the native media_player_play method is called.
Each time play is called, a new thread is created. The old thread just seems to keep running.
This is related to setting the callback thread to be in "non-detach" mode for JNA's callback mechanism.
If instead the thread detaches, then each callback invocation gets a new thread (so thousands of threads can be created). At least in that case there are no spurious threads hanging around.
Anyway, the point is, this is due to some interaction between the native thread between stop and display. vlcj is not actually doing anything with threads itself at this point.