atmosphere
  1. atmosphere
  2. ATMOSPHERE-119

Clean cancel atmosphereResources from broadcasters

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7.2
    • Fix Version/s: 0.7.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      Tomcat 6 NIO

      Description

      When we use multiple broadcasters in one channel.

      If someone refesh the browser the old atmosphereResources isn't remove from broadcasters.

      Workaround (in groovy) :

      in onRequest for each broadcaster :

      BroadcasterFactory.default.lookupAll().each { 
            it.atmosphereResources.findAll{ a -> a.event.isCancelled }.each{ 
                a -> b.removeAtmosphereResource(a)
            }
      

      in onStateChange :

      if (event.cancelled){
                  //Help atmosphere to clear old events
                  BroadcasterFactory.default.lookupAll().each {
                      it.removeAtmosphereResource(event.resource)
                  }
                  return
              }
      

      (I don't know if it affects the general case : 1 atmosphereResource = 1 broadcaster)

        Activity

        Hide
        vbarrier added a comment -

        Correct code for onRequest :

        BroadcasterFactory.default.lookupAll().each { b ->
                    b.atmosphereResources.findAll{ a -> a.event.isCancelled }.each{
                        a -> b.removeAtmosphereResource(a)
                    }
                }
        
        Show
        vbarrier added a comment - Correct code for onRequest : BroadcasterFactory. default .lookupAll().each { b -> b.atmosphereResources.findAll{ a -> a.event.isCancelled }.each{ a -> b.removeAtmosphereResource(a) } }
        Show
        jfarcand added a comment - Fixed https://github.com/Atmosphere/atmosphere/commit/2f1ce8e7ca7388d973c4926aa94e7c277e141493

          People

          • Assignee:
            Unassigned
            Reporter:
            vbarrier
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: