Tide Context and Module unloading

24 views
Skip to first unread message

flex-guse

unread,
Sep 13, 2010, 10:51:28 AM9/13/10
to Granite Data Services Forum
Hi list,

I'm working on a big modular application which uses
SpringActionscript, GraniteDS + Tide and modules.

Everything works nicely, I can load modules, inject services and use
GraniteDS with DataPush features. The only thing is I'm not able to
unload modules.
I created a custom ModuleLoader and a custom Module, this combination
is able to load and unload modules using SpringActionscript (I checked
that running a demo application and the Flashbuilder Profiler). The
demo application does not use Tide.
If I use the custom ModuleLoader and Module in my main application
using Tide the modules are not unloaded (garbage collected). I suppose
- just suppose - this is caused by the Tide context which controls the
object instances delivered by GraniteDS. The modules have references
to the object instances and therefore the modules are not garbage
collected.
If my assumption is correct I have to remove the object instances the
module shows from the Tide context and after that the module can be
unloaded.

Is my assumption correct? Is there an elegant way to "cut" the
references to an object instance in the Tide context?

Regards,
Christoph

wdrai

unread,
Sep 15, 2010, 5:26:43 AM9/15/10
to Granite Data Services Forum
To correctly handle Flex modules, you will have to declare all your
module components in a implementation of ITideModule :

public class MyModule implements ITideModule {

public function init(tide:Tide):void {
tide.addComponent("blah", Blah);
...
}
}

Then register the module with the ApplicationDomain of your Flex
module :

Spring.getInstance().addModule(MyModule, moduleApplicationDomain);


Then just before you unload the module, call :

Spring.getInstance().removeModule(MyModule);

This will clear all instances of all components of the module in all
contexts.
Reply all
Reply to author
Forward
0 new messages