本文整理汇总了Java中java.util.concurrent.atomic.AtomicStampedReference.getReference方法的典型用法代码示例。如果您正苦于以下问题:Java AtomicStampedReference.getReference方法的具体用法?Java AtomicStampedReference.getReference怎么用?Java AtomicStampedReference.getReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.concurrent.atomic.AtomicStampedReference
的用法示例。
在下文中一共展示了AtomicStampedReference.getReference方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: status
import java.util.concurrent.atomic.AtomicStampedReference; //导入方法依赖的package包/类
@Override
public WorkloadStatusSnapshot status() throws MetricsCollectionException
{
if ( null != alreadyShutdownPolicy )
{
alreadyShutdownPolicy.apply();
}
AtomicStampedReference<WorkloadStatusSnapshot> statusSnapshotReference = eventHandler.statusSnapshot();
int oldStamp = statusSnapshotReference.getStamp();
ringBuffer.publishEvent( getWorkloadStatusTranslator );
while ( statusSnapshotReference.getStamp() <= oldStamp )
{
LockSupport.parkNanos( TimeUnit.MILLISECONDS.toNanos( 100 ) );
}
return statusSnapshotReference.getReference();
}
示例2: results
import java.util.concurrent.atomic.AtomicStampedReference; //导入方法依赖的package包/类
@Override
public WorkloadResultsSnapshot results() throws MetricsCollectionException
{
if ( null != alreadyShutdownPolicy )
{
alreadyShutdownPolicy.apply();
}
AtomicStampedReference<WorkloadResultsSnapshot> resultsSnapshotReference = eventHandler.resultsSnapshot();
int oldStamp = resultsSnapshotReference.getStamp();
ringBuffer.publishEvent( getWorkloadResultsTranslator );
while ( resultsSnapshotReference.getStamp() <= oldStamp )
{
LockSupport.parkNanos( TimeUnit.MILLISECONDS.toNanos( 100 ) );
}
return resultsSnapshotReference.getReference();
}
示例3: helpMarked
import java.util.concurrent.atomic.AtomicStampedReference; //导入方法依赖的package包/类
private void helpMarked(DeleteInfo info){
int[]stamp = new int[1];
KAryBaseNode other = info.p.children.get(info.p.keyCount).get(stamp);
int index = 0;
for(int i = 0; i < info.p.keyCount ;++i){
KAryBaseNode u = info.p.children.get(i).getReference();
if( u!= null && u.keyCount > 0 && u != info.oldChild ){
other = u;
index = i;
break;
}
}
boolean casValue = false;
casValue = info.gp.children.get(info.gpindex).compareAndSet(info.p, other, info.parentStamp, info.parentStamp+1);
if(casValue){
KAryInternalNode parentNode = (KAryInternalNode)info.p;
for(int i = 0; i < K ; ++i){
AtomicStampedReference<KAryBaseNode> recycledStamp;
KAryBaseNode recycledNode;
if(i != info.pindex){
recycledStamp = parentNode.children.get(i);
recycledNode = recycledStamp.getReference();
//recycledStamp.set(null,stamp[0]+1);
if(recycledNode != null){
for(int j = 0; j < K-1; ++j ){
recycledNode.keys[j] = Integer.MAX_VALUE;
}
recycledNode.keyCount = 0;
moveToLeafFree(recycledNode);
}
}
}
parentNode.info = new Clean();
parentNode.keyCount = 0;
moveToInternalFree(parentNode);
infoUpdater.compareAndSet((KAryInternalNode)info.gp, info, new Clean());
}
}
开发者ID:anandjbangad,项目名称:Non-Blocking-K--Ary-Search-Tree-Manual-Memory-Managgement,代码行数:41,代码来源:KArySearchTree.java