| Error when closing program cause of running job [message #840860] |
Tue, 10 April 2012 11:40  |
AmFreak Missing name Messages: 25 Registered: June 2011 |
Junior Member |
|
|
Hi,
i have an eclipse rcp app that does some periodically (every 5 seconds) work in a child thread. After the work is done the thread executes a method to update the Status Line of the app to inidicate that the work is finished.
It looks like this:
protected void updateStatusBar()
{
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(MainView.ID).
getViewSite().getActionBars().getStatusLineManager().setMessage("work finished");
}
});
}
It runs fine. The problem i have is when i close my app i get a Null Pointer Exception with this error from time to time:
Quote:
Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: org.eclipse.ui.internal.progress.TaskBarProgressManager$2
Seems the program is deconstructing itself while the async job is running. So is there a way to get / wait for the running ui jobs, so that i can make sure the jobs are finsihed before the app is closed? Or a way to cancel them before the app "destroys" itself?
[Updated on: Tue, 10 April 2012 11:41] Report message to a moderator
|
|
|
| Re: Error when closing program cause of running job [message #841558 is a reply to message #840860] |
Wed, 11 April 2012 09:16  |
Wim Jongman Messages: 417 Registered: July 2009 |
Senior Member |
|
|
Hi AmFreak,
Are you using threads or jobs? when using threads lookin
thread.setdaemon(true).
When using jobs: do not to loop the job every five seconds but submit a new
job after the first job has finished with a delay of five seconds. The job
should then only be submitted if the platform is not running
(platform.isworkbenchrunning() / iworkbench.isclosing())
Hope this helps,
Wim
> Hi,
>
> i have an eclipse rcp app that does some periodically (every 5 seconds)
work in a child thread. After the work is done the thread executes a method
to update the Status Line of the app to inidicate that the work is finished.
> It looks like this:
>
>
> protected void updateStatusBar()
> {
> Display.getDefault().asyncExec(new Runnable() {
> @Override
> public void run() {
>
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(MainView.ID).
> getViewSite().getActionBars().getStatusLineManager().setMessage("work
finished");
> }
> });
> }
>
>
> It runs fine. The problem i have is when i close my app i get a Null
Pointer Exception with this error from time to time:
>
> Quote:
>> Job found still running after platform shutdown. Jobs should be canceled
by the plugin that scheduled them during shutdown:
org.eclipse.ui.internal.progress.TaskBarProgressManager$2
>
>
> Seems the program is deconstruct itself while the async job is running. So
is there a way to get / wait for the running ui jobs, so that i can make sure
the jobs are finsihed before the app is closed? Or a way to cancel them
before the app "destroys" itself?
|
|
|
Powered by
FUDForum. Page generated in 0.07813 seconds