DbConnectionInternal newConnection = CreateConnection(connectionOptions, poolKey, poolGroupProviderInfo, null, owningConnection, userOptions);
if (null != newConnection) {
+#if !MOBILE
PerformanceCounters.HardConnectsPerSecond.Increment();
+#endif
newConnection.MakeNonPooledObject(owningConnection, PerformanceCounters);
}
Bid.Trace("<prov.DbConnectionFactory.CreateNonPooledConnection|RES|CPOOL> %d#, Non-pooled database connection created.\n", ObjectID);
DbConnectionInternal newConnection = CreateConnection(options, poolKey, poolGroupProviderInfo, pool, owningObject, userOptions);
if (null != newConnection) {
+#if !MOBILE
PerformanceCounters.HardConnectsPerSecond.Increment();
+#endif
newConnection.MakePooledConnection(pool);
}
Bid.Trace("<prov.DbConnectionFactory.CreatePooledConnection|RES|CPOOL> %d#, Pooled database connection created.\n", ObjectID);
}
else {
if (retry.TrySetResult(task.Result)) {
+#if !MOBILE
PerformanceCounters.NumberOfNonPooledConnections.Increment();
+#endif
}
else {
// The outer TaskCompletionSource was already completed
}
connection = CreateNonPooledConnection(owningConnection, poolGroup, userOptions);
+#if !MOBILE
PerformanceCounters.NumberOfNonPooledConnections.Increment();
+#endif
}
else {
if (owningConnection.ForceNewConnection) {
// lock prevents race condition with PruneConnectionPoolGroups
newConnectionPoolGroups.Add(key, newConnectionPoolGroup);
+#if !MOBILE
PerformanceCounters.NumberOfActiveConnectionPoolGroups.Increment();
+#endif
connectionPoolGroup = newConnectionPoolGroup;
_connectionPoolGroups = newConnectionPoolGroups;
}
if (Bid.AdvancedOn) {
Bid.Trace("<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> %d#, ReleasePool=%d#\n", ObjectID, pool.ObjectID);
}
+#if !MOBILE
PerformanceCounters.NumberOfInactiveConnectionPools.Decrement();
+#endif
}
}
}
if (Bid.AdvancedOn) {
Bid.Trace("<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> %d#, ReleasePoolGroup=%d#\n", ObjectID, poolGroup.ObjectID);
}
+#if !MOBILE
PerformanceCounters.NumberOfInactiveConnectionPoolGroups.Decrement();
+#endif
}
}
}
// move idle entries from last prune pass to a queue for pending release
// otherwise process entry which may move it from active to idle
if (entry.Value.Prune()) { // may add entries to _poolsToRelease
+#if !MOBILE
PerformanceCounters.NumberOfActiveConnectionPoolGroups.Decrement();
+#endif
QueuePoolGroupForRelease(entry.Value);
}
else {
}
_poolsToRelease.Add(pool);
}
+#if !MOBILE
PerformanceCounters.NumberOfInactiveConnectionPools.Increment();
+#endif
}
internal void QueuePoolGroupForRelease(DbConnectionPoolGroup poolGroup) {
lock (_poolGroupsToRelease) {
_poolGroupsToRelease.Add(poolGroup);
}
+#if !MOBILE
PerformanceCounters.NumberOfInactiveConnectionPoolGroups.Increment();
+#endif
}
virtual protected DbConnectionInternal CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) {