mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Proposal for the Manager class to manage an ExecutorService for all SignalServiceMessageSender instances (#482)
* Modified the Manager class to provide an ExecuterService for the SignalServiceMessageSender. * removed unnesessary comment * Changed the ExecutorService to a unbounded newCachedThreadPool Co-authored-by: Cutkh <cutkh@users.noreply.github.com>
This commit is contained in:
parent
c276055302
commit
23df85ff90
1 changed files with 5 additions and 1 deletions
|
@ -167,6 +167,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -189,6 +190,8 @@ public class Manager implements Closeable {
|
|||
private final SignalServiceMessageReceiver messageReceiver;
|
||||
private final ClientZkProfileOperations clientZkProfileOperations;
|
||||
|
||||
private final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
private SignalServiceMessagePipe messagePipe = null;
|
||||
private SignalServiceMessagePipe unidentifiedMessagePipe = null;
|
||||
|
||||
|
@ -526,7 +529,6 @@ public class Manager implements Closeable {
|
|||
}
|
||||
|
||||
private SignalServiceMessageSender createMessageSender() {
|
||||
final ExecutorService executor = null;
|
||||
return new SignalServiceMessageSender(serviceEnvironmentConfig.getSignalServiceConfiguration(),
|
||||
account.getUuid(),
|
||||
account.getUsername(),
|
||||
|
@ -2533,6 +2535,8 @@ public class Manager implements Closeable {
|
|||
}
|
||||
|
||||
void close(boolean closeAccount) throws IOException {
|
||||
executor.shutdown();
|
||||
|
||||
if (messagePipe != null) {
|
||||
messagePipe.shutdown();
|
||||
messagePipe = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue