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


Java Strand.unpark方法代码示例

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


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

示例1: onFrame

import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
void onFrame(FrameUpdate frameUpdate) {
	
	this.frame = frameUpdate.getFrame();
	if (frame >= this.wakeUp) {
		
		if (this.nextCommand != null) {
			
			this.lastCommandReturnValue = this.nextCommand.execute();
			if (this.lastCommandReturnValue) { // TODO this is not guaranteed to return the error related to the command
			
				this.wakeUp = frame + this.nextCommand.getDelay();
			} else {
				BwError error = this.publicBoard.getInteractionHandler().getLastError();
				logger.warn("{} failed with error probably being {}", this.nextCommand, error);
			}
			logger.trace("frame {}: {} executed {} ({})", frame, this.scv, this.nextCommand, this.lastCommandReturnValue ? "success" : "failed");
			
			this.nextCommand = null;
			Strand.unpark(this.getStrand());
		}
	}
	this.sendOrInterrupt(frameUpdate);
}
 
开发者ID:OpenBW,项目名称:TSBW4J,代码行数:24,代码来源:WorkerActor.java

示例2: signal

import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
@Override
public void signal() {
	final Strand t = waiter;
	if (t != null){
		Strand.unpark(t);
	}
}
 
开发者ID:nousxiong,项目名称:actorx4j,代码行数:8,代码来源:StrandSynchronizer.java

示例3: unpark

import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
/**
 * Makes available the permit for the given strand, if it
 * was not already available. If the strand was blocked on
 * {@code park} then it will unblock. Otherwise, its next call
 * to {@code park} is guaranteed not to block. This operation
 * is not guaranteed to have any effect at all if the given
 * strand has not been started.
 *
 * @param strand the strand to unpark, or {@code null}, in which case this operation has no effect
 */
public static void unpark(Strand strand) {
    Strand.unpark(strand);
}
 
开发者ID:icode,项目名称:ameba,代码行数:14,代码来源:Strands.java


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