本文整理汇总了Java中org.jetlang.fibers.PoolFiberFactory类的典型用法代码示例。如果您正苦于以下问题:Java PoolFiberFactory类的具体用法?Java PoolFiberFactory怎么用?Java PoolFiberFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PoolFiberFactory类属于org.jetlang.fibers包,在下文中一共展示了PoolFiberFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: AsyncProcessor
import org.jetlang.fibers.PoolFiberFactory; //导入依赖的package包/类
public AsyncProcessor() {
ExecutorService exec = Executors.newCachedThreadPool();
PoolFiberFactory factory = new PoolFiberFactory(exec);
this.fiberThread = factory.create();
//回调方法
Callback<List<NMessage>> callback = new AsyncCallback(this);
//像消息通道注册消息处理观察者
BatchSubscriber<NMessage> batchSubscriber = new BatchSubscriber<NMessage>(this.fiberThread, callback, 30, TimeUnit.MILLISECONDS);
this.messageChannel.subscribe(this.fiberThread, batchSubscriber);
}
开发者ID:ninelook,项目名称:wecard-server,代码行数:14,代码来源:AsyncProcessor.java
示例2: InRamSim
import org.jetlang.fibers.PoolFiberFactory; //导入依赖的package包/类
public InRamSim(final int peerSize) {
this.peerSize = peerSize;
this.fiberPool = new PoolFiberFactory(Executors.newCachedThreadPool());
Random r = new Random();
for (int i = 0; i < peerSize; i++) {
peerUUIDs.add((long)r.nextInt());
}
long plusMillis = 0;
for( long peerId : peerUUIDs) {
// make me a ....
FleaseLease fl = new FleaseLease(fiberPool.create(), new Info(plusMillis), ""+peerId, "lease", peerId, peerUUIDs, rpcChannel);
fleaseRunners.put(peerId, fl);
plusMillis += 500;
}
rpcFiber = fiberPool.create();
// subscribe to the rpcChannel:
rpcChannel.subscribe(rpcFiber, new Callback<Request<OutgoingRpcRequest, IncomingRpcReply>>() {
@Override
public void onMessage(Request<OutgoingRpcRequest, IncomingRpcReply> message) {
messageForwarder(message);
}
});
rpcFiber.start();
}
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:31,代码来源:InRamSim.java
示例3: setup
import org.jetlang.fibers.PoolFiberFactory; //导入依赖的package包/类
/** Setup all "services" for all test methods.
* @throws Exception */
@Before
public void setup() throws Exception {
if (testDirect || testJetLang || Benchmark10MTest.testExecutorService) {
executorService = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
}
if (Benchmark10MTest.testAkkaBlocking
|| Benchmark10MTest.testAkkaNonBlocking) {
final ConfigValue num = ConfigValueFactory
.fromAnyRef(THREAD_POOL_SIZE);
final Config config = ConfigFactory
.load()
.withValue(
"akka.actor.default-dispatcher.fork-join-executor.parallelism-max",
num)
.withValue(
"akka.actor.default-dispatcher.thread-pool-executor.core-pool-size-max",
num)
.withValue(
"akka.actor.default-dispatcher.thread-pool-executor.max-pool-size-max",
num);
system = ActorSystem.create("AkkaTest", config);
}
if (testJActorIterator || testJActorStackOverflow
|| Benchmark10MTest.testJActorBlocking) {
jaMailboxFactory = JAMailboxFactory
.newMailboxFactory(THREAD_POOL_SIZE);
}
if (testJetLang) {
fiberPool = new PoolFiberFactory(executorService);
}
if (testJActor2Local || testJActor2SharedNonBlocking
|| Benchmark10MTest.testJActor2NonBlocking
|| Benchmark10MTest.testJActor2Isolation) {
new IsolationFriendlyPlantMtImpl(THREAD_POOL_SIZE);
}
}
开发者ID:skunkiferous,项目名称:PingPong,代码行数:39,代码来源:Benchmark100MTest.java
示例4: configure
import org.jetlang.fibers.PoolFiberFactory; //导入依赖的package包/类
@Override
protected void configure() {
install(new StateModule(timeout));
PoolFiberFactory fiberFactory = new PoolFiberFactory(executor);
Fiber raftFiber = fiberFactory.create(new BatchExecutor());
raftFiber.start();
bind(Fiber.class).annotatedWith(RaftExecutor.class).toInstance(raftFiber);
Fiber stateMachineFiber = fiberFactory.create(new BatchExecutor());
stateMachineFiber.start();
install(new LogModule(logDir, stateMachine, stateMachineFiber));
bind(ClusterConfig.class).toInstance(config);
bind(Client.class).asEagerSingleton();
expose(Raft.class);
expose(ClusterConfig.class);
}
开发者ID:mgodave,项目名称:barge,代码行数:23,代码来源:RaftCoreModule.java
注:本文中的org.jetlang.fibers.PoolFiberFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论