本文整理汇总了Java中org.red5.server.api.IConnection.close方法的典型用法代码示例。如果您正苦于以下问题:Java IConnection.close方法的具体用法?Java IConnection.close怎么用?Java IConnection.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.server.api.IConnection
的用法示例。
在下文中一共展示了IConnection.close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: disconnect
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
/**
* Disconnects client from Red5 application
*/
public void disconnect() {
if (disconnected.compareAndSet(false, true)) {
log.debug("Disconnect - id: {}", id);
if (connections != null && !connections.isEmpty()) {
log.debug("Closing {} scope connections", connections.size());
// close all connections held to Red5 by client
for (IConnection con : getConnections()) {
try {
con.close();
} catch (Exception e) {
// closing a connection calls into application code, so exception possible
log.error("Unexpected exception closing connection {}", e);
}
}
} else {
log.debug("Connection map is empty or null");
}
// unregister client
removeInstance();
}
}
示例2: closeAlreadyOpenedStreamsForUser
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
private void closeAlreadyOpenedStreamsForUser(int userIndex, String streamName) {
Set<IConnection> connections = Red5.getConnectionLocal().getScope().getClientConnections();
for (IConnection conn : connections) {
Object connUserIndex = conn.getAttribute("userIndex");
Object connUserName = conn.getAttribute("userName");
Object connStreamName = conn.getAttribute("streamName");
if (connUserIndex != null && connUserIndex.equals(userIndex) &&
connStreamName != null && connStreamName.equals(streamName)) {
log.info("closing already opened stream for user " + connUserName);
conn.close();
}
}
}