Example #1
0
        private Channel Channel(AdvertisedSocketAddress destination)
        {
            ReconnectingChannel channel = _channels.get(destination);

            if (channel == null)
            {
                channel = new ReconnectingChannel(_bootstrap, _eventLoopGroup.next(), destination, _log);
                channel.Start();
                ReconnectingChannel existingNonBlockingChannel = _channels.putIfAbsent(destination, channel);

                if (existingNonBlockingChannel != null)
                {
                    channel.Dispose();
                    channel = existingNonBlockingChannel;
                }
                else
                {
                    _log.info("Creating channel to: [%s] ", destination);
                }
            }

            return(channel);
        }
Example #2
0
 public virtual ReconnectingChannel PutIfAbsent(AdvertisedSocketAddress to, ReconnectingChannel timestampedLazyChannel)
 {
     return(_lazyChannelMap.GetOrAdd(to, timestampedLazyChannel));
 }