提交 c8c5ae73 authored 作者: Thomas Mueller's avatar Thomas Mueller

synchronization bugfix

上级 fd19757d
...@@ -1469,7 +1469,12 @@ public class Database implements DataHandler { ...@@ -1469,7 +1469,12 @@ public class Database implements DataHandler {
* @return the list of sessions * @return the list of sessions
*/ */
public Session[] getSessions(boolean includingSystemSession) { public Session[] getSessions(boolean includingSystemSession) {
ArrayList<Session> list = New.arrayList(userSessions); ArrayList<Session> list;
// need to synchronized on userSession, otherwise the list
// may contain null elements
synchronized (userSessions) {
list = New.arrayList(userSessions);
}
// copy, to ensure the reference is stable // copy, to ensure the reference is stable
Session sys = systemSession; Session sys = systemSession;
if (includingSystemSession && sys != null) { if (includingSystemSession && sys != null) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论