2 ** ________ ___ / / ___ Scala API **
3 ** / __/ __// _ | / / / _ | (c) 2003-2012, LAMP/EPFL **
4 ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
5 ** /____/\___/_/ |_/____/_/ | | **
9 package org.opendaylight.yangtools.triemap;
11 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
13 abstract class MainNode<K, V> extends BasicNode {
15 public static final AtomicReferenceFieldUpdater<MainNode, MainNode> updater = AtomicReferenceFieldUpdater.newUpdater (MainNode.class, MainNode.class, "prev");
17 public volatile MainNode<K, V> prev = null;
19 public abstract int cachedSize (Object ct);
21 public boolean CAS_PREV (MainNode<K, V> oldval, MainNode<K, V> nval) {
22 return updater.compareAndSet (this, oldval, nval);
25 public void WRITE_PREV (MainNode<K, V> nval) {
26 updater.set (this, nval);
29 // do we need this? unclear in the javadocs...
30 // apparently not - volatile reads are supposed to be safe
31 // regardless of whether there are concurrent ARFU updates
32 public MainNode<K, V> READ_PREV () {
33 return updater.get (this);