Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Runnable in synchExec() never gets started
Runnable in synchExec() never gets started [message #456816] Thu, 09 June 2005 16:06 Go to next message
Eclipse UserFriend
Originally posted by: cezeugoh.gmail.com

Hi all,

I have integrated an SWT application with an ActiveX control and am making
calls to this via a JavaBean in ORACLE Forms. Everything appears to be ok
when I start up the application but all hell breaks loose when i try to
shutdown the SWT Application using shell.dispose() from synchExec(). It
would appear the runnable never gets called.
Does anyone know a reason for this and is there anything i can do to start
that runnable myself and make sure it runs in a timely fashion?

Some of my code snippets are posted below. Is there anything I am doing
wrong?

Thank you for your help

Elisha.
.......
private class ShutdownHook implements Runnable {

public void run()
{
myScanner.setStatusMessage("am running the external thread
now........");
if (shell != null && !shell.isDisposed())
{
myScanner.setStatusMessage("I am about to dispose of
this window & scanner");
shell.dispose();
shell = null;
display.dispose();
display = null;
myScanner = null;
} else
{
myScanner.setStatusMessage("The window has been
dismissed or i dont have access to it.");
myScanner.setStatusMessage("Doing other application
shutdown tasks..");
display.dispose(); display = null; myScanner = null;
}

}
}
.....
......
ShutdownHook shutdown = new ShutdownHook();
Thread mThread = new Thread(shutdown,"SHUTDOWNTHREAD");
myScanner.setStatusMessage("The end is near any moment now");
myScanner.unLoad();
//shell.dispose();
if (display != null && !display.isDisposed()) {
myScanner.setStatusMessage("I am about to dispose of this
application");
display.syncExec(shutdown);
mThread.start();
} else
{
myScanner.setStatusMessage("U have already disposed of the
application here...go Home");
}
......
Re: Runnable in synchExec() never gets started [message #456818 is a reply to message #456816] Thu, 09 June 2005 17:30 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

I'm not exactly sure but one thing is your mTread is useless. You are
calling the shutdown hook from both the syncExec AND the Thread (because
you passed the shutdown runnable into the Thread's constructor, so it
becomes the runnable for the thread). And the thread will fail if it
ever does run because it is trying to do things to the shell and it is
not the UI thread (by definition the thread is not the UI thread since
you created it yourself and didn't create the display on it).

Second question is the thread you are calling display.syncExec(shutdown)
the UI thread? If it isn't then maybe the UI thread is blocked and not
responding. In that case the syncExec which just wait until the UI
thread is unblocked.


> ShutdownHook shutdown = new ShutdownHook(); Thread mThread =
> new Thread(shutdown,"SHUTDOWNTHREAD");
> myScanner.setStatusMessage("The end is near any moment now");
> myScanner.unLoad(); //shell.dispose();
> if (display != null && !display.isDisposed()) {
> myScanner.setStatusMessage("I am about to dispose of this
> application");
> display.syncExec(shutdown);
> mThread.start();
> } else {
> myScanner.setStatusMessage("U have already disposed of the
> application here...go Home");
> }
> .....
>

--
Thanks,
Rich Kulp
Previous Topic:SWT Image creation
Next Topic:TreeViewer with lazy loading
Goto Forum:
  


Current Time: Thu Apr 25 01:05:00 GMT 2024

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

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

Back to the top