Package org.apache.tuscany.sca.binding.comet.runtime.callback

Examples of org.apache.tuscany.sca.binding.comet.runtime.callback.CometCallback


        }
        Event event = new Event();
        event.setName(eventName);
        event.setData(eventData);
        for (String registrationId : destinations) {
            CometCallback client = clients.get(registrationId);
            if (client == null) {
                // client has unregistered from this event
                synchronized (eventListeners) {
                    eventListeners.remove(eventName, registrationId);
                }
            } else {
                Status status = client.sendMessage(event);
                if (status == Status.CLIENT_DISCONNECTED) {
                    unregister(registrationId);
                }
            }
        }
View Full Code Here


    }

    @Override
    public void register(String eventName) {
        String registrationId = UUID.randomUUID().toString();
        CometCallback callback = componentContext.getRequestContext().getCallback();
        clients.put(registrationId, callback);
        synchronized (eventListeners) {
            eventListeners.put(eventName, registrationId);
        }
        Event event = new Event();
        event.setId(registrationId);
        event.setName(eventName);
        event.setData(new Date().toString());
        callback.sendMessage(event);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.comet.runtime.callback.CometCallback

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.