当前位置: 首页>>代码示例>>Java>>正文


Java AtomicStampedReference.get方法代码示例

本文整理汇总了Java中java.util.concurrent.atomic.AtomicStampedReference.get方法的典型用法代码示例。如果您正苦于以下问题:Java AtomicStampedReference.get方法的具体用法?Java AtomicStampedReference.get怎么用?Java AtomicStampedReference.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.atomic.AtomicStampedReference的用法示例。


在下文中一共展示了AtomicStampedReference.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRunning

import java.util.concurrent.atomic.AtomicStampedReference; //导入方法依赖的package包/类
public void setRunning() {
    AtomicStampedReference<State> stateRef = state;
    int newStamp = stamp.incrementAndGet();
    int[] receiver = new int[1];
    // Keep trying until stateRef is set with our stamp
    for (;;) {
        State was = stateRef.get(receiver);
        if (was != State.STARTING) { // AS7-1103 only transition to running from STARTING
            break;
        }
        synchronized (service) {
            State newState = restartRequiredFlag ? State.RESTART_REQUIRED : State.RUNNING;
            if (state.compareAndSet(was, newState, receiver[0], newStamp)) {
                service.stateChanged(newState);
                break;
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:ControlledProcessState.java

示例2: setReloadRequired

import java.util.concurrent.atomic.AtomicStampedReference; //导入方法依赖的package包/类
public Object setReloadRequired() {
    if (!reloadSupported) {
        return setRestartRequired();
    }
    AtomicStampedReference<State> stateRef = state;
    int newStamp = stamp.incrementAndGet();
    int[] receiver = new int[1];
    // Keep trying until stateRef is RELOAD_REQUIRED with our stamp
    for (;;) {
        State was = stateRef.get(receiver);
        if (was == State.STARTING || was == State.STOPPING || was == State.RESTART_REQUIRED) {
            break;
        }
        synchronized (service) {
            if (stateRef.compareAndSet(was, State.RELOAD_REQUIRED, receiver[0], newStamp)) {
                service.stateChanged(State.RELOAD_REQUIRED);
                break;
            }
        }
    }
    return Integer.valueOf(newStamp);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:ControlledProcessState.java

示例3: setRestartRequired

import java.util.concurrent.atomic.AtomicStampedReference; //导入方法依赖的package包/类
public Object setRestartRequired() {
    AtomicStampedReference<State> stateRef = state;
    int newStamp = stamp.incrementAndGet();
    int[] receiver = new int[1];
    // Keep trying until stateRef is RESTART_REQUIRED with our stamp
    for (;;) {
        State was = stateRef.get(receiver);
        if (was == State.STARTING || was == State.STOPPING) {
            break;
        }
        synchronized (service) {
            if (stateRef.compareAndSet(was, State.RESTART_REQUIRED, receiver[0], newStamp)) {
                restartRequiredFlag = true;
                service.stateChanged(State.RESTART_REQUIRED);
                break;
            }
        }
    }
    return Integer.valueOf(newStamp);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:ControlledProcessState.java

示例4: containsKey

import java.util.concurrent.atomic.AtomicStampedReference; //导入方法依赖的package包/类
public boolean containsKey(int key){
	if(key == -1)
		return false;
	int[] stamp = new int[1];
	KAryBaseNode l = root.children.get(0).get(stamp);
	while( l!= null && !l.isLeaf()){
		AtomicStampedReference<KAryBaseNode> baseNode = searchKey(key, (KAryInternalNode)l);
		l = baseNode.get(stamp);
	}
	if(l == null){
		return false;
	}
	return ((KAryLeafNode)l).hasKey(key);
}
 
开发者ID:anandjbangad,项目名称:Non-Blocking-K--Ary-Search-Tree-Manual-Memory-Managgement,代码行数:15,代码来源:KArySearchTree.java


注:本文中的java.util.concurrent.atomic.AtomicStampedReference.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。