We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
如题,在Application的onCreate方法中,在使用后台线程进行懒加载Router.lazyInit()。同时onCreate的主线程中使用了Router.getService,导致偶现路由跳转页面失败。调试后发现是路由表ServiceLoaderInit类的init方法还没有执行完成,就开始调用了UriAnnotationHandler的performInit方法。
请问这种情况应该怎么处理。
` public class MApplication extends Application {
public void onCreate() { DefaultRootUriHandler rootHandler = new DefaultRootUriHandler(context); Router.init(rootHandler); // 懒加载后台初始化(可选) new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... voids) { Router.lazyInit(); return null; } }.execute(); ... Router.getService(IHomeMineModule.class, "homemine"); }
}
`
The text was updated successfully, but these errors were encountered:
Router.lazyInit()和UriAnnotationHandler中的init都调用了LazyInitHelper,有用synchronized做线程同步处理。理论上来说如果lazyInit还没执行完,主线程会等待lazyInit执行结束再跳转,不会出现跳转失败的情况。
Sorry, something went wrong.
No branches or pull requests
如题,在Application的onCreate方法中,在使用后台线程进行懒加载Router.lazyInit()。同时onCreate的主线程中使用了Router.getService,导致偶现路由跳转页面失败。调试后发现是路由表ServiceLoaderInit类的init方法还没有执行完成,就开始调用了UriAnnotationHandler的performInit方法。
请问这种情况应该怎么处理。
`
public class MApplication extends Application {
}
`
The text was updated successfully, but these errors were encountered: