Package org.cometd.bayeux.server

Examples of org.cometd.bayeux.server.ServerChannel


     * @see #addService(String, String)
     * @see #removeService(String, String)
     */
    protected void removeService(String channelName)
    {
        ServerChannel channel = _bayeux.getChannel(channelName);
        if (channel != null)
        {
            for (Invoker invoker : invokers.values())
            {
                if (invoker.channelName.equals(channelName))
                    channel.removeListener(invoker);
            }
        }
    }
View Full Code Here


                    {
                        if (!_oort.isOort(joiner))
                            _seti.disassociate(userName, session);
                        if (timeout)
                        {
                            ServerChannel channel = getBayeux().getChannel(channelName);
                            if (channel != null)
                            {
                                Map<String, Object> leave = new HashMap<>();
                                leave.put("leave", Boolean.TRUE);
                                leave.put("user", userName);
                                channel.publish(null, leave);
                            }
                        }
                    }
                });
View Full Code Here

    private void flushLazy(ServerMessage message)
    {
        synchronized (getLock())
        {
            ServerChannel channel = _bayeux.getChannel(message.getChannel());
            long lazyTimeout = -1;
            if (channel != null)
                lazyTimeout = channel.getLazyTimeout();
            if (lazyTimeout <= 0)
                lazyTimeout = _maxLazy;

            if (lazyTimeout <= 0)
                flush();
View Full Code Here

                _bayeux.addExtension(_ackExtension = new AcknowledgedMessagesExtension());
        }

        _bayeux.addExtension(_oortExtension);

        ServerChannel oortCloudChannel = _bayeux.createChannelIfAbsent(OORT_CLOUD_CHANNEL).getReference();
        oortCloudChannel.addAuthorizer(GrantAuthorizer.GRANT_ALL);
        oortCloudChannel.addListener(_cloudListener);

        ServerChannel oortServiceChannel = _bayeux.createChannelIfAbsent(OORT_SERVICE_CHANNEL).getReference();
        oortServiceChannel.addListener(_joinListener);

        _oortSession.handshake();
    }
View Full Code Here

        String setiChannel = generateSetiChannel(_setiId);
        _oort.deobserveChannel(setiChannel);

        BayeuxServer bayeux = _oort.getBayeuxServer();
        ServerChannel channel = bayeux.getChannel(setiChannel);
        if (channel != null)
            channel.setPersistent(false);

        _oort.deobserveChannel(SETI_ALL_CHANNEL);
        channel = bayeux.getChannel(SETI_ALL_CHANNEL);
        if (channel != null)
            channel.setPersistent(false);
    }
View Full Code Here

            logger.debug("Set local {}", info);

        sender.handshake();
        oort.addCometListener(this);
        BayeuxServer bayeuxServer = oort.getBayeuxServer();
        ServerChannel channel = bayeuxServer.createChannelIfAbsent(channelName, this).getReference();
        channel.addListener(messageListener);
        oort.observeChannel(channelName);

        // Notify other nodes of our initial value.
        // Must be done after registering listeners, to avoid missing responses from other nodes.
        channel.publish(getLocalSession(), info);

        if (logger.isDebugEnabled())
            logger.debug("{} started", this);
    }
View Full Code Here

    @Override
    protected void doStop() throws Exception
    {
        oort.deobserveChannel(channelName);
        ServerChannel channel = oort.getBayeuxServer().getChannel(channelName);
        if (channel != null)
            channel.removeListener(messageListener);
        oort.removeCometListener(this);
        sender.disconnect();
        infos.remove(oort.getURL());
        if (logger.isDebugEnabled())
            logger.debug("{} stopped", this);
View Full Code Here

                                public void run()
                                {
                                    try
                                    {
                                        sleep(delay);
                                        ServerChannel channel = oort2.getBayeuxServer().getChannel(message.getChannel());
                                        channel.publish(oort2.getOortSession(), message);
                                    }
                                    catch (InterruptedException ignored)
                                    {
                                    }
                                }
View Full Code Here

        List<ListenerCallback> callbacks = listeners.remove(bean);
        if (callbacks != null)
        {
            for (ListenerCallback callback : callbacks)
            {
                ServerChannel channel = bayeuxServer.getChannel(callback.subscription);
                if (channel != null)
                {
                    channel.removeListener(callback);
                    result = true;
                }
            }
        }
        return result;
View Full Code Here

        List<RemoteCallCallback> callbacks = remoteCalls.remove(bean);
        if (callbacks != null)
        {
            for (RemoteCallCallback callback : callbacks)
            {
                ServerChannel channel = bayeuxServer.getChannel(callback.subscription);
                if (channel != null)
                {
                    channel.removeListener(callback);
                    result = true;
                }
            }
        }
        return result;
View Full Code Here

TOP

Related Classes of org.cometd.bayeux.server.ServerChannel

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.