コード例 #1
0
 public void lazySet(T obj, V newValue) {
   if (obj == null
       || obj.getClass() != tclass
       || cclass != null
       || (newValue != null && vclass != null && vclass != newValue.getClass()))
     updateCheck(obj, newValue);
   unsafe.putOrderedObject(obj, offset, newValue);
 }
コード例 #2
0
 public boolean compareAndSet(T obj, V expect, V update) {
   if (obj == null
       || obj.getClass() != tclass
       || cclass != null
       || (update != null && vclass != null && vclass != update.getClass()))
     updateCheck(obj, update);
   return unsafe.compareAndSwapObject(obj, offset, expect, update);
 }
コード例 #3
0
 public boolean weakCompareAndSet(T obj, V expect, V update) {
   // same implementation as strong form for now
   if (obj == null
       || obj.getClass() != tclass
       || cclass != null
       || (update != null && vclass != null && vclass != update.getClass()))
     updateCheck(obj, update);
   return unsafe.compareAndSwapObject(obj, offset, expect, update);
 }
コード例 #4
0
 public boolean containsValue(final V val) {
   final byte[] states = this._states;
   final V[] vals = (V[]) this._values;
   if (null == val) {
     int i = vals.length;
     while (i-- > 0) {
       if (states[i] == 1 && val == vals[i]) {
         return true;
       }
     }
   } else {
     int i = vals.length;
     while (i-- > 0) {
       if (states[i] == 1 && (val == vals[i] || val.equals(vals[i]))) {
         return true;
       }
     }
   }
   return false;
 }