Commit 4390497
committed
Fix concurrency issue in Text class
After updating the Text class to use ByteBuffer in #127666 we saw test
failures where similar Text instances are shared between different
threads and tested for equals(). The reason is that calling bytes()
lazily materializes the internal ByteBuffer. That method is what the
equals method calls on both instances it tests. Apparently this can
leads to race conditions when instances are shared across threads.
Making the internal `bytes` representation volatile fixes the problem.
Closes #1280291 parent d7aebb8 commit 4390497
File tree
1 file changed
+1
-1
lines changed- libs/x-content/src/main/java/org/elasticsearch/xcontent
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
0 commit comments