Package org.cometd.bayeux.server

Examples of org.cometd.bayeux.server.ServerSession


        public void process(final Exchange exchange) {
            String channelName = producer.getEndpoint().getPath();
            BayeuxServerImpl bayeux = producer.getBayeux();
            ServerChannel channel = bayeux.getChannel(channelName);
            ServerSession serverSession = getServerSession();

            if (channel != null) {
                logDelivery(exchange, channel);
                channel.publish(serverSession, exchange.getIn().getBody(), null);
            }
View Full Code Here


        public void process(final Exchange exchange) {
            String channelName = producer.getEndpoint().getPath();
            BayeuxServerImpl bayeux = producer.getBayeux();
            ServerChannel channel = bayeux.getChannel(channelName);
            ServerSession serverSession = getServerSession();

            try {
                if (channel != null) {
                    logDelivery(exchange, channel);
                    ServerMessage.Mutable mutable = binding.createCometdMessage(channel, serverSession,
                                                                                exchange.getIn());
                    channel.publish(serverSession, mutable);
                }
            } finally {
                if (disconnectLocalSession && serverSession.isLocalSession()) {
                    LOG.trace("Disconnection local session {}", serverSession);
                    serverSession.disconnect();
                }
            }
        }
View Full Code Here

            consumer.getProcessor().process(exchange);

            if (ExchangeHelper.isOutCapable(exchange)) {
                ServerChannel channel = getBayeux().getChannel(channelName);
                ServerSession serverSession = getServerSession();

                ServerMessage.Mutable outMessage = binding.createCometdMessage(channel, serverSession, exchange.getOut());
                remote.deliver(serverSession, outMessage);
            }
        }
View Full Code Here

            consumer.getProcessor().process(exchange);

            if (ExchangeHelper.isOutCapable(exchange)) {
                ServerChannel channel = getBayeux().getChannel(channelName);
                ServerSession serverSession = getServerSession();

                ServerMessage.Mutable outMessage = binding.createCometdMessage(channel, serverSession, exchange.getOut());
                remote.deliver(serverSession, outMessage);
            }
        }
View Full Code Here

        public void process(final Exchange exchange) {
            String channelName = producer.getEndpoint().getPath();
            BayeuxServerImpl bayeux = producer.getBayeux();
            ServerChannel channel = bayeux.getChannel(channelName);
            ServerSession serverSession = getServerSession();

            if (channel != null) {
                logDelivery(exchange, channel);
                ServerMessage.Mutable mutable = binding.createCometdMessage(channel, serverSession, exchange.getIn());
                channel.publish(serverSession, mutable);
View Full Code Here

        public void process(final Exchange exchange) {
            String channelName = producer.getEndpoint().getPath();
            BayeuxServerImpl bayeux = producer.getBayeux();
            ServerChannel channel = bayeux.getChannel(channelName);
            ServerSession serverSession = getServerSession();

            if (channel != null) {
                logDelivery(exchange, channel);
                ServerMessage.Mutable mutable = binding.createCometdMessage(channel, serverSession,
                                                                            exchange.getIn());
View Full Code Here

        public void process(final Exchange exchange) {
            String channelName = producer.getEndpoint().getPath();
            BayeuxServerImpl bayeux = producer.getBayeux();
            ServerChannel channel = bayeux.getChannel(channelName);
            ServerSession serverSession = getServerSession();

            try {
                if (channel != null) {
                    logDelivery(exchange, channel);
                    ServerMessage.Mutable mutable = binding.createCometdMessage(channel, serverSession,
                                                                                exchange.getIn());
                    channel.publish(serverSession, mutable);
                }
            } finally {
                if (disconnectLocalSession && serverSession.isLocalSession()) {
                    LOG.trace("Disconnection local session {}", serverSession);
                    serverSession.disconnect();
                }
            }
        }
View Full Code Here

        // Allow long poll to establish
        Thread.sleep(1000);

        final CountDownLatch latch = new CountDownLatch(1);
        ServerSession session = bayeux.getSession(client.getId());
        session.addListener(new ServerSession.RemoveListener()
        {
            @Override
            public void removed(ServerSession session, boolean timeout)
            {
                latch.countDown();
View Full Code Here

        }
    }

    public void deliver(Session sender, ServerMessage.Mutable message)
    {
        ServerSession session = null;
        if (sender instanceof ServerSession)
            session = (ServerSession)sender;
        else if (sender instanceof LocalSession)
            session = ((LocalSession)sender).getServerSession();
View Full Code Here

        Assert.assertFalse(messageLatch.get().await(1, TimeUnit.SECONDS));

        // Disconnect
        Assert.assertTrue(client.disconnect(1000));

        final ServerSession serverSession = sessionRef.get();
        Assert.assertNotNull(serverSession);

        Assert.assertFalse(bayeux.getChannel(testChannelName).subscribe(serverSession));

        disconnectBayeuxClient(client);
View Full Code Here

TOP

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

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.