Package org.cometd.bayeux.server.ConfigurableServerChannel

Examples of org.cometd.bayeux.server.ConfigurableServerChannel.Initializer


                {
                    result = true;
                    String[] channels = configure.value();
                    for (String channel : channels)
                    {
                        final Initializer init = new Initializer()
                        {
                            public void configureChannel(ConfigurableServerChannel channel)
                            {
                                boolean flip = false;
                                try
                                {
                                    if (logger.isDebugEnabled())
                                        logger.debug("Configure channel {} with method {} on bean {}", channel, method, bean);
                                    if (!method.isAccessible())
                                    {
                                        flip = true;
                                        method.setAccessible(true);
                                    }
                                    method.invoke(bean, channel);
                                }
                                catch (Exception x)
                                {
                                    throw new RuntimeException(x);
                                }
                                finally
                                {
                                    if (flip)
                                        method.setAccessible(false);
                                }
                            }
                        };

                        MarkedReference<ServerChannel> initializedChannel = bayeuxServer.createChannelIfAbsent(channel, init);

                        if (initializedChannel.isMarked())
                        {
                            if (logger.isDebugEnabled())
                                logger.debug("Channel {} already initialized. Not called method {} on bean {}", channel, method, bean);
                        }
                        else
                        {
                            if (configure.configureIfExists())
                            {
                                if (logger.isDebugEnabled())
                                    logger.debug("Configure channel {} with method {} on bean {}", channel, method, bean);
                                init.configureChannel(initializedChannel.getReference());
                            }
                            else if (configure.errorIfExists())
                            {
                                throw new IllegalStateException("Channel already configured: " + channel);
                            }
View Full Code Here

TOP

Related Classes of org.cometd.bayeux.server.ConfigurableServerChannel.Initializer

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.