hazelcast/hazelcast

Fix non-thread safe java.util.Date comparison in Predicates

Open

#8,828 opened on 2016年9月2日

GitHub で見る
 (8 comments) (0 reactions) (0 assignees)Java (5,737 stars) (1,795 forks)batch import
Module: IMapModule: QuerySource: InternalTeam: CoreType: Defectgood first issue

説明

The Comparable that's passed to a Predicate has to be thread-safe.

java.util.Date is a Java in-built class that implements the Comparable interface which is NOT thread safe.

The Predicate is sent to local and remote partitions. If there's more than one partition on each node (very likely) a Predicate instance will be re-used. It may lead to the corruption of the Date instance.

Main concern: We should create a wrapper of a Date to make it immutable and thread-safe whenever used in a Predicate.

Side concerns: Currently the comparison of java.util.Date, java.sql.Timestamp, java.sql.Time and java.sql.Time is not transitive between each combination of two of them. We should look into that too to make the comparison of such types better without conversion.

Fix will unblock #8035

コントリビューターガイド