Skip to content
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

最高优先级拦截器初始化未完成相当于greenChannel #733

Closed
liaodq opened this issue Sep 3, 2019 · 4 comments
Closed

最高优先级拦截器初始化未完成相当于greenChannel #733

liaodq opened this issue Sep 3, 2019 · 4 comments
Labels

Comments

@liaodq
Copy link

liaodq commented Sep 3, 2019

doInterceptions方法里有对Warehouse.interceptors的判断

if (null != Warehouse.interceptors && Warehouse.interceptors.size() > 0){
      checkInterceptorsInitStatus();
      ......
}

Warehouse.interceptors是在InterceptorServiceImpl#init里新线程里完成添加的

         IInterceptor iInterceptor = interceptorClass.getConstructor().newInstance();
         iInterceptor.init(context);
         Warehouse.interceptors.add(iInterceptor);

也就是说如果第一个Interceptor#init还没完成的话,InterceptorServiceImpl#doInterceptions是直接执行callback.onContinue(postcard)

@tankcong
Copy link

tankcong commented Nov 3, 2019

测试确实有这个问题
这样复现:
代码里首个Activity#onCreate直接拉起需要经过Interceptor处理的目的页,这样在进程第一次加载大概率会发现Interceptor init是在onContinue之后,进程启动以后(也就是interceptor init之后),就不会有这个问题。
分析日志即可看出。

@tankcong
Copy link

tankcong commented Nov 4, 2019

补一条日志吧:

2019-11-04 14:42:41.041 I/ARouter::: ARouter openLog[ ] 
2019-11-04 14:42:41.041 I/ARouter::: ARouter openDebug[ ] 
2019-11-04 14:42:41.041 I/ARouter::: ARouter init start.[ ] 
2019-11-04 14:42:41.049 I/ARouter::: Load router map by arouter-auto-register plugin.[ ] 
2019-11-04 14:42:41.049 I/ARouter::: Load root element finished, cost 7 ms.[ ] 
2019-11-04 14:42:41.050 I/ARouter::: ARouter init success![ ] 
2019-11-04 14:42:41.053 I/ARouter::: Thread production, name is [ARouter task pool No.1, thread No.1][ ] 
2019-11-04 14:42:41.054 I/ARouter::: ARouter init over.[ ] 
2019-11-04 14:42:41.241 I/timber-_ARouter: splash onArrival
2019-11-04 14:42:41.321 I/ARouter::: ARouter interceptors init over.[ ] 

注意这里splash onArrival之后Arouter才 interceptors init over.

@zhi1ong
Copy link
Member

zhi1ong commented Dec 24, 2019

嗯,有问题

@roel1975
Copy link

嗯,有问题
English please

@zhi1ong
Copy link
Member

zhi1ong commented Oct 20, 2020

1.5.1 修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants