Re: Updating a component from custom thread or why getRequestCycle returns null
Actually this is not my problem. You update component just once after some time while I need non-stop updating. I found a semi-solution. I am using ScheduledThreadPoolExecutor. final ExecutorService service = new ScheduledThreadPoolExecutor(100) { protected void beforeExecute(final Thread t, final Runnable r) { Application.set(getApplication()); } protected void afterExecute(final Runnable r, final Throwable t) { Application.unset(); } }; service.submit(chat); but..the thread is submitted, but it is not executed. I'm debugging and.there is nothing that calls my run() method in my thread. So how can execute this thread which is submited in service. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-a-component-from-custom-thread-or-why-getRequestCycle-returns-null-tp4393783p4406892.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Updating a component from custom thread or why getRequestCycle returns null
maybe i misunderstood. if you attach a quickstart to this thread I can take a look. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-a-component-from-custom-thread-or-why-getRequestCycle-returns-null-tp4393783p4406978.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Updating a component from custom thread or why getRequestCycle returns null
You will still need client initiated requests to get your non-stop-updates from the page/component to the browser. Hence, just separate the work (which you can do continuously in your thread) from the page rendering (which will need to be initiated by a browser request whatever you do). Will make your live so much easier if you cleanly separate those two tasks... On Tue, Feb 21, 2012, at 04:48, BayPhilip wrote: Actually this is not my problem. You update component just once after some time while I need non-stop updating. I found a semi-solution. I am using ScheduledThreadPoolExecutor. final ExecutorService service = new ScheduledThreadPoolExecutor(100) { protected void beforeExecute(final Thread t, final Runnable r) { Application.set(getApplication()); } protected void afterExecute(final Runnable r, final Throwable t) { Application.unset(); } }; service.submit(chat); but..the thread is submitted, but it is not executed. I'm debugging and.there is nothing that calls my run() method in my thread. So how can execute this thread which is submited in service. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Updating a component from custom thread or why getRequestCycle returns null
Hello, everybody. Here is the situation I'm facing last weeks. I have an Index class which extends WebPage. In this Index class I have added a panel, called MainPanel. I have also a thead which is run from Index. MainPanel is not created while initialization of Index. MainPanel is created when I click on AjaxLink. I add MainPanel to Index and also I'm giving this panel to my thread via addPanel() method. In this panel I have method called updateCmp(), which method creates AjaxRequestTarget and updates a component in MainPanel. When I invoke updateCmp() from Index I have no problems, but when I invoke it from thread I get NPE, because there is no Request attached to my thread and getRequestCycle returns null. Now I'm updating component using timer which repeats every second, but I want to remove the timer so I what to update a component using my thread. How to do this without getting NPE? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-a-component-from-custom-thread-or-why-getRequestCycle-returns-null-tp4393783p4393783.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Updating a component from custom thread or why getRequestCycle returns null
there are many examples in this forum, but here is something I wrote a while back that passes thread locals (user info in this example) to the new thread and when the thread is done doing work, the ui repaints with data from thread. https://gist.github.com/706011 use it as a guide and make it your own. good luck. rob -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-a-component-from-custom-thread-or-why-getRequestCycle-returns-null-tp4393783p4395980.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org