Crux: Reinitialize Bean?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Crux: Reinitialize Bean?

Brian Raymes

Hi all,

 

I’m looking for the best way to clear data from previous session upon logout using Crux. I have my session data within a bean titled ApplicationModel.

 

My goal is to “reset” ApplicationModel upon logout so that it is fresh for the next login.

 

I’ve tried dispatching the BeanEvent.REMOVE_BEAN and BeanEvent.ADD_BEAN events. When doing so, the bean properties are reset (source, type, typeDescriptor, initialized, etc), but any custom data within always remains upon dispatching ADD_BEAN. When looking at the BeanProvider through the debugger while these actions take place, it doesn’t appear that the bean is actually fully removed?

 

For example, if my model contains an ArrayList that is filled by a RemoteObject call, it still contains the same data after dispatching both REMOVE_BEAN and ADD_BEAN.

 

Is it possible to re-instantiate a bean to remove all underlying data? Or, do I have to manually wipe all data through the [PreDestroy] annotation?

 

What am I missing, or better yet, what am I misunderstanding?

 

Thank you,

 

Brian

Reply | Threaded
Open this post in threaded view
|

Re: Crux: Reinitialize Bean?

Carlos Rovira-2
Hi Brian,

please check Crux bean management royale docs here [1]

But notice that docs was a migration from swiz docs, so things could not be accurate or in some points not valid. So please, if you notice something wrong in docs, change it and send PR.

Now, I think actually still didn't use it in Royale, but for what I remember from swiz days, I think most of the times the problems was about removing listeners, so probably you need to create a [Predestroy] method to clean up before tear down and remove. If that is not working right, we could have a bug there.

Thanks.


El vie., 10 jul. 2020 a las 3:23, Brian Raymes (<[hidden email]>) escribió:

Hi all,

 

I’m looking for the best way to clear data from previous session upon logout using Crux. I have my session data within a bean titled ApplicationModel.

 

My goal is to “reset” ApplicationModel upon logout so that it is fresh for the next login.

 

I’ve tried dispatching the BeanEvent.REMOVE_BEAN and BeanEvent.ADD_BEAN events. When doing so, the bean properties are reset (source, type, typeDescriptor, initialized, etc), but any custom data within always remains upon dispatching ADD_BEAN. When looking at the BeanProvider through the debugger while these actions take place, it doesn’t appear that the bean is actually fully removed?

 

For example, if my model contains an ArrayList that is filled by a RemoteObject call, it still contains the same data after dispatching both REMOVE_BEAN and ADD_BEAN.

 

Is it possible to re-instantiate a bean to remove all underlying data? Or, do I have to manually wipe all data through the [PreDestroy] annotation?

 

What am I missing, or better yet, what am I misunderstanding?

 

Thank you,

 

Brian



--