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


Java Strand.park方法代码示例

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


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

示例1: await

import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
@Override
@Suspendable
public void await() throws InterruptedException {
	try{
		Strand.park(this);
	}catch (SuspendExecution e){
		throw new AssertionError();
	}

	if (Strand.interrupted()){
		throw new InterruptedException();
	}
}
 
开发者ID:nousxiong,项目名称:actorx4j,代码行数:14,代码来源:StrandSynchronizer.java

示例2: execute

import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
private boolean execute(Command command) throws InterruptedException, SuspendExecution {
	
	this.nextCommand = command;
	Strand.park();
	return this.lastCommandReturnValue;
}
 
开发者ID:OpenBW,项目名称:TSBW4J,代码行数:7,代码来源:WorkerActor.java

示例3: await

import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
public void await() throws SuspendExecution {
  waiter = Strand.currentStrand();
  while (running.get() > 0) {
    Strand.park();
  }
}
 
开发者ID:pinterest,项目名称:jbender,代码行数:7,代码来源:WaitGroup.java

示例4: park

import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
/**
 * Disables the current strand for scheduling purposes unless the
 * permit is available.
 * <p>
 * <p>
 * If the permit is available then it is consumed and the call returns
 * immediately; otherwise
 * the current strand becomes disabled for scheduling
 * purposes and lies dormant until one of three things happens:
 * <p>
 * <ul>
 * <li>Some other strand invokes {@link #unpark unpark} with the
 * current strand as the target; or
 * <p>
 * <li>Some other strand interrupts
 * the current strand; or
 * <p>
 * <li>The call spuriously (that is, for no reason) returns.
 * </ul>
 * <p>
 * <p>
 * This method does <em>not</em> report which of these caused the
 * method to return. Callers should re-check the conditions which caused
 * the strand to park in the first place. Callers may also determine,
 * for example, the interrupt status of the strand upon return.
 */
public static void park() {
    try {
        Strand.park();
    } catch (SuspendExecution e) {
        throw RuntimeSuspendExecution.of(e);
    }
}
 
开发者ID:icode,项目名称:ameba,代码行数:34,代码来源:Strands.java


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