Exemplo n.º 1
0
 public CachedConnection(IotHubConnectionCache cache, IotHubConnection connection)
 {
     this.cache      = cache;
     this.Connection = connection;
     this.ThisLock   = new object();
     this.idleTimer  = new IOThreadTimer(s => ((CachedConnection)s).IdleTimerCallback(), this, false);
     this.idleTimer.Set(this.cache.IdleTimeout);
 }
        public IotHubDeviceScopeConnectionPool(IotHubConnectionCache cache, IotHubConnectionString connectionString, AmqpTransportSettings amqpTransportSettings)
        {
            this.cache                 = cache;
            this.connectionString      = connectionString;
            this.amqpTransportSettings = amqpTransportSettings;
            this.connectionPool        = new Dictionary <long, Tuple <IotHubDeviceMuxConnection, uint> >();
#if WINDOWS_UWP
            this.idleTimers = new Dictionary <IotHubDeviceMuxConnection, IOThreadTimerSlim>();
#else
            this.idleTimers = new Dictionary <IotHubDeviceMuxConnection, IOThreadTimer>();
#endif
            this.idleTimeout = amqpTransportSettings.AmqpConnectionPoolSettings.ConnectionIdleTimeout;
            this.thisLock    = new object();
        }
        public IotHubScopeConnectionPool(IotHubConnectionCache cache, IotHubConnectionString connectionString, AmqpTransportSettings amqpTransportSettings)
        {
            Fx.Assert(cache != null, "IotHubConnectionCache reference is null");
            this.cache            = cache;
            this.ConnectionString = connectionString;
            this.Connection       = new IotHubSingleTokenConnection(this, connectionString, amqpTransportSettings);
            this.thisLock         = new object();
#if WINDOWS_UWP || PCL || NETSTANDARD1_3
            this.idleTimer = new IOThreadTimerSlim(s => ((IotHubScopeConnectionPool)s).IdleTimerCallback(), this, false);
#else
            this.idleTimer = new IOThreadTimer(s => ((IotHubScopeConnectionPool)s).IdleTimerCallback(), this, false);
#endif
            this.idleTimeout = amqpTransportSettings.AmqpConnectionPoolSettings.ConnectionIdleTimeout;
            this.idleTimer.Set(this.idleTimeout);
        }