@Override
        public void run() {
            // Do nothing if this feature is disabled
            int idleTime = SessionManager.getInstance().getServerSessionIdleTime();
            if (idleTime == -1) {
                return;
            }
            final long deadline = System.currentTimeMillis() - idleTime;
            for (OutgoingServerSession session : localServerRoutingTable.getRoutes()) {
                // Check outgoing server sessions
                try {
                    if (session.getLastActiveDate().getTime() < deadline) {
                        Log.debug("ServerCleanupTask is closing an outgoing server session that has been idle for a long time. Last active: {}. Session to be closed: {}", session.getLastActiveDate(), session);
                        session.close();
                    }
                }
                catch (Throwable e) {
                    Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
                }
            }
        }
Close outgoing server sessions that have been idle for a long time.
xmppserver/src/main/java/org/jivesoftware/openfire/spi/RoutingTableImpl.java