20
20
21
21
namespace Microsoft . Data . ProviderBase
22
22
{
23
- internal sealed class DbConnectionPool
23
+ internal sealed class DbConnectionPool : IDbConnectionPool
24
24
{
25
25
private enum State
26
26
{
@@ -418,9 +418,6 @@ internal WaitHandle[] GetHandles(bool withCreate)
418
418
private readonly List < DbConnectionInternal > _objectList ;
419
419
private int _totalObjects ;
420
420
421
- private static int _objectTypeCount ; // EventSource counter
422
- internal readonly int _objectID = System . Threading . Interlocked . Increment ( ref _objectTypeCount ) ;
423
-
424
421
// only created by DbConnectionPoolGroup.GetConnectionPool
425
422
internal DbConnectionPool (
426
423
DbConnectionFactory connectionFactory ,
@@ -474,17 +471,17 @@ private int CreationTimeout
474
471
get { return PoolGroupOptions . CreationTimeout ; }
475
472
}
476
473
477
- internal int Count
474
+ internal override int Count
478
475
{
479
476
get { return _totalObjects ; }
480
477
}
481
478
482
- internal DbConnectionFactory ConnectionFactory
479
+ internal override DbConnectionFactory ConnectionFactory
483
480
{
484
481
get { return _connectionFactory ; }
485
482
}
486
483
487
- internal bool ErrorOccurred
484
+ internal override bool ErrorOccurred
488
485
{
489
486
get { return _errorOccurred ; }
490
487
}
@@ -494,7 +491,7 @@ private bool HasTransactionAffinity
494
491
get { return PoolGroupOptions . HasTransactionAffinity ; }
495
492
}
496
493
497
- internal TimeSpan LoadBalanceTimeout
494
+ internal override TimeSpan LoadBalanceTimeout
498
495
{
499
496
get { return PoolGroupOptions . LoadBalanceTimeout ; }
500
497
}
@@ -522,12 +519,12 @@ private bool NeedToReplenish
522
519
}
523
520
}
524
521
525
- internal DbConnectionPoolIdentity Identity
522
+ internal override DbConnectionPoolIdentity Identity
526
523
{
527
524
get { return _identity ; }
528
525
}
529
526
530
- internal bool IsRunning
527
+ internal override bool IsRunning
531
528
{
532
529
get { return State . Running == _state ; }
533
530
}
@@ -542,48 +539,40 @@ private int MinPoolSize
542
539
get { return PoolGroupOptions . MinPoolSize ; }
543
540
}
544
541
545
- internal int ObjectID
546
- {
547
- get
548
- {
549
- return _objectID ;
550
- }
551
- }
552
-
553
542
#if NETFRAMEWORK
554
- internal DbConnectionPoolCounters PerformanceCounters
543
+ internal override DbConnectionPoolCounters PerformanceCounters
555
544
{
556
545
get { return _connectionFactory . PerformanceCounters ; }
557
546
}
558
547
#endif
559
548
560
- internal DbConnectionPoolGroup PoolGroup
549
+ internal override DbConnectionPoolGroup PoolGroup
561
550
{
562
551
get { return _connectionPoolGroup ; }
563
552
}
564
553
565
- internal DbConnectionPoolGroupOptions PoolGroupOptions
554
+ internal override DbConnectionPoolGroupOptions PoolGroupOptions
566
555
{
567
556
get { return _connectionPoolGroupOptions ; }
568
557
}
569
558
570
- internal DbConnectionPoolProviderInfo ProviderInfo
559
+ internal override DbConnectionPoolProviderInfo ProviderInfo
571
560
{
572
561
get { return _connectionPoolProviderInfo ; }
573
562
}
574
563
575
564
/// <summary>
576
565
/// Return the pooled authentication contexts.
577
566
/// </summary>
578
- internal ConcurrentDictionary < DbConnectionPoolAuthenticationContextKey , DbConnectionPoolAuthenticationContext > AuthenticationContexts
567
+ internal override ConcurrentDictionary < DbConnectionPoolAuthenticationContextKey , DbConnectionPoolAuthenticationContext > AuthenticationContexts
579
568
{
580
569
get
581
570
{
582
571
return _pooledDbAuthenticationContexts ;
583
572
}
584
573
}
585
574
586
- internal bool UseLoadBalancing
575
+ internal override bool UseLoadBalancing
587
576
{
588
577
get { return PoolGroupOptions . UseLoadBalancing ; }
589
578
}
@@ -704,7 +693,7 @@ private void CleanupCallback(object state)
704
693
QueuePoolCreateRequest ( ) ;
705
694
}
706
695
707
- internal void Clear ( )
696
+ internal override void Clear ( )
708
697
{
709
698
SqlClientEventSource . Log . TryPoolerTraceEvent ( "<prov.DbConnectionPool.Clear|RES|CPOOL> {0}, Clearing." , ObjectID ) ;
710
699
DbConnectionInternal obj ;
@@ -1039,7 +1028,7 @@ private void DeactivateObject(DbConnectionInternal obj)
1039
1028
Debug . Assert ( rootTxn == true || returnToGeneralPool == true || destroyObject == true ) ;
1040
1029
}
1041
1030
1042
- internal void DestroyObject ( DbConnectionInternal obj )
1031
+ internal override void DestroyObject ( DbConnectionInternal obj )
1043
1032
{
1044
1033
// A connection with a delegated transaction cannot be disposed of
1045
1034
// until the delegated transaction has actually completed. Instead,
@@ -1234,7 +1223,7 @@ private void WaitForPendingOpen()
1234
1223
} while ( _pendingOpens . TryPeek ( out next ) ) ;
1235
1224
}
1236
1225
1237
- internal bool TryGetConnection ( DbConnection owningObject , TaskCompletionSource < DbConnectionInternal > retry , DbConnectionOptions userOptions , out DbConnectionInternal connection )
1226
+ internal override bool TryGetConnection ( DbConnection owningObject , TaskCompletionSource < DbConnectionInternal > retry , DbConnectionOptions userOptions , out DbConnectionInternal connection )
1238
1227
{
1239
1228
uint waitForMultipleObjectsTimeout = 0 ;
1240
1229
bool allowCreate = false ;
@@ -1516,7 +1505,7 @@ private void PrepareConnection(DbConnection owningObject, DbConnectionInternal o
1516
1505
/// <param name="userOptions">Options used to create the new connection</param>
1517
1506
/// <param name="oldConnection">Inner connection that will be replaced</param>
1518
1507
/// <returns>A new inner connection that is attached to the <paramref name="owningObject"/></returns>
1519
- internal DbConnectionInternal ReplaceConnection ( DbConnection owningObject , DbConnectionOptions userOptions , DbConnectionInternal oldConnection )
1508
+ internal override DbConnectionInternal ReplaceConnection ( DbConnection owningObject , DbConnectionOptions userOptions , DbConnectionInternal oldConnection )
1520
1509
{
1521
1510
#if NETFRAMEWORK
1522
1511
PerformanceCounters . SoftConnectsPerSecond . Increment ( ) ;
@@ -1752,7 +1741,7 @@ private void PoolCreateRequest(object state)
1752
1741
}
1753
1742
}
1754
1743
1755
- internal void PutNewObject ( DbConnectionInternal obj )
1744
+ internal override void PutNewObject ( DbConnectionInternal obj )
1756
1745
{
1757
1746
Debug . Assert ( obj != null , "why are we adding a null object to the pool?" ) ;
1758
1747
@@ -1768,7 +1757,7 @@ internal void PutNewObject(DbConnectionInternal obj)
1768
1757
1769
1758
}
1770
1759
1771
- internal void PutObject ( DbConnectionInternal obj , object owningObject )
1760
+ internal override void PutObject ( DbConnectionInternal obj , object owningObject )
1772
1761
{
1773
1762
Debug . Assert ( obj != null , "null obj?" ) ;
1774
1763
@@ -1800,7 +1789,7 @@ internal void PutObject(DbConnectionInternal obj, object owningObject)
1800
1789
DeactivateObject ( obj ) ;
1801
1790
}
1802
1791
1803
- internal void PutObjectFromTransactedPool ( DbConnectionInternal obj )
1792
+ internal override void PutObjectFromTransactedPool ( DbConnectionInternal obj )
1804
1793
{
1805
1794
Debug . Assert ( obj != null , "null pooledObject?" ) ;
1806
1795
Debug . Assert ( obj . EnlistedTransaction == null , "pooledObject is still enlisted?" ) ;
@@ -1907,7 +1896,7 @@ private bool ReclaimEmancipatedObjects()
1907
1896
return emancipatedObjectFound ;
1908
1897
}
1909
1898
1910
- internal void Startup ( )
1899
+ internal override void Startup ( )
1911
1900
{
1912
1901
SqlClientEventSource . Log . TryPoolerTraceEvent ( "<prov.DbConnectionPool.Startup|RES|INFO|CPOOL> {0}, CleanupWait={1}" , ObjectID , _cleanupWait ) ;
1913
1902
_cleanupTimer = CreateCleanupTimer ( ) ;
@@ -1918,7 +1907,7 @@ internal void Startup()
1918
1907
}
1919
1908
}
1920
1909
1921
- internal void Shutdown ( )
1910
+ internal override void Shutdown ( )
1922
1911
{
1923
1912
SqlClientEventSource . Log . TryPoolerTraceEvent ( "<prov.DbConnectionPool.Shutdown|RES|INFO|CPOOL> {0}" , ObjectID ) ;
1924
1913
_state = State . ShuttingDown ;
@@ -1936,7 +1925,7 @@ internal void Shutdown()
1936
1925
// that is implemented inside DbConnectionPool. This method's counterpart (PutTransactedObject) should
1937
1926
// only be called from DbConnectionPool.DeactivateObject and thus the plumbing to provide access to
1938
1927
// other objects is unnecessary (hence the asymmetry of Ended but no Begin)
1939
- internal void TransactionEnded ( Transaction transaction , DbConnectionInternal transactedObject )
1928
+ internal override void TransactionEnded ( Transaction transaction , DbConnectionInternal transactedObject )
1940
1929
{
1941
1930
Debug . Assert ( transaction != null , "null transaction?" ) ;
1942
1931
Debug . Assert ( transactedObject != null , "null transactedObject?" ) ;
0 commit comments