Examples of UUIDBroadcasterCache


Examples of org.atmosphere.cache.UUIDBroadcasterCache

        }
    }

    @Test
    public void testBasicExcludeCache() throws ExecutionException, InterruptedException, ServletException {
        BroadcasterCache cache = new UUIDBroadcasterCache();
        AtmosphereResource r = config.resourcesFactory().create(broadcaster.getBroadcasterConfig().getAtmosphereConfig(), "1234567");

        cache.excludeFromCache(broadcaster.getID(), r);

        broadcaster.getBroadcasterConfig().setBroadcasterCache(cache);
        broadcaster.removeAtmosphereResource(r);
        broadcaster.broadcast("foo").get();

        List<Object> l = cache.retrieveFromCache(broadcaster.getID(), ar.uuid());
        assertNotNull(l);
        assertEquals(l.isEmpty(), true);
    }
View Full Code Here

Examples of org.atmosphere.cache.UUIDBroadcasterCache

        assertEquals(l.isEmpty(), true);
    }

    @Test
    public void testExcludeCache() throws ExecutionException, InterruptedException, ServletException {
        BroadcasterCache cache = new UUIDBroadcasterCache();
        AtmosphereResource r = config.resourcesFactory().create(broadcaster.getBroadcasterConfig().getAtmosphereConfig(), "1234567");

        broadcaster.getBroadcasterConfig().setBroadcasterCache(cache);
        broadcaster.addAtmosphereResource(r);
        broadcaster.broadcast("foo").get();
        broadcaster.removeAtmosphereResource(r);
        broadcaster.broadcast("foo").get();

        List<Object> l = cache.retrieveFromCache(broadcaster.getID(), r.uuid());
        assertNotNull(l);
        assertEquals(l.isEmpty(), false);
    }
View Full Code Here

Examples of org.atmosphere.cache.UUIDBroadcasterCache

        assertEquals(l.isEmpty(), false);
    }

    @Test
    public void testCloseExcludeCache() throws ExecutionException, InterruptedException, ServletException, IOException {
        UUIDBroadcasterCache cache = new UUIDBroadcasterCache();
        SimpleBroadcaster b = config.getBroadcasterFactory().lookup(SimpleBroadcaster.class, "uuidTest", true);
        b.getBroadcasterConfig().setBroadcasterCache(cache);
        // Reset
        b.removeAtmosphereResource(ar);

        b.addAtmosphereResource(ar);
        b.broadcast("foo").get();

        ar.close();
        b.removeAtmosphereResource(ar);

        b.broadcast("raide").get();

        assertEquals(cache.messages().isEmpty(), false);
        List<Object> l = cache.retrieveFromCache(b.getID(), ar.uuid());
        assertNotNull(l);
        assertEquals(l.isEmpty(), false);
    }
View Full Code Here

Examples of org.atmosphere.cache.UUIDBroadcasterCache

        assertEquals(l.isEmpty(), false);
    }

    @Test
    public void testSuspendExcludeCache() throws ExecutionException, InterruptedException, ServletException, IOException {
        UUIDBroadcasterCache cache = new UUIDBroadcasterCache();
        SimpleBroadcaster b = config.getBroadcasterFactory().lookup(SimpleBroadcaster.class, "uuidTest", true);
        b.getBroadcasterConfig().setBroadcasterCache(cache);
        // Reset
        b.removeAtmosphereResource(ar);

        ar.suspend();
        b.removeAtmosphereResource(ar);

        b.broadcast("raide").get();

        // Blocked by the cache because suspend has been called.
        assertEquals(cache.messages().isEmpty(), true);
    }
View Full Code Here

Examples of org.atmosphere.cache.UUIDBroadcasterCache

        r.setBroadcaster(config.getBroadcasterFactory().lookup("/1", true));

        recovery.configure(config);
        recovery.inspect(r);

        config.getBroadcasterFactory().lookup("/1", true).getBroadcasterConfig().setBroadcasterCache(new UUIDBroadcasterCache());
        config.getBroadcasterFactory().lookup("/2", true).getBroadcasterConfig().setBroadcasterCache(new UUIDBroadcasterCache());
        config.getBroadcasterFactory().lookup("/3", true).getBroadcasterConfig().setBroadcasterCache(new UUIDBroadcasterCache());
        config.getBroadcasterFactory().lookup("/4", true).getBroadcasterConfig().setBroadcasterCache(new UUIDBroadcasterCache());

        config.getBroadcasterFactory().lookup("/1", true).addAtmosphereResource(r);
        config.getBroadcasterFactory().lookup("/2", true).addAtmosphereResource(r);
        config.getBroadcasterFactory().lookup("/3", true).addAtmosphereResource(r);
        config.getBroadcasterFactory().lookup("/4", true).addAtmosphereResource(r);
View Full Code Here

Examples of org.atmosphere.cache.UUIDBroadcasterCache

        config = new AtmosphereFramework().getAtmosphereConfig();
        DefaultBroadcasterFactory factory = new DefaultBroadcasterFactory(DefaultBroadcaster.class, "NEVER", config);
        broadcaster = factory.get(DefaultBroadcaster.class, "test");
        config.framework().setBroadcasterFactory(factory);

        broadcasterCache = new UUIDBroadcasterCache();
        broadcaster.getBroadcasterConfig().setBroadcasterCache(broadcasterCache);
        atmosphereHandler = new AR();
        ar = new AtmosphereResourceImpl(config,
                broadcaster,
                mock(AtmosphereRequest.class),
View Full Code Here

Examples of org.atmosphere.cache.UUIDBroadcasterCache

    }

    if (grailsEvents != null) {
      Broadcaster b = broadcasterFactory.lookup(GLOBAL_TOPIC, true);
      if (b.getBroadcasterConfig().getBroadcasterCache() == null) {
        b.getBroadcasterConfig().setBroadcasterCache(new UUIDBroadcasterCache());
      }

      defineBridgeListener(grailsApplication, grailsEvents);
    }
View Full Code Here

Examples of org.atmosphere.cache.UUIDBroadcasterCache

  public static ConcurrentMap<String, Object> getMap() {
    return map;
  }
 
  public void registerItems(){
          broadcaster.getBroadcasterConfig().setBroadcasterCache(new UUIDBroadcasterCache());
          broadcaster.getBroadcasterConfig().getBroadcasterCache().configure(broadcaster.getBroadcasterConfig());
          broadcaster.getBroadcasterConfig().getBroadcasterCache().start();
   
    broadcaster.getBroadcasterConfig().addFilter(new PerRequestBroadcastFilter() {
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.