U
public int sendTextMessageSync(String text) {
try {
return executor.submit(() -> {
sendTextMessageImpl(text, id -> {
return id; // should be returned to future
});
}).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
типа так