private void doFrame(int delay) { if (_waiting) { return; } if (_cacheQueue.isEmpty()) { _waiting = true; } else { FrameSyncData data = _cacheQueue.poll(); if (data.commands != null && !data.commands.isEmpty()) { data.commands.forEach(preExecuteCommand); } _scene.doFrame(delay); } }