简单介绍
https://docs.paralleluniverse.co/quasar/
环境配置
Quasar fibers rely on bytecode instrumentation. This can be done at classloading time via a Java Agent, or at compilation time with an Ant task.
我们采取用maven插件的办法来对我们的代码进行instrumentation
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>instrument-classes</id>
<phase>compile</phase>
<configuration>
<tasks>
<property name="ant_classpath" refid="maven.dependency.classpath"/>
<taskdef name="instrumentationTask"
classname="co.paralleluniverse.fibers.instrument.InstrumentationTask"
classpath="${ant_classpath}"/>
<instrumentationTask allowMonitors="true" allowBlocking="true" check="true"
verbose="true" debug="true">
<fileset dir="${project.build.directory}/classes/" includes="**/*"/>
</instrumentationTask>

本文介绍了Quasar Fiber的工作原理和技术细节,包括如何通过字节码增强实现线程切换,并对比了线程池与Fiber在执行效率上的差异。
最低0.47元/天 解锁文章
290

被折叠的 条评论
为什么被折叠?



