| 
JavaTM 2 Platform Standard Ed. 5.0  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.util.concurrent.atomic.AtomicStampedReference<V>
V - 此引用所引用的对象类型。public class AtomicStampedReference<V>
AtomicStampedReference 维护带有整数“标志”的对象引用,可以原子方式对其进行更新。
实现注意事项。通过创建表示“已装箱”的 [reference, integer] 对的内部对象,此实现维持带标志的引用。
| 构造方法摘要 | |
|---|---|
AtomicStampedReference(V initialRef,
                       int initialStamp)
使用给定的初始值创建新的 AtomicStampedReference。  | 
|
| 方法摘要 | |
|---|---|
 boolean | 
attemptStamp(V expectedReference,
             int newStamp)
如果当前引用 == 预期引用,则以原子方式将该标志的值设置为给定的更新值。  | 
 boolean | 
compareAndSet(V expectedReference,
              V newReference,
              int expectedStamp,
              int newStamp)
如果当前引用 == 预期引用,并且当前标志等于预期标志,则以原子方式将该引用和该标志的值设置为给定的更新值。  | 
 V | 
get(int[] stampHolder)
返回该引用和该标志的当前值。  | 
 V | 
getReference()
返回该引用的当前值。  | 
 int | 
getStamp()
返回该标志的当前值。  | 
 void | 
set(V newReference,
    int newStamp)
无条件地同时设置该引用和标志的值。  | 
 boolean | 
weakCompareAndSet(V expectedReference,
                  V newReference,
                  int expectedStamp,
                  int newStamp)
如果当前引用 == 预期引用,并且当前标志等于预期标志,则以原子方式将该引用和该标志的值设置为给定的更新值。  | 
| 从类 java.lang.Object 继承的方法 | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 构造方法详细信息 | 
|---|
public AtomicStampedReference(V initialRef,
                              int initialStamp)
initialRef - 初始引用initialStamp - 初始标志| 方法详细信息 | 
|---|
public V getReference()
public int getStamp()
public V get(int[] stampHolder)
stampHolder - 大小至少为 1 的数组。返回时,stampholder[0] 将保存该标志的值。
public boolean weakCompareAndSet(V expectedReference,
                                 V newReference,
                                 int expectedStamp,
                                 int newStamp)
expectedReference - 该引用的预期值newReference - 该引用的新值expectedStamp - 该标志的预期值newStamp - 该标志的新值
public boolean compareAndSet(V expectedReference,
                             V newReference,
                             int expectedStamp,
                             int newStamp)
expectedReference - 该引用的预期值newReference - 该引用的新值expectedStamp - 该标志的预期值newStamp - 该标志的新值
public void set(V newReference,
                int newStamp)
newReference - 该引用的新值newStamp - 该标志的新值
public boolean attemptStamp(V expectedReference,
                            int newStamp)
expectedReference - 该引用的预期值newStamp - 该标志的新值
  | 
JavaTM 2 Platform Standard Ed. 5.0  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。