Correct usage of ProgressMonitorDialog with modal dialogs [message #1732929] |
Mon, 23 May 2016 08:13 |
Wojtek Polcwiartek Messages: 3 Registered: May 2016 |
Junior Member |
|
|
Hallo,
I am struggling with the correct usage of the ProgressMonitorDialog in an RAP/RWT enviroment.
My scenario is to run a IRunnableWithProgress with ProgressMonitorDialog#run(), while the "fork"-flag is set (true; "ModalContext"-thread spawns).
This IRunnableWithProgress opens a blocking MessageDialog. While this MessageDialog is open, I close the web-browser window.
I could observe, that the "ModalContext"-thread hangs in this situation. The "ModalContext"-thread waits for a lock, owned by UIThread, which gets terminated, so it waits forever.
Can you give me a clue, how to open modal dialogs with ProgressMonitorDialog#run() properly?
I attached an EntryPoint, that demonstrates this behavior.
|
|
|
|
Re: Correct usage of ProgressMonitorDialog with modal dialogs [message #1733097 is a reply to message #1732977] |
Tue, 24 May 2016 10:59 |
Wojtek Polcwiartek Messages: 3 Registered: May 2016 |
Junior Member |
|
|
Hallo Ivan,
I could reproduce this behaviour with the "RAP Examples Demo" (the Workbench Demo does not use the ModalContext-Thread).
I used the demo "Basic Widgets"->"Dialogs"->"Progress Dialog", but I needed to modify the o.e.r.e.p.DialogExamplePage.showProgressDialog()-Method.
private void showProgressDialog() {
final ProgressMonitorDialog dialog = new ProgressMonitorDialog( getShell() ) {
@Override
public boolean close() {
return super.close();
}
};
dialog.setBlockOnOpen( false );
try {
dialog.run( true, true, new IRunnableWithProgress() {
@Override
public void run( IProgressMonitor monitor )
throws InvocationTargetException, InterruptedException
{
monitor.beginTask( "Counting to 12...", 12 );
for( int i = 1; !monitor.isCanceled() && i <= 12; i++ ) {
monitor.worked( 1 );
Thread.sleep( 300 );
}
// open a blocking dialog
dialog.getShell().getDisplay().syncExec( new Runnable() {
@Override
public void run() {
MessageDialog.openInformation( getShell(), "Blocking Dialog", "Hallo!" );
}
} );
monitor.done();
}
} );
} catch( Exception e ) {
MessageDialogUtil.openError( getShell(), "Error", e.getMessage(), null );
}
}
I start the demo, use the "Progress Dialog"-Button, and wait until the "Blocking Dialog" comes. Then I close the Webbrowser. The result is a terminated UIThread, and
a hanging "ModalContext"-Thread.
I posted this question first as a bug, but I am not sure, if it is one. It could be a bug, because not all of the
resources (here: threads) belonging to a session, are closed when the session terminates. But maybe I just use the frameworks in a wrong way.
Best Regards,
Wojtek
|
|
|
Powered by
FUDForum. Page generated in 0.03093 seconds