equal
deleted
inserted
replaced
1 Testcase shows default deserialisation of the Victim having two values for the same field. |
|
2 |
|
3 Probably requires dual core to run successfully. |
|
4 |
|
5 Reading thread is warmed up so that it can easily win the race for the demonstration, but this means we need to make the field volatile. |
|
6 |
|
7 Typical output: |
|
8 |
|
9 Victim@1551f60 BBBB |
|
10 Victim@1551f60 AAAA |
|
11 |
|
12 The output when its fixed is, |
|
13 Victim@1975b59 AAAA |
|
14 Victim@1975b59 AAAA - The value is retained |
|
15 |
|
16 and when it is not fixed, it shows something like |
|
17 Victim@173a10f AAAA |
|
18 Victim@173a10f BBBB - the value of the object gets set again and hence is different. This is a bug |
|
19 |
|
20 Look at the |
|
21 AAAA AAAA |
|
22 and |
|
23 AAAA BBBB |
|