mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Add automatically scheduled pings in PingManager
replaces keep-alive functionality. SMACK-537
This commit is contained in:
parent
54a421e84e
commit
3a4e6c6d39
5 changed files with 273 additions and 40 deletions
|
@ -30,6 +30,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -222,6 +226,8 @@ public abstract class Connection {
|
|||
|
||||
protected XMPPInputOutputStream compressionHandler;
|
||||
|
||||
private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(2);
|
||||
|
||||
/**
|
||||
* Create a new Connection to a XMPP server.
|
||||
*
|
||||
|
@ -951,4 +957,8 @@ public abstract class Connection {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
|
||||
return executorService.schedule(command, delay, unit);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue