jdk/test/java/io/Serializable/6966692/README
changeset 7034 a31042b569d0
parent 7031 d77ff2048ad5
child 7035 7c0095d515e3
equal deleted inserted replaced
7031:d77ff2048ad5 7034:a31042b569d0
     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