Пример #1
0
        /// <summary>
        /// Gets an available message channel for use with async subscribers.  It will
        /// setup the message channel pool if configured to do so.
        /// </summary>
        /// <returns>
        /// A channel for use, null if configuration dictates not to use the 
        /// channel pool.
        /// </returns>
        internal Channel<Msg> getMessageChannel()
        {
            lock (mu)
            {
                if (opts.subscriberDeliveryTaskCount > 0 && subChannelPool == null)
                {
                    subChannelPool = new SubChannelPool(this,
                        opts.subscriberDeliveryTaskCount);
                }

                if (subChannelPool != null)
                {
                    return subChannelPool.getChannel();
                }
            }

            return null;
        }
Пример #2
0
        // caller must lock
        // See Options.SubscriberDeliveryTaskCount
        private void enableSubChannelPooling()
        {
            if (subChannelPool != null)
                return;

            if (opts.subscriberDeliveryTaskCount > 0)
            {
                subChannelPool = new SubChannelPool(this,
                    opts.subscriberDeliveryTaskCount);
            }
        }