public static void closeSessions() { Iterator<Entry<String, Stack<SessionAndTransport>>> it = sessions.entrySet().iterator(); Entry<String, Stack<SessionAndTransport>> entry; Stack<SessionAndTransport> oldStack; Stack<SessionAndTransport> newStack; while (it.hasNext()) { entry = it.next(); oldStack = entry.getValue(); if (oldStack.isEmpty()) continue; newStack = new Stack<SMTPConnectionPool.SessionAndTransport>(); entry.setValue(newStack); closeSessions(oldStack, newStack); } }
private void doClearMailConnections() { SMTPConnectionPool.closeSessions(); }