/** * Starts the keep alive process. A white space (aka heartbeat) is going to be * sent to the server every 30 seconds (by default) since the last stanza was sent * to the server. */ void startKeepAliveProcess() { // Schedule a keep-alive task to run if the feature is enabled. will write // out a space character each time it runs to keep the TCP/IP connection open. int keepAliveInterval = SmackConfiguration.getKeepAliveInterval(); if (keepAliveInterval > 0) { KeepAliveTask task = new KeepAliveTask(keepAliveInterval); keepAliveThread = new Thread(task); task.setThread(keepAliveThread); keepAliveThread.setDaemon(true); keepAliveThread.setName("Smack Keep Alive (" + connection.connectionCounterValue + ")"); keepAliveThread.start(); } }
/** * Starts the keep alive process. A white space (aka heartbeat) is going to be * sent to the server every 30 seconds (by default) since the last stanza was sent * to the server. */ void startKeepAliveProcess() { // Schedule a keep-alive task to run if the feature is enabled. will write // out a space character each time it runs to keep the TCP/IP connection open. int keepAliveInterval = SmackConfiguration.getKeepAliveInterval(); if (keepAliveInterval > 0) { KeepAliveTask task = new KeepAliveTask(keepAliveInterval); keepAliveThread = new Thread(task); task.setThread(keepAliveThread); keepAliveThread.setDaemon(true); keepAliveThread.setName("Smack Keep Alive (" + connection.connectionCounterValue + ")"); keepAliveThread.start(); } }
/** * Creates a new packet writer with the specified connection. * * @param connection the connection. */ protected PacketWriter(XMPPConnection connection) { this.connection = connection; this.writer = connection.writer; this.queue = new LinkedList(); writerThread = new Thread() { public void run() { writePackets(); } }; writerThread.setName("Smack Packet Writer"); writerThread.setDaemon(true); // Schedule a keep-alive task to run if the feature is enabled. will write // out a space character each time it runs to keep the TCP/IP connection open. int keepAliveInterval = SmackConfiguration.getKeepAliveInterval(); if (keepAliveInterval > 0) { Thread keepAliveThread = new Thread(new KeepAliveTask(keepAliveInterval)); keepAliveThread.setDaemon(true); keepAliveThread.start(); } }