Package org.atmosphere.cpr

Examples of org.atmosphere.cpr.AtmosphereResourceImpl.uuid()


                                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:
View Full Code Here


                                StringBuilder data = new StringBuilder();
                                // if there is a Broadcaster cache, retrieve the messages from the cache, and send them
                                if (DefaultBroadcaster.class.isAssignableFrom(resource.getBroadcaster().getClass())) {

                                    List<Object> cachedMessages = resource.getBroadcaster().getBroadcasterConfig().getBroadcasterCache()
                                            .retrieveFromCache(resource.getBroadcaster().getID(), resource.uuid());

                                    if (cachedMessages != null && !cachedMessages.isEmpty()) {
                                        if (cachedMessages.size() > 1) {
                                            for (Object object : cachedMessages) {
                                                String msg = object.toString();
View Full Code Here

        asyncSupport, new AtmosphereHandlerAdapter());

    atmosphereResource.setBroadcaster(broadcaster);
    broadcaster.addAtmosphereResource(atmosphereResource);

    String uuid = atmosphereResource.uuid();
    Page page = getComponent().getPage();

    page.setMetaData(ATMOSPHERE_UUID, uuid);
    eventBus.registerPage(uuid, page);
  }
View Full Code Here

        if (remoteEndpoint != null) {
            if (event.isCancelled() || event.isClosedByClient()) {
                remoteEndpoint.status().status(event.isCancelled() ? Status.STATUS.UNEXPECTED_CLOSE : Status.STATUS.CLOSED_BY_CLIENT);
                request.removeAttribute(RemoteEndpointImpl.class.getName());
                trackedUUID.remove(r.uuid());

                invokeOpenOrClose(onCloseMethod, remoteEndpoint);
            } else if (event.isResumedOnTimeout() || event.isResuming()) {
                remoteEndpoint.status().status(Status.STATUS.CLOSED_BY_TIMEOUT);
                request.removeAttribute(RemoteEndpointImpl.class.getName());
View Full Code Here

                    break;
                }
            }

            // Since 1.0.10
            final StringBuffer message = new StringBuffer(r.uuid()).append(wsDelimiter);

            // since 2.2
            if (enforceAtmosphereVersion) {
                message.append(heartbeatInterval)
                    .append(wsDelimiter)
View Full Code Here

                    // See https://github.com/Atmosphere/atmosphere/issues/1590
                    // Better to call onDisconnect that onResume.
                    if (allowedToClose) {
                        if (ff || closingTime > 0) {
                            completeLifecycle = false;
                            logger.debug("Delaying closing operation for firefox and resource {}", resource.uuid());
                            ExecutorsFactory.getScheduler(framework.getAtmosphereConfig()).schedule(new Callable<Object>() {
                                @Override
                                public Object call() throws Exception {
                                    executeClose(webSocket, 1005);
                                    finish(webSocket, resource, r, s, !allowedToClose);
View Full Code Here

                            }, ff ? (closingTime == 0 ? 1000 : closingTime) : closingTime, TimeUnit.MILLISECONDS);
                        } else {
                            executeClose(webSocket, closeCode);
                        }
                    } else {
                        logger.debug("Timeout {}", resource.uuid());
                        asynchronousProcessor.endRequest(AtmosphereResourceImpl.class.cast(webSocket.resource()), false);
                    }
                } else {
                    logger.debug("Unable to properly complete {}", resource == null ? "null" : resource.uuid());
                    completeLifecycle = false;
View Full Code Here

                    } else {
                        logger.debug("Timeout {}", resource.uuid());
                        asynchronousProcessor.endRequest(AtmosphereResourceImpl.class.cast(webSocket.resource()), false);
                    }
                } else {
                    logger.debug("Unable to properly complete {}", resource == null ? "null" : resource.uuid());
                    completeLifecycle = false;
                }
            } finally {
                if (completeLifecycle) {
                    finish(webSocket, resource, r, s, !allowedToClose);
View Full Code Here

        RemoteEndpointImpl remoteEndpoint = (RemoteEndpointImpl) request.getAttribute(RemoteEndpointImpl.class.getName());

        if (event.isCancelled() || event.isClosedByClient()) {
            remoteEndpoint.status().status(event.isCancelled() ? Status.STATUS.UNEXPECTED_CLOSE : Status.STATUS.CLOSED_BY_CLIENT);
            request.removeAttribute(RemoteEndpointImpl.class.getName());
            trackedUUID.remove(r.uuid());

            invokeOpenOrClose(onCloseMethod, remoteEndpoint);
        } else if (event.isResumedOnTimeout() || event.isResuming()) {
            remoteEndpoint.status().status(Status.STATUS.CLOSED_BY_TIMEOUT);
            request.removeAttribute(RemoteEndpointImpl.class.getName());
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.