diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/FunctionalBridge.java b/Launcher/src/main/java/ru/gravit/launcher/client/FunctionalBridge.java index cc9499e7..6cfd4c3a 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/FunctionalBridge.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/FunctionalBridge.java @@ -9,6 +9,7 @@ import ru.gravit.launcher.request.websockets.RequestInterface; import ru.gravit.launcher.serialize.signed.SignedObjectHolder; import ru.gravit.utils.helper.CommonHelper; +import ru.gravit.utils.helper.LogHelper; import java.io.IOException; import java.nio.file.Path; @@ -58,6 +59,10 @@ public void makeJsonRequest(RequestInterface request, Runnable callback) @LauncherAPI public void startTask(Task task) { - worker.queue.offer(task); + try { + worker.queue.put(task); + } catch (InterruptedException e) { + LogHelper.error(e); + } } } diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/RequestWorker.java b/Launcher/src/main/java/ru/gravit/launcher/client/RequestWorker.java index 6cfbd202..6b8942c2 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/RequestWorker.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/RequestWorker.java @@ -18,9 +18,13 @@ public RequestWorker() public void run() { while (!Thread.interrupted()) { - Task task = queue.poll(); - if (task != null) { + try { + Task task; + task = queue.take(); task.run(); + } catch (InterruptedException e) { + LogHelper.error(e); + return; } } }