When you close the flex window (until Apollo at least) the client state is all gonzo so no need to do anything there.  The server state for that client goes away for that user when their FlexSession expires.  If you are using an RTMP connection, this happens immediately when you close the window.  If you are using HTTP, it will go away when that user’s session expires based on your app-server’s session timeout.

 

Jeff

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of thunderstumpgesatwork
Sent: Tuesday, August 01, 2006 2:19 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: DataService addItem vs. adding to a fill()'d collection

 

Jeff, thanks for that reply. That was perfect.

One question then... what if a client is closed without releasing the
managed objects? Does the managed state get released if the connection
is severed (like the user closing the window)? Are there any
precautions necessary for cleaning up in this case?

thanks!
Thunder

--- In [EMAIL PROTECTED]ups.com, "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> I think you are talking about "DataService.createItem", not
> "DataService.addItem". Both approaches will create the item (assuming
> the item you are adding is not already managed on that client). The
> difference is that createItem adds a separate reference to that managed
> item whereas adding an item to a filled collection. This difference
> shows up when you start releasing references to managed items. If you
> call createItem, you need to explicitly release the reference for that
> item using releaseItem. When you just add the item to a filled array
> collection, when you release that collection using releaseCollection it
> releases the reference for all of the items in the collection.
>
>
>
> We do reference counting on the client so only when you have released
> the last reference to a managed item is the item's managed state
> released.
>
>
>
> Jeff
>
>
>
> ________________________________
>
> From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of thunderstumpgesatwork
> Sent: Tuesday, August 01, 2006 12:05 PM
> To: [EMAIL PROTECTED]ups.com
> Subject: [flexcoders] DataService addItem vs. adding to a fill()'d
> collection
>
>
>
> Hi all,
>
> I'm wondering what is the difference between adding an item to a
> managed collection (one gotten from a fill() call) and actually using
> the DataService.addItem() function.
>
> In the CRM sample, it seems they do it both ways. The code to add a
> company uses DataService.addItem(), and the code to add an employee
> simply adds the employee to the employees collection.
>
> It appears both have the same affect, in that they are both committed
> to the database immediately, however the approach of adding to the
> managed collection doesn't seem to be working in my environment.
>
> Just wondering what the differences between these approaches would be.
>
> thanks,
> Thunder
>
> P.S. my fill code and add code from my delegate are included below.
> _______________
>
> public function getDashboards() : void
> {
> call =
> service.fill(
> ConfigModelLocator.getInstance().dashboards,
> "DashboardsByApplicationid",
> [ConfigModelLocator.getInstance().applicationid]);
>
> service.addEventListener(mx.rpc.events.ResultEvent.RESULT,responder.onRe
> sult);
> service.addEventListener(mx.rpc.events.FaultEvent.FAULT,responder.onFaul
> t);
> }
>
> public function addDashboard(dashboard:DashboardVO):void
> {
> // validation stuff removed
> // add the dashboard to the dashboards collection
> var dashboardsCol:ArrayCollection =
> ConfigModelLocator.getInstance().dashboards;
> dashboardsCol.addItem(dashboard);
> }
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to