0

InterruptedException on Destroy Desktop with viewmodel

asked 2012-11-07 17:03:22 +0800

Neus gravatar image Neus
1415 14

Hi,
this exception is thrown when the browser window is closed with a modal window in it:

07-nov-2012 17:51:42 org.zkoss.bind.impl.ParamCall call:115
GRAVE: 
org.zkoss.zk.ui.UiException: java.lang.InterruptedException: Destroy desktop [Desktop z_0ay:/Pruebas/PruebaVentana/PruebaAbrirModal.zul]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.zkoss.lang.Classes.newInstance(Classes.java:73)
	at org.zkoss.lang.Exceptions.wrap(Exceptions.java:161)
	at org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:44)
	at org.zkoss.zul.Window.enterModal(Window.java:616)
	at org.zkoss.zul.Window.doModal(Window.java:545)
	at org.sts.Pruebas.PruebaVentana.PruebaAbrirModal.abrirModal(PruebaAbrirModal.java:20)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.zkoss.bind.impl.ParamCall.call(ParamCall.java:109)
	at org.zkoss.bind.impl.BinderImpl.doExecute(BinderImpl.java:1508)
	at org.zkoss.bind.impl.BinderImpl.doCommand(BinderImpl.java:1261)
	at org.zkoss.bind.impl.BinderImpl.access$1500(BinderImpl.java:95)
	at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1145)
	at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1103)
	at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2734)
	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2705)
	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2646)
	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:534)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:461)
Caused by: java.lang.InterruptedException: Destroy desktop [Desktop z_0ay:/Pruebas/PruebaVentana/PruebaAbrirModal.zul]
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.doSuspend0(EventProcessingThreadImpl.java:244)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.doSuspend(EventProcessingThreadImpl.java:190)
	at org.zkoss.zk.ui.impl.UiEngineImpl.wait(UiEngineImpl.java:1544)
	at org.zkoss.zk.ui.Executions.wait(Executions.java:703)
	at org.zkoss.zul.Window.enterModal(Window.java:614)
	... 18 more
07-nov-2012 17:51:42 org.zkoss.bind.impl.BinderImpl$CommandEventListener onEvent:1105
GRAVE: java.lang.InterruptedException: Destroy desktop [Desktop z_0ay:/Pruebas/PruebaVentana/PruebaAbrirModal.zul]
org.zkoss.zk.ui.UiException: java.lang.InterruptedException: Destroy desktop [Desktop z_0ay:/Pruebas/PruebaVentana/PruebaAbrirModal.zul]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.zkoss.lang.Classes.newInstance(Classes.java:73)
	at org.zkoss.lang.Exceptions.wrap(Exceptions.java:161)
	at org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:44)
	at org.zkoss.zul.Window.enterModal(Window.java:616)
	at org.zkoss.zul.Window.doModal(Window.java:545)
	at org.sts.Pruebas.PruebaVentana.PruebaAbrirModal.abrirModal(PruebaAbrirModal.java:20)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.zkoss.bind.impl.ParamCall.call(ParamCall.java:109)
	at org.zkoss.bind.impl.BinderImpl.doExecute(BinderImpl.java:1508)
	at org.zkoss.bind.impl.BinderImpl.doCommand(BinderImpl.java:1261)
	at org.zkoss.bind.impl.BinderImpl.access$1500(BinderImpl.java:95)
	at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1145)
	at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1103)
	at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2734)
	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2705)
	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2646)
	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:534)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:461)
Caused by: java.lang.InterruptedException: Destroy desktop [Desktop z_0ay:/Pruebas/PruebaVentana/PruebaAbrirModal.zul]
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.doSuspend0(EventProcessingThreadImpl.java:244)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.doSuspend(EventProcessingThreadImpl.java:190)
	at org.zkoss.zk.ui.impl.UiEngineImpl.wait(UiEngineImpl.java:1544)
	at org.zkoss.zk.ui.Executions.wait(Executions.java:703)
	at org.zkoss.zul.Window.enterModal(Window.java:614)
	... 18 more

Here it is a sample code to reproduce it:

PruebaAbrirModal.zul

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<borderlayout apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('org.sts.Pruebas.PruebaVentana.PruebaAbrirModal')">
	<north></north>
	<center>
		<div>
			<button id="btn" label="Open modal window" onClick="@command('abrirModal')"/>
		</div>
	</center>
</borderlayout>
</zk>

PruebaAbrirModal.java

import org.zkoss.bind.annotation.*;
import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zul.*;

public class PruebaAbrirModal {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Window ventanaModal;
	@Command
	public void abrirModal(){
		ventanaModal = (Window) Executions.createComponents("ventanaModal.zul", null, null);
		ventanaModal.setVisible(false);
//		Events.echoEvent("onMostrar", ventanaModal, null);
		ventanaModal.doModal();
	}
}

VentanaModal.zul

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="ventana" title="Hi" border="normal">
	<label id="lbl" value="Hello!"/>
</window>
</zk>

You must open the modal window and close the browser page. It throws an interrupted exception.

Can it be solved?

Thank you!

delete flag offensive retag edit

10 Replies

Sort by ยป oldest newest

answered 2012-11-09 01:38:46 +0800

MontyPan gravatar image MontyPan
435 3
http://xitop.blogspot.com...

Hi Neus,

Please read these reference: The disable-event-thread Element and Event Threads.

According to these reference, ZK don't suggest programmer set this setting false - if your system need to use Modal window.
Can you tell us why need to enable "disable-event-thread"?

Regards,
Monty Pan

link publish delete flag offensive edit

answered 2012-11-08 01:39:36 +0800

MontyPan gravatar image MontyPan
435 3
http://xitop.blogspot.com...

Hi Neus,

Sorry, I can't reproduce your situation by sample code on ZK 6.5.
Can you check the code and provide detail information like ZK version (if not ZK 6.5), JDK version, Web server and so on?

Regards,
Monty Pan

link publish delete flag offensive edit

answered 2012-11-08 08:01:02 +0800

Neus gravatar image Neus
1415 14

Yes that code throws the exception...And I have some javascript actions in the onunload event and it seems that when this exception is thrown the actions are not executed.
I'm using ZK 6.03 with Tomcat 7. My java version is 1.6.0_35

Thank you for your answer

link publish delete flag offensive edit

answered 2012-11-08 08:05:01 +0800

Neus gravatar image Neus
1415 14

You must have threads enabled in zk.xml to reproduce it!

<system-config>
	<disable-event-thread>false</disable-event-thread>
</system-config>

link publish delete flag offensive edit

answered 2012-11-09 07:40:03 +0800

Neus gravatar image Neus
1415 14

In these links you tell me says:
Enable the event thread if the project uses messagebox and modal windows a lot.
So, if I set disable-event-thread property to false, I'm enabling it as the references says, isn't it?

link publish delete flag offensive edit

answered 2012-11-09 08:06:24 +0800

MontyPan gravatar image MontyPan
435 3
http://xitop.blogspot.com...

Hi Neus,

If you set the value "false", it means "don't disable event thread" equals "enable event thread".

> Enable the event thread only if the project does not need to integrate other frameworks (such as Spring), uses Messagebox and modal windows a lot, and does not have a lot of concurrent users.

So, the conclusion is: set the "disable-event-thread" value true

Regards,
Monty Pan

link publish delete flag offensive edit

answered 2012-11-09 08:33:09 +0800

Neus gravatar image Neus
1415 14

These sentences are separated by a comma so I understand that I must enable them if I don't integrate frameworks OR if I use Messagebox and modal windows.
I'm using messagebox and a lot of modal windows, that's why I enable them. Am I not understanding it well?? (I'm not an english speaker so maybe I'm misunderstood...)
Besides, If I disable them modal window doesn't stop the current thread, so execution continues and modal window function is useless! I made that test writing a System.out.println after calling doModal(). If threads are enabled the System.out.println is not called until the window is closed. If threads are disabled, the System is printed just after calling doModal()

link publish delete flag offensive edit

answered 2012-11-12 07:57:13 +0800

Neus gravatar image Neus
1415 14

Am I right?? I must hace threads enabled?? Why is this exception thrown?? It only happens with viewModel!! With genericforwardcomposer it was working good.

Thank you!

link publish delete flag offensive edit

answered 2012-11-19 08:15:33 +0800

Neus gravatar image Neus
1415 14

Can anyone reproduce it and have an idea why it happens?

link publish delete flag offensive edit

answered 2012-12-12 07:48:00 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

Hi Neus,

I've replied this issue at another thread, please refer to http://www.zkoss.org/forum/listComment/21285

Regards,
Ben

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-11-07 17:03:22 +0800

Seen: 250 times

Last updated: Dec 12 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More