
org.objectweb.dream.protocol.messagePassing.overChannel.AnonymousSessionManager Maven / Gradle / Ivy
/**
* Dream
* Copyright (C) 2003-2004 INRIA Rhone-Alpes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: [email protected]
*
* Initial developer(s): Pierre Garcia
* Contributor(s):
*/
package org.objectweb.dream.protocol.messagePassing.overChannel;
import java.io.IOException;
import java.util.HashSet;
import org.objectweb.dream.util.LoggerUtil;
import org.objectweb.util.monolog.api.BasicLevel;
import org.objectweb.util.monolog.api.Logger;
/**
* Manage anonymous sessions.
*
* @author pgarcia
*/
public class AnonymousSessionManager extends HashSet {
/**
* Serial UID
*/
private static final long serialVersionUID = 2254369014602288421L;
/**
* Inherited logger
*/
private Logger logger;
/**
* Default constructor
*
* @param logger
*/
protected AnonymousSessionManager(Logger logger) {
this.logger = logger;
}
/**
* close all anonymous sessions
*/
public synchronized void closeAll() {
LoggerUtil.call(this.logger);
// close anonymous session.
for (Session session : this) {
try {
this.logger.log(BasicLevel.DEBUG, "Close " + session);
session.close();
} catch (IOException e) {
this.logger.log(BasicLevel.WARN, "Exception caught while closing lower session", e);
}
}
this.clear();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy