public void destroy() {
        synchronized (lock) {
            for (int i = 0; i < sessionList.size(); i++) {
                Session session = sessionList.remove(i);
                session.setNextState(Session.IoState.CLOSE);
                try {
                    SocketChannel s = session.getSocketChannel();
                    if (s != null && s.isOpen()) {
                        s.close();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
                session = null;
            }
            sessionList = null;
            logger.debug("Session pool is destroyed.");
        }
    }