Home page takes long time to load when background job is running [message #1737083] |
Tue, 05 July 2016 10:48  |
Eclipse User |
|
|
|
My entry point class contructor has a long process handled by org.eclipse.core.runtime.jobs.Job. It looks like this
public class MyEntryPoint extends AbstractEntryPoint {
public MyEntryPoint() {
// fields initialization
service.setup();
}
}
Code of service.setup():
protected void setup(String name) {
MyJob job = new MyJob(name) {
@Override
protected IStatus run(IProgressMonitor monitor) {
exec();
return Status.OK_STATUS;
}
};
job.setUser(true);
job.schedule();
}
The job's exec() method can take up to 4 seconds to complete. It's all about model data setup without bothering UI. The issue is: when I start up the application, the home page is loaded (rendered in browser) in about the same long time. This is an observation by eyes. I used System.nanoTime to record the execution time for AbstractEntryPoint.createContents(Composite), it prints on console as around 900ms. But the page actually loaded very slow. The rap loading image is hung there for several seconds. I don't know how to measure this from front-end. The page loading time is noticeably reduced if I removed the long process job from the constructor.
Anybody knows why? Thanks
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09012 seconds