This code creates and starts a thread:
new Thread() {
@Override
public void run() {
try { player.play(); }
catch ( Exception e ) { Sy
My preferred method would be putting a synchronized keyword on the play method
synchronized play()
synchronized methods will lock the function so only one thread will be allowed to execute them at a time.
Here's some more info https://docs.oracle.com/javase/tutorial/essential/concurrency/syncmeth.html