ReCounters.java returns a counter without retries from create()
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
改动应放在 src/main/java/co/stateful/retry/ReCounters.java 中的 create,它目前直接返回 this.origin.create(name),没有包装。请与已经把结果包装为 ReCounter 的 get 对比,并以相同方式包装 create 的结果。当新建计数器上的 set 和 incrementAndGet 像通过 get 获得的计数器一样在 IOException 时重试,即视为完成。任务中没有指定测试文件,因此请检查是否已有可扩展的重试测试。
由索引模型根据 Issue 内容生成。
描述
ReCounters.create("hits") returns the original counter without a ReCounter wrapper. Consequently, new ReSttc(sttc).counters().create("hits").set(10L) propagates the first IOException from set, even if a second attempt would succeed. The same counter obtained through get("hits") has retry protection. This contradicts ReSttc's promise to retry requests and also affects incrementAndGet on a newly created counter.
In src/main/java/co/stateful/retry/ReCounters.java, lines 58–60:
public Counter create(final String name) throws IOException {
return this.origin.create(name);
}
The annotation on create retries creation itself; it cannot intercept later method calls on the returned original counter. get already wraps its result in ReCounter on line 79, whose set and incrementAndGet methods carry @RetryOnFailure.
Wrap the result of create in the same decorator:
public Counter create(final String name) throws IOException {
return new ReCounter(this.origin.create(name));
}
This one-line change gives counters returned by both entry points the same retry behavior.
- 主要语言
- Java
- 星标
- 10
- 派生
- 3
- 平均合并
- 4 小时 22 分钟
- 30 天内合并 PR
- 9
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sttc/java-sdk 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
MkCounter.name() returns the class name instead of the counter name, and MkCounters drops the name可能已有人在做 @yegor256 于 9 天前认领。 未关闭bug
sttc/java-sdk#142 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
wontfix
难度 1/5 1 小时以内 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
enhancement XS
难度 2/5 1-3 小时 新手友好度 68/100
nikolas-charalambidis/facepalm-maven-plugin#237 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
dekobon/big-code-analysis#1913 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug:unconfirmed
难度 2/5 1-3 小时 新手友好度 68/100
UniversalMediaServer/UniversalMediaServer#6473 ·
维护者通常 1 天内回复