Clearing code samples from internal API's and asserts.
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 重构
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- java
调研方向
首先查看链接的 code-samples pull request 和 AbstractCacheSplitBrainSample.java,尤其是第 105 行附近的 split-brain 示例。然后盘点 Common Utils assertions、节点访问、generateKeyOwnedBy 的使用情况以及抽象的 SplitBrainSamples 类。在不依赖内部 API 的情况下,确定一个经过同意且一致的 samples 简化范围,即视为完成。
由索引模型根据 Issue 内容生成。
描述
I don't know if it is discussed before. Our code samples use internal API, which caused compile problem in this release when changed. Fixed here https://github.com/hazelcast/hazelcast-code-samples/pull/303/files
The reason of usage seems to demonstrate some features are working. And it resembles our unit tests.
I think the code sample does not need that much verification. Since it is to show how hazelcast should be used, it is giving wrong advice.
Heaviest usage is around simulating the split brain. That requires access to node. I think this should not be part of the code samples. Configuring split brain on code samples make sense. But simulating the behavior I think is part of the unit tests.
https://github.com/hazelcast/hazelcast-code-samples/blob/master/jcache/src/main/java/com/hazelcast/examples/splitbrain/AbstractCacheSplitBrainSample.java#L105
I see generateKeyOwnedBy usage. I don't think we are advising this to our users. Make sense for tests but users should use affinity features instead of generating the key for a specific partition. And interestingly, this also accesses to node.
I think we also need rules for using assertions. We have the following methods on Common Utils. My gut feeling says that code samples should not do assert.
.assertClusterSizeEventually;
.assertEquals;
.assertOpenEventually;
I am keen to do the following
System.out.println(cache1.get("key1"));//prints 'value'
instead of
assertEquals("value",);
Lastly, I see abstract class usages too much. Especially around SplitBrainSamples. I think code samples should be one class and simple. Using abstractions to demonstrate simple usages will scare of the users. This again seems to be caused by simulating the split brain. When we remove that part, abstractions will go away too.
- 主要语言
- Java
- 星标
- 558
- 派生
- 599
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hazelcast/hazelcast-code-samples 的其他 Issue
-
[BUG] ClassLoader Leak / Metaspace OOM: Unmanaged static ThreadLocal<Kryo> in PersonKryoSerializer未关闭
难度 5/5 一周以上 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 2/5 1-3 小时 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
hazelcast/hazelcast-code-samples#553 · 4 条评论 ·
查看 hazelcast/hazelcast-code-samples 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
tchiotludo/akhq#3438 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
Paul-Austin-Oswego-CSC480-HCI521/gift-app#266 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
ome/bioformats#4509 ·
维护者通常 2 天内回复
-
module/email Type/Bug
难度 2/5 1-3 小时 新手友好度 79/100
ballerina-platform/ballerina-library#9758 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
Azure/azure-functions-java-worker#909 · 1 个 reaction ·