Re: Updating a component from custom thread or why getRequestCycle returns null

2012-02-21 Thread BayPhilip
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



Updating a component from custom thread or why getRequestCycle returns null

2012-02-16 Thread BayPhilip
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