0

how to notify inside thread.

asked 2014-08-28 12:09:05 +0800

hswain gravatar image hswain flag of India
1763 3 10
http://corejavaexample.bl...

updated 2014-08-28 13:10:39 +0800

sitansu gravatar image sitansu
2254 13
http://java91.blogspot.in...

Notify not working at the time thread running.

    @NotifyChange({ "editMode", "autoList" })
public class CounterThread extends Thread {

            List<DataItem> autoList = new ArrayList<>();

            public CounterThread(List<DataItem> autoList) {
                this.autoList = autoList;
            }

            public void run() {

                    for (int i = 0; i < 10; i++) {
                        autoList.add(new DataItem("level:" + i, "value:" + i));
                        BindUtils.postNotifyChange(null, null, FolderViewModel.this, "autoList");
                        try {
                            Thread.sleep(15000);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }

                    }

            }
        }

Here's error.

java.lang.IllegalStateException: Not in an execution
    at org.zkoss.zk.ui.event.impl.EventQueueProviderImpl.lookup(EventQueueProviderImpl.java:43)
    at org.zkoss.zkmax.ui.event.impl.EventQueueProviderImpl.lookup(EventQueueProviderImpl.java:58)
    at org.zkoss.zk.ui.event.EventQueues.lookup(EventQueues.java:133)
    at org.zkoss.bind.BindUtils.postNotifyChange(BindUtils.java:54)
delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-08-28 12:48:33 +0800

Alecs gravatar image Alecs
103 5

updated 2014-09-01 06:30:30 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

to update the UI in a thread you need to enable server push and activate the desktop inside that thread. You'll have more information by reading Server Push

link publish delete flag offensive edit
0

answered 2014-09-01 10:39:01 +0800

bulba gravatar image bulba
1
http://www.dobre-finanse2...

thanks a lot!

link publish delete flag offensive edit

Comments

don't forget to aprove the answers so other users can find the solution :-)

Alecs ( 2014-09-02 14:32:59 +0800 )edit
Your answer
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
1 follower

RSS

Stats

Asked: 2014-08-28 12:09:05 +0800

Seen: 31 times

Last updated: Sep 01 '14

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