Red5:可以将IConnection实例存储在HashMap中以供以后检索
|
我有一个这样定义的“ 0”
HashMap<String, IConnection> connections = new HashMap<String, IConnection>();
在应用程序connect
中,我像这样向其中添加值:
conn.setAttribute(“username”, username);
connections.put(username, conn); // username and conn are parameters passed to
// connect method
在内部应用程序disconnect
方法中,我像这样从中删除值
connections.remove((String)conn.getAttribute(“username”));
这似乎可行,但是正确/安全吗?还是我做错了?
没有找到相关结果
已邀请:
1 个回复
炉挤仙挟