Skip to content

version5关于令牌 #55

Description

@xmkd900

TokenBucketRateLimitImpl中的volatile是不是冗余的,curCapacity 与 lastTimestamp 字段的所有访问都在 synchronized (this) 块内完成,synchronized 已经保证了可见性和原子性。
注释中说synchronized说优化:同步仅限于关键部分,减少锁竞争,但是实际上还是把整个代码块锁起来了,跟加在方法上没有任何区别

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions