@Override
    public void run() {
        long updateRateNanos = (long) (UPDATE_RATE * 1_000_000_000);
        mainloop:
        while (true) {
            long startTime = System.nanoTime();

            if (Thread.interrupted()) {
                logger.fine("Audio decoder thread interrupted, exiting.");
                break;
            }

            synchronized (threadLock) {
                checkDevice();
                updateInDecoderThread(UPDATE_RATE);
            }

            long endTime = System.nanoTime();
            long diffTime = endTime - startTime;

            // Sleep to maintain the desired update rate
            if (diffTime < updateRateNanos) {
                long desiredEndTime = startTime + updateRateNanos;
                while (System.nanoTime() < desiredEndTime) {
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        logger.fine("Audio decoder thread interrupted during sleep, exiting.");
                        break mainloop;
                    }
                }
            }
        }
        logger.fine("Audio decoder thread finished.");
    }
Main loop for the audio decoder thread. Updates streaming sources.
jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java