Acceptable answers after looking at answers, comments and jls-17.4.2
1) anti-symmetric property holds like pointed by - user3707125
2) the hb relationship between locks is actually between unlocking and locking
hb(ul, l) which is not same as hb(l, ul). Hinted by - shmosel
From JSL -
An unlock on a monitor happens-before every subsequent lock on that monitor.
3) and reasonable explanation of hb by james-large
Actual question was:
The java memory model(JMM) describes happens before relationships between several actions. If "x" and "y" are two actions with h(x,y) relation between them. JMM also states that implementations (compiler, run time or hardware) are free to re-order these executions if they achieve the same result as executing "x" and then "y" sequentially.
So i think that,
hb(x,y) != hb(y,x)
Am I right? Or did I miss something?
Update:
Also for actions which involve locks how can a hb relation be established. As the event of locking by different threads can not be defined by program order, and is so just not deterministic and depends on several factors like instructions and scheduler etc.
So between two locking actions - l1 and l2 how to define the relationship hb(l1, l2) or hb(l2, l1). Seems both are acceptable. In this case both seems equal.
l1 and l2 are locking actions on same Object. l1 and l2 are not locks
Clarification (based on comments): Locking actions are definitely mutually exclusive when locking is to be done on same Object by different threads.
Yes, the implementation is allowed to reorder operations, but only within reasonable limits. The happens before relationships defined in the Java Language Specification (JLS) are there specifically to define the limits of what can be reordered.
If the JLS says that x happens before y, that means that the implementation is not allowed to do any reordering that would create the appearance of y happening before x.