-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何解决异步线程不生效的问题 #18
Comments
你是说localCachePool = SpringUtils.getBean("localCachePool") ,你拿的localCachePool为null? |
|
比如:
private LocalClientInfo createNewClientInfo(Long clientId) { |
@sfomp 异步线程 是通过jdk自带线程池启动的,还是直接new Thread |
主线程中进行了mock静态方法,但是在主线程中待测试的代码中又启了新的线程,新的线程中也用到了前面mock的对象,但实际上获取不到值。这种情况如何解决。理论上jmockit也是用到了instrument的技术,内置的transformer生成的字节码会重新加载才对啊,对所有线程都是可用的。
@before
public void before() {
message = new CacheMessage();
.....
pushServant里面有异步处理逻辑,异步的这句 localCachePool = SpringUtils.getBean("localCachePool");实际是取不值。
The text was updated successfully, but these errors were encountered: