mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Use static threadPool and start working on async file transfer method
This commit is contained in:
parent
71486ab68e
commit
f26f3bb503
7 changed files with 65 additions and 6 deletions
|
@ -19,6 +19,8 @@ package org.jivesoftware.smackx.jingle;
|
|||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -44,6 +46,12 @@ public final class JingleManager extends Manager {
|
|||
|
||||
private static final Map<XMPPConnection, JingleManager> INSTANCES = new WeakHashMap<>();
|
||||
|
||||
private static final ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
|
||||
public static ExecutorService getThreadPool() {
|
||||
return threadPool;
|
||||
}
|
||||
|
||||
public static synchronized JingleManager getInstanceFor(XMPPConnection connection) {
|
||||
JingleManager jingleManager = INSTANCES.get(connection);
|
||||
if (jingleManager == null) {
|
||||
|
|
|
@ -19,8 +19,6 @@ package org.jivesoftware.smackx.jingle;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -48,7 +46,6 @@ public abstract class JingleSession implements JingleSessionHandler {
|
|||
|
||||
protected final List<JingleContent> contents = new ArrayList<>();
|
||||
|
||||
protected static ExecutorService threadPool = Executors.newSingleThreadExecutor();
|
||||
protected ArrayList<Future<?>> queued = new ArrayList<>();
|
||||
protected JingleTransportSession<?> transportSession;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue