Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnlineWebSessionManager重写的setAttribute方法起到了什么作用? #243

Open
FubinSama opened this issue Jun 6, 2024 · 0 comments

Comments

@FubinSama
Copy link

我想知道OnlineWebSessionManager重写的setAttribute方法起到了什么作用?

image image

getOnlineSession的逻辑是:

  1. 从sessionDao中读取session对象s0
  2. 创建一个新的OnlineSession对象s1
  3. 将s0的属性赋值给s1
  4. 返回s1

而setAttribute里只是将这个新创建的s1attributeChanged属性设置为了true,然后方法就返回了。

看起来对attribute修改的监听没有作用到真实的session对象上,而对一个只被该方法内的局部变量有引用的对象进行了操作。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant