-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a .zul page(lets say A.zul) which has a button.In the corresponding composer class,the button's onClick eventHandler method pops up a modal window.
Now while the modal window is open,if I refresh the parent page A.zul,I encounter an java.lang.InterruptedException: Destroy desktop [Desktop z_2o70:........
Can anyone please help me on this ???
Thanks in advance guys....
Hi Sandeep,
It is in the enterModal method itself, and interrupted by evtthd.ceaseSilently in desktopDestroyed0 (you can find the error message "Destroy desktop "+desktop here), then the catch block in enterModal will catch the InterruptedException and wrap it as a UiException then throw it.
You can verify this case by the simple sample below:
public static void main (String args[]) { final Thread t = new Thread(new Runnable() { public void run () { new DoSomething().doSomething(); } }); t.start(); Thread t2 = new Thread(new Runnable () { public void run () { try { Thread.sleep(2000); t.interrupt(); } catch (InterruptedException e) { e.printStackTrace(); } } }); t2.start(); } static class DoSomething { public synchronized void doSomething () { try { wait(); } catch (InterruptedException e) { System.out.println(" oops ! interrupted !"); } } }
Regards,
Ben
How you try to refresh the a.zul ???
Think about if 'a.zul' is the 'Parent - Daddy' and holds his child in the air (the modal window) , what should happen with the 'child' if his Daddy is refresh/created new.
Try to call a method in the a.zul composer taht refresh the content/data and not the whole 'a.zul'
best
Stephan
PS: look here.
edit PS 2: can we change. You have such nice pics from where you live. Today we have here by me -7 degrees celsius. Brrrrrrrrr.
Thanks Stephan for your reply...
This is the scenario....
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Inside A.zul's composer
--------------------------------
public void onClick$button(){ try{ if(SOME CONDITION.....){ }else{ window = (Window)Executions.createComponents("B.zul", null , null); // B.zul is the modal page. if(execution.getDesktop().isAlive()){ // STUCKKKKKKKKKKKKKKKKKKKKKKKKK............... window.doModal(); } } }catch(Exception e){ e.printStackTrace(); } }
Inside B.zul's composer..... [B.zul is actually a form which has a submit button(Lets say "closeBtn".]
--------------------------------
private Window modalDialog; public void onClick$closeBtn(){ try{ // FETCH FORM VALUES... modalDialog.detach(); }catch(Exception e){ e.printStackTrace(); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
i don't think you need:
. . . if(execution.getDesktop().isAlive()){ // STUCKKKKKKKKKKKKKKKKKKKKKKKKK............... window.doModal(); }
window.doModal(); is enough
because you ARE in an 'execution'
2.
... // FETCH FORM VALUES... modalDialog.onClose();
best
Stephan
Then how do I prevent the exception Stephan ?
I tried out the modalDialog.onClose() as well instead of modalDialog.detach() inside onClick$closeBtn(),didn't work out !
Regards,
Sandeep
You should not prevent the exception. You should change the logic. (You don't show us the code how you refresh the 'a.zul'. And it seems that their is the problem )
Look at the text you are written in the starter thread.
You write that you get the exception as you will refresh the parent 'a.zul' from a modal window that is created from this parent.
All what i say is you should refresh the data/content of the a.zul file and not create the 'a.zul' new. than you will get no problem.
best
Stephan
I was trying to anticipate possible situations while the modal window is open.
Lets say: An end-user clicks the browser refresh button while the modal window is open !
In this case the modal window is away and the parent zul file is loaded
Tell me one thing Stephan...
When window.doModal() is called,it must be handled by some thread,right ? Until an unless I am calling the detach() method,this thread is still alive.At this point,when I am refreshing the parent page A.zul,how is that thread handled ? I believe this is the reason why I am getting an java.lang.InterruptedException.
Please correct me if I am wrong....
Hmmmmm, i think this stoped thread is still alive and cleaned up first if the timeout for the session comes. There are a few forum threads about this.
You can open the customer dialog in Zksample2 and refresh the browser. There's not your error. So i can only say i'm not understand why you will check in an execution if the execution is running well ??
public void onClick$closeBtn(){... it's the same as: public void onClick$closeBtn(Event event){...
Asked: 2012-12-07 18:39:23 +0800
Seen: 407 times
Last updated: Dec 13 '12