Results 1 to 9 of 9

Thread: Disposable contexts

  1. #1
    Join Date
    Apr 2010
    Posts
    18

    Default Disposable contexts

    Hi,

    I'm making some tests with SAS contexts in a modular application and I notice there isn't any close() or dispose() method on the context.
    Is there any plan to support such kind of feature in upcoming releases of SAS ?

    thanks

  2. #2
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default maybe 1.1

    Hey there,

    good point, I've been thinking about this as well, there definitely needs to be some kind of dispose() functionality for a context. This will probably make it in version 1.1, but exactly how this will work I don't know yet.
    Should you have suggestions or ideas for this we'd love to hear them.

    cheers,

    Roland

  3. #3
    Join Date
    Apr 2010
    Posts
    18

    Default

    Well, I guess this is not as easy as removing any reference to the context ...

    Actually, I'm trying to build a modular framework on top of SAS where each module/app would have its own _independent_ context (for isolation purposes).
    And I'm having issues because some resources linked to Stage Processing are shared amongst contexts.
    As an example, there is a missing unregisterContext() method in the IStageProcessorRegistry that should remove the context when it is closed.

    I haven't been any further yet but I guess there are potentially other issues (like listeners that must be removed (ex:Event.ADDED), ...)

  4. #4
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default good points

    Hey there,

    yes, your points are extremely valid Its what I'm brainstorming about as well, the stageprocessorregistry is just one element. The Event.ADDED event won't be a problem since we're listening to this event on the SystemManager. But there's bound to be a lot of objects that have event listeners all over the place, so I'm going to have to sift through the entire code base to get a good idea of what strategy fits this problem.
    I guess an IDisposable interface will come in handy, so that when the singelton cache of a context gets freed up we can loop through the instances, check for this interface and call its dispose() method, for instances that are unable to implement this interface themselves we can always implement an onDispose event on the context, so that a developer can remove any listeners by hand.

    I'm just thinking out loud here, feel free to chime in


    cheers,

    Roland

  5. #5
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default unregisterContext()

    FYI,

    I've added an unregisterContext() method to the IStageProcessorRegistry interface and an implementation of it in the FlexStageProcessorRegistry.

    Changes are available in the trunk.

    cheers,

    Roland

  6. #6
    Join Date
    Apr 2010
    Posts
    18

    Default

    Ok great,
    I'll check this out when I have some time.
    the IDisposable interface seems indeed a good idea. I think there is something similar in Spring (for java).

    If I discover any further issue on this topic, I'll let you know.

    Thanks,
    Alain

  7. #7
    Join Date
    Apr 2010
    Posts
    18

    Default bug in unregisterContext() for modules

    Just to let you know unregistering context for modules does not work.
    I have created an issue and submitted a patch to fix the problem :
    http://jira.springframework.org/brow...ONSCRIPTAS-101

    Regards,
    Alain

  8. #8
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    Hi Alain,

    I have applied your patch (and reworked the code a bit for registering and unregistering contexts). Please let me know if this works for you or if you run into more problems.

    regards,
    Christophe
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  9. #9
    Join Date
    Apr 2010
    Posts
    18

    Default

    Ok, this is working.
    thanks for the quick fix.

    Regards,
    Alain

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •