final Object lock = new Object();
Set sessionsCopy;
// Create a copy to avoid ConcurrentModificationException
synchronized (sessions) {
sessionsCopy = new IdentityHashSet(sessions);
}
for (Iterator i = sessionsCopy.iterator(); i.hasNext();) {
((IoSession) i.next()).close().addListener(new IoFutureListener() {
public void operationComplete(IoFuture future) {