forked from External/mage
[load] one place server ping
This commit is contained in:
parent
e62f06cc54
commit
a746ca680b
8 changed files with 61 additions and 8 deletions
|
|
@ -85,6 +85,9 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
/**
|
||||
|
|
@ -116,6 +119,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static Map<UUID, TournamentPanel> tournaments = new HashMap<UUID, TournamentPanel>();
|
||||
private static MageUI ui = new MageUI();
|
||||
|
||||
private static ScheduledExecutorService pingTaskExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
/**
|
||||
* @return the session
|
||||
*/
|
||||
|
|
@ -193,6 +198,13 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
desktopPane.add(errorDialog, JLayeredPane.POPUP_LAYER);
|
||||
ui.addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
||||
|
||||
pingTaskExecutor.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
session.ping();
|
||||
}
|
||||
}, 60, 60, TimeUnit.SECONDS);
|
||||
|
||||
try {
|
||||
tablesPane = new TablesPane();
|
||||
desktopPane.add(tablesPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue