mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-28 09:24:15 -04:00
shut down http connections with 5s timeout
This commit is contained in:
parent
64aa052d83
commit
8600c0cb0d
6 changed files with 85 additions and 69 deletions
|
@ -35,7 +35,12 @@ public class ThreadUtils {
|
|||
private static final int POOL_SIZE = 10;
|
||||
private static final ExecutorService POOL = Executors.newFixedThreadPool(POOL_SIZE);
|
||||
|
||||
|
||||
/**
|
||||
* Execute the given command in a thread with the given id.
|
||||
*
|
||||
* @param command the command to execute
|
||||
* @param threadId the thread id
|
||||
*/
|
||||
public static void execute(Runnable command, String threadId) {
|
||||
synchronized (EXECUTORS) {
|
||||
if (!EXECUTORS.containsKey(threadId)) EXECUTORS.put(threadId, Executors.newFixedThreadPool(1));
|
||||
|
@ -107,6 +112,8 @@ public class ThreadUtils {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: consolidate and cleanup apis
|
||||
|
||||
public static Future<?> submitToPool(Runnable task) {
|
||||
return submitToPool(Arrays.asList(task)).get(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue