[FEATURE] Мост для старых Request

This commit is contained in:
Gravit 2019-01-28 23:29:54 +07:00
parent dd4f97313e
commit 0d804a0558
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,23 @@
package ru.gravit.launcher.request.websockets;
import ru.gravit.launcher.request.ResultInterface;
import java.io.IOException;
public class LegacyRequestBridge {
public static WaitEventHandler waitEventHandler = new WaitEventHandler();
public static ClientWebSocketService service;
public static ResultInterface sendRequest(RequestInterface request) throws IOException, InterruptedException {
WaitEventHandler.ResultEvent e = new WaitEventHandler.ResultEvent();
e.type = request.getType();
waitEventHandler.requests.add(e);
service.sendObject(request);
while(!e.ready)
{
e.wait();
}
ResultInterface result = e.result;
waitEventHandler.requests.remove(e);
return result;
}
}

View file

@ -21,7 +21,7 @@ public void process(ResultInterface result) {
} }
} }
} }
public class ResultEvent public static class ResultEvent
{ {
public ResultInterface result; public ResultInterface result;
public String type; public String type;