aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-01 17:04:59 +0300
committerGravatar Vitaly Takmazov2016-12-01 17:06:17 +0300
commit6c8b3cdf36d33e3da2ae94a5ef89243579a57b89 (patch)
tree26aacc94280e3eab44a06281ad6eeb5bf9259744 /juick-api/src/main/java/com/juick
parent6740414d1a89c3ad34306c72bd9d2aba28fe524a (diff)
juick-api: start telegram bot in different thread
Diffstat (limited to 'juick-api/src/main/java/com/juick')
-rw-r--r--juick-api/src/main/java/com/juick/api/TGBot.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/juick-api/src/main/java/com/juick/api/TGBot.java b/juick-api/src/main/java/com/juick/api/TGBot.java
index d532b02cf..bbfed259f 100644
--- a/juick-api/src/main/java/com/juick/api/TGBot.java
+++ b/juick-api/src/main/java/com/juick/api/TGBot.java
@@ -24,6 +24,8 @@ import javax.inject.Inject;
import java.io.IOException;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import static com.juick.formatters.PlainTextFormatter.formatPost;
import static com.juick.formatters.PlainTextFormatter.formatUrl;
@@ -43,6 +45,8 @@ public class TGBot implements AutoCloseable {
@Inject
MessagesService messagesService;
+ ExecutorService service = Executors.newSingleThreadExecutor();
+
private TGBot() {
throw new IllegalStateException();
}
@@ -102,7 +106,7 @@ public class TGBot implements AutoCloseable {
}
}
});
- ws.connect();
+ service.submit(() -> ws.connect());
} catch (Exception e) {
logger.warn("couldn't initialize telegram bot", e);
}