Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » My RCP application start up changed from 3.2 to 3.3
My RCP application start up changed from 3.2 to 3.3 [message #324207] Sat, 19 January 2008 19:29 Go to next message
Eclipse UserFriend
I have an RCP application which takes about 60 seconds to start up. A
portion of that is database initialization that does not need to be done
before the GUI comes up. Using 3.2 I had my startup time (for the GUI to
appear) down to 45s with the additional work happening on a separate
thread and completing 20s or so after that.

I have updated my application to use 3.3 (I wanted some of the SWT
enhancements) and now I see that the GUI does not appear until after my
initialization thread is finished. I did change from IPlatformRunnable to
IApplication for my app but that did not help.

The second thread is launched from the start method of one of my
application's plug-ins with code like this:

new Thread (new Runnable () {

public void run () {
try {
// Delay the start so the rest of the application can
get a head start
Thread.sleep (200);
} catch (InterruptedException e) {

try {
... do a bunch of work here...
} catch (CoreException e) {
DataAccessPlugin.getInstance ().getLog ().log
(ErrorFactory.createStatusObject (
DataAccessPlugin.getID (), e,

DataAccessErrorCodes.WARNING_PRELOADING_FAILED));
} finally {
if (connection != null) {
try {
connection.close ();
} catch (SQLException e) {
DataAccessPlugin.getInstance ().getLog ().log
(ErrorFactory.createStatusObject (
DataAccessPlugin.getID (), e,

DataAccessErrorCodes.WARNING_PRELOADING_FAILED));
}
}
}
}
}).start ();



What has changed? What can I do to start a thread that will not prevent
the GUI from coming up?

Any thoughts or advice would be appreciated.

Ian
Re: My RCP application start up changed from 3.2 to 3.3 [message #324211 is a reply to message #324207] Sun, 20 January 2008 06:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ian,

If you change the sleep from 200, which is a very short time of .2
seconds, to something like 20000 or even 60000, does the GUI not come up
until that time has completely expired?


Ian Leslie wrote:
> I have an RCP application which takes about 60 seconds to start up. A
> portion of that is database initialization that does not need to be
> done before the GUI comes up. Using 3.2 I had my startup time (for
> the GUI to appear) down to 45s with the additional work happening on a
> separate thread and completing 20s or so after that.
>
> I have updated my application to use 3.3 (I wanted some of the SWT
> enhancements) and now I see that the GUI does not appear until after
> my initialization thread is finished. I did change from
> IPlatformRunnable to IApplication for my app but that did not help.
>
> The second thread is launched from the start method of one of my
> application's plug-ins with code like this:
>
> new Thread (new Runnable () {
>
> public void run () {
> try {
> // Delay the start so the rest of the application
> can get a head start
> Thread.sleep (200);
> } catch (InterruptedException e) {
>
> try {
> ... do a bunch of work here...
> } catch (CoreException e) {
> DataAccessPlugin.getInstance ().getLog ().log
> (ErrorFactory.createStatusObject (
> DataAccessPlugin.getID (), e,
>
> DataAccessErrorCodes.WARNING_PRELOADING_FAILED));
> } finally {
> if (connection != null) {
> try {
> connection.close ();
> } catch (SQLException e) {
> DataAccessPlugin.getInstance ().getLog
> ().log (ErrorFactory.createStatusObject (
> DataAccessPlugin.getID (), e,
>
> DataAccessErrorCodes.WARNING_PRELOADING_FAILED));
> }
> }
> }
> }
> }).start ();
>
>
>
> What has changed? What can I do to start a thread that will not
> prevent the GUI from coming up?
>
> Any thoughts or advice would be appreciated.
>
> Ian
>
Re: My RCP application start up changed from 3.2 to 3.3 [message #324214 is a reply to message #324207] Sun, 20 January 2008 11:38 Go to previous messageGo to next message
Eclipse UserFriend
You can try to add your initialization code to the
WorkbenchWindowAdvisor.postWindowOpen() method.
You can also try to use the Eclipse Job API
http://www.eclipse.org/articles/Article-Concurrency/jobs-api .html

Snjeza

Ian Leslie wrote:
> I have an RCP application which takes about 60 seconds to start up. A
> portion of that is database initialization that does not need to be done
> before the GUI comes up. Using 3.2 I had my startup time (for the GUI
> to appear) down to 45s with the additional work happening on a separate
> thread and completing 20s or so after that.
>
> I have updated my application to use 3.3 (I wanted some of the SWT
> enhancements) and now I see that the GUI does not appear until after my
> initialization thread is finished. I did change from IPlatformRunnable
> to IApplication for my app but that did not help.
>
> The second thread is launched from the start method of one of my
> application's plug-ins with code like this:
>
> new Thread (new Runnable () {
>
> public void run () {
> try {
> // Delay the start so the rest of the application
> can get a head start
> Thread.sleep (200);
> } catch (InterruptedException e) {
>
> try {
> ... do a bunch of work here...
> } catch (CoreException e) {
> DataAccessPlugin.getInstance ().getLog ().log
> (ErrorFactory.createStatusObject (
> DataAccessPlugin.getID (), e,
>
> DataAccessErrorCodes.WARNING_PRELOADING_FAILED));
> } finally {
> if (connection != null) {
> try {
> connection.close ();
> } catch (SQLException e) {
> DataAccessPlugin.getInstance ().getLog ().log
> (ErrorFactory.createStatusObject (
> DataAccessPlugin.getID (), e,
>
> DataAccessErrorCodes.WARNING_PRELOADING_FAILED));
> }
> }
> }
> }
> }).start ();
>
>
>
> What has changed? What can I do to start a thread that will not prevent
> the GUI from coming up?
>
> Any thoughts or advice would be appreciated.
>
> Ian
>
Re: My RCP application start up changed from 3.2 to 3.3 [message #324233 is a reply to message #324211] Mon, 21 January 2008 07:01 Go to previous messageGo to next message
Eclipse UserFriend
Ed Merks wrote:

> Ian,

> If you change the sleep from 200, which is a very short time of .2
> seconds, to something like 20000 or even 60000, does the GUI not come up
> until that time has completely expired?

Yes, changing that value to a higher value caused the GUI to come up
before the thread was finished. By setting it to 50000 I was able to see
the GUI come up in 49s and my background work continued after that.

I am still not sure what changed; but having the GUI come up and the work
go on in the background is how I want it to work. I think I will take
Snjezana's advice
( http://www.eclipse.org/newsportal/article.php?id=71692&g roup=eclipse.platform#71692)
and look a the Jobs API.

Thanks,

Ian
Re: My RCP application start up changed from 3.2 to 3.3 [message #324234 is a reply to message #324214] Mon, 21 January 2008 07:03 Go to previous message
Eclipse UserFriend
Snjezana Peco wrote:

> You can try to add your initialization code to the
> WorkbenchWindowAdvisor.postWindowOpen() method.
> You can also try to use the Eclipse Job API
> http://www.eclipse.org/articles/Article-Concurrency/jobs-api .html

Thanks for the advice. I started to read that article this morning and it
looks promising. I will make use of both your pieces of advice.

Ian
Previous Topic:Programmatically importing Existing project into workspace
Next Topic:Can you recommend some materials for adapting mechanism of Eclipse.
Goto Forum:
  


Current Time: Thu Jul 17 21:32:13 EDT 2025

Powered by FUDForum. Page generated in 0.04315 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top