[YANGTOOLS-1024] DataTree state management does not require volatile Created: 05/Sep/19 Updated: 09/Oct/19 Resolved: 09/Oct/19 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | data-impl |
| Affects Version/s: | None |
| Fix Version/s: | 4.0.2 |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
With JDK9+ we get more fine-grained memory model, hence we can go in between ordinary and volatile access. InMemoryDataTree.state publishing is an area where we publish an effectively-final object, hence under safe publishing we can not order against all other volatiles if we use acquire/release locking. This helps JIT a bit, as it gives it more freedom to reorder memory access. Use VarHandles to implement this, so that we do not use volatile access. |