Package org.atmosphere.cache

Examples of org.atmosphere.cache.BroadcastMessage


                                AtmosphereResourceImpl resource = session.getAtmosphereResourceImpl();
                                // if BroadcastCache is available, add the message to the cache
                                if (resource != null && DefaultBroadcaster.class.isAssignableFrom(resource.getBroadcaster().getClass())) {
                                    resource.getBroadcaster().getBroadcasterConfig().getBroadcasterCache().
                                            addToCache(resource.getBroadcaster().getID(), resource.uuid(),
                                                    new BroadcastMessage(msg));
                                }
                            }
                            break;
                        default:
                            logger.error("Unknown SocketIOEvent msg = " + msg);
View Full Code Here


        public void onResult(SendResult result) {
            semaphore.release();
            if (!result.isOK() || result.getException() != null) {
                logger.trace("WebSocket {} failed to write {}", r, message);
                Broadcaster b = r.getBroadcaster();
                b.getBroadcasterConfig().getBroadcasterCache().addToCache(b.getID(), r.uuid(), new BroadcastMessage(message));
            }
        }
View Full Code Here

        deliver.message = finalMsg;

        // We cache first, and if the broadcast succeed, we will remove it.
        AtmosphereResource cache = deliver.type != Deliver.TYPE.RESOURCE ? null : deliver.resource;
        deliver.cache = bc.getBroadcasterCache().addToCache(getID(), cache != null ? cache.uuid() : BroadcasterCache.NULL, new BroadcastMessage(deliver.originalMessage));

        if (resources.isEmpty()) {
            logger.trace("No resource available for {} and message {}", getID(), finalMsg);
            entryDone(deliver.future);
            return;
View Full Code Here

                } catch (Throwable t) {
                    // An exception occurred
                    logger.error("Unable to write cached message {} for {}", e.getMessage(), r.uuid());
                    logger.error("", t);
                    for (Object o : cacheMessages) {
                        bc.getBroadcasterCache().addToCache(getID(), r != null ? r.uuid() : BroadcasterCache.NULL, new BroadcastMessage(o));
                    }
                    return true;
                }

                // If long-polling or JSONP is used we need to set the messages for the event again, because onResume() have cleared them
View Full Code Here

        }

        try {
            if (token != null && token.originalMessage != null) {
                bc.getBroadcasterCache().addToCache(getID(), r != null ? r.uuid() : BroadcasterCache.NULL,
                        new BroadcastMessage(String.valueOf(token.future.hashCode()), token.originalMessage));
                logger.trace("Lost message cached {}", token.originalMessage);
            }
        } catch (Throwable t2) {
            logger.error("Unable to cache message {} for AtmosphereResource {}", token.originalMessage, r != null ? r.uuid() : "");
            logger.error("Unable to cache message", t2);
View Full Code Here

TOP

Related Classes of org.atmosphere.cache.BroadcastMessage

Copyright © 2018 www.massapicom. 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.