Replace `new Random()` with `ThreadLocalRandom`
- 主要言語
- Java
- スター
- 6.4k
- フォーク
- 1.2k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 115
説明
`ThreadLocalRandom` provides better performance than `Random`. I think we should replace the `Random` class except test files or example files.
I search the project files, the `Random` class in the following class or method should be replaced:
- Method: `org.apache.iotdb.influxdb.session.InfluxDBSession#reconnect`
- Class: `org.apache.iotdb.cluster.log.snapshot.PullSnapshotTask`
- Class: `org.apache.iotdb.cluster.server.heartbeat.HeartbeatThread`
- Abstract Class: `org.apache.iotdb.cluster.server.member.RaftMember`
- Class: `org.apache.iotdb.db.engine.modification.ModificationFile`
- Class: `org.apache.iotdb.db.engine.storagegroup.TsFileResource`
- Method: `org.apache.iotdb.db.service.thrift.impl.InternalServiceImpl#getHeartBeat`
- Method: `org.apache.iotdb.session.SessionConnection#reconnect`
- Class: `org.apache.iotdb.library.dprofile.UDTFSample`
- Class: `org.apache.iotdb.commons.udf.builtin.UDTFEqualSizeBucketRandomSample`
Related issue: #5880
コントリビューションガイド
調査の方向性
InfluxDBSession#reconnect、PullSnapshotTask、HeartbeatThread、RaftMember、ModificationFile、TsFileResource、InternalServiceImpl#getHeartBeat、SessionConnection#reconnect、UDTFSample、UDTFEqualSizeBucketRandomSample を含む、一覧にある Java クラスとメソッドを探します。テストファイルとサンプルファイルを除外し、Random の本番コードでの使用をすべて確認します。完了条件は、一覧にある対象の使用箇所が ThreadLocalRandom を使用し、関連する issue #5880 との整合性が保たれていることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- backend, databases
- issue の種類
- リファクタリング
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100