Add null check for pubsub.

This commit is contained in:
FireMasterK 2021-07-21 02:57:28 +05:30
parent a1ed146924
commit e03f2661b4
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
1 changed files with 10 additions and 9 deletions

View File

@ -44,15 +44,16 @@ public class Main {
Collections.shuffle(channels);
for (String channelId : channels)
Multithreading.runAsyncLimitedPubSub(() -> {
Session sess = DatabaseSessionFactory.createSession();
try {
ResponseHelper.subscribePubSub(channelId, sess);
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
sess.close();
});
if (channelId != null)
Multithreading.runAsyncLimitedPubSub(() -> {
Session sess = DatabaseSessionFactory.createSession();
try {
ResponseHelper.subscribePubSub(channelId, sess);
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
sess.close();
});
s.close();
} catch (Exception e) {