You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Igor Vaynberg <ig...@gmail.com> on 2010/02/03 09:40:54 UTC

Re: AbstractAjaxTimerBehaviour sets Transient object to null when same page in opened in new tab

if you keep working on the same page instance it is kept in http
sessison and is not serialized. when you go to a new page it pushes
the old instance out, forcing serialization, and setting the transient
field to null.

a proper way to do this would be to have an application-wide task
manager. the code may look something like this:

BackgroundTask bt=Application.get().getTaskManager().start(new runnable(){});
taskId=bt.getId(); <== task id is a simple string that you can pass
around, usually a UUID

then later when you want to poll status
BackgroundTask bt=Application.get().getTaskManager().get(taskid);
bt.getFuture().....

-igor

On Tue, Feb 2, 2010 at 7:25 PM, Lina Thomas <lt...@taxcient.com> wrote:
> Hi
>
>        I have a Page on which I am have to execute a long running task when
> a form is submitted.  This is what I do
>
>
>   1. I have a transient FutureTask member variable in the page
>   2. On submit of the form i create a callable and instantiate
>   the FutureTask
>   3. I start the AbstractAjaxTimerBehaviour which keeps checking if
>   the FutureTask is done before it can update a panel in the page with the
>   result of the execution.
>      - This works fine when I'm on the same page
>      - Now if I submit the form and while the AbstractAjaxTimerBehaviour is
>      still polling I open the same page *in a new tab* *within the same
>      session* then the reference to the FutureTask in the first page
>      (previous tab) becomes null.
>
> I couldn't find any solution to this problem. Any help would be greatly
> appreciated.
>
> Thanks
> -Lina
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AbstractAjaxTimerBehaviour sets Transient object to null when same page in opened in new tab

Posted by LinaTomy <lt...@taxcient.com>.
Thanks a lot Igor. This works!!


igor.vaynberg wrote:
> 
> if you keep working on the same page instance it is kept in http
> sessison and is not serialized. when you go to a new page it pushes
> the old instance out, forcing serialization, and setting the transient
> field to null.
> 
> a proper way to do this would be to have an application-wide task
> manager. the code may look something like this:
> 
> BackgroundTask bt=Application.get().getTaskManager().start(new
> runnable(){});
> taskId=bt.getId(); <== task id is a simple string that you can pass
> around, usually a UUID
> 
> then later when you want to poll status
> BackgroundTask bt=Application.get().getTaskManager().get(taskid);
> bt.getFuture().....
> 
> -igor
> 
> On Tue, Feb 2, 2010 at 7:25 PM, Lina Thomas <lt...@taxcient.com> wrote:
>> Hi
>>
>>        I have a Page on which I am have to execute a long running task
>> when
>> a form is submitted.  This is what I do
>>
>>
>>   1. I have a transient FutureTask member variable in the page
>>   2. On submit of the form i create a callable and instantiate
>>   the FutureTask
>>   3. I start the AbstractAjaxTimerBehaviour which keeps checking if
>>   the FutureTask is done before it can update a panel in the page with
>> the
>>   result of the execution.
>>      - This works fine when I'm on the same page
>>      - Now if I submit the form and while the AbstractAjaxTimerBehaviour
>> is
>>      still polling I open the same page *in a new tab* *within the same
>>      session* then the reference to the FutureTask in the first page
>>      (previous tab) becomes null.
>>
>> I couldn't find any solution to this problem. Any help would be greatly
>> appreciated.
>>
>> Thanks
>> -Lina
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/AbstractAjaxTimerBehaviour-sets-Transient-object-to-null-when-same--page-in-opened-in-new-tab-tp27430960p27464133.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org