You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@@ -131,7 +131,9 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
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);
|
||||
@@ -144,7 +146,9 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
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);
|
||||
@@ -277,7 +281,9 @@ namespace System.Data.ProviderBase {
|
||||
}
|
||||
else {
|
||||
if (retry.TrySetResult(task.Result)) {
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfNonPooledConnections.Increment();
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// The outer TaskCompletionSource was already completed
|
||||
@@ -293,7 +299,9 @@ namespace System.Data.ProviderBase {
|
||||
}
|
||||
|
||||
connection = CreateNonPooledConnection(owningConnection, poolGroup, userOptions);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfNonPooledConnections.Increment();
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if (owningConnection.ForceNewConnection) {
|
||||
@@ -425,7 +433,9 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
// lock prevents race condition with PruneConnectionPoolGroups
|
||||
newConnectionPoolGroups.Add(key, newConnectionPoolGroup);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfActiveConnectionPoolGroups.Increment();
|
||||
#endif
|
||||
connectionPoolGroup = newConnectionPoolGroup;
|
||||
_connectionPoolGroups = newConnectionPoolGroups;
|
||||
}
|
||||
@@ -483,7 +493,9 @@ namespace System.Data.ProviderBase {
|
||||
if (Bid.AdvancedOn) {
|
||||
Bid.Trace("<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> %d#, ReleasePool=%d#\n", ObjectID, pool.ObjectID);
|
||||
}
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfInactiveConnectionPools.Decrement();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -505,7 +517,9 @@ namespace System.Data.ProviderBase {
|
||||
if (Bid.AdvancedOn) {
|
||||
Bid.Trace("<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> %d#, ReleasePoolGroup=%d#\n", ObjectID, poolGroup.ObjectID);
|
||||
}
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfInactiveConnectionPoolGroups.Decrement();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -527,7 +541,9 @@ namespace System.Data.ProviderBase {
|
||||
// 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 {
|
||||
@@ -556,7 +572,9 @@ namespace System.Data.ProviderBase {
|
||||
}
|
||||
_poolsToRelease.Add(pool);
|
||||
}
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfInactiveConnectionPools.Increment();
|
||||
#endif
|
||||
}
|
||||
|
||||
internal void QueuePoolGroupForRelease(DbConnectionPoolGroup poolGroup) {
|
||||
@@ -566,7 +584,9 @@ namespace System.Data.ProviderBase {
|
||||
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) {
|
||||
|
@@ -207,6 +207,7 @@ namespace NAMESPACE {
|
||||
|
||||
partial void RepairInnerConnection();
|
||||
|
||||
#if !MOBILE
|
||||
// NOTE: This is just a private helper because OracleClient V1.1 shipped
|
||||
// with a different argument name and it's a breaking change to not use
|
||||
// the same argument names in V2.0 (VB Named Parameter Binding--Ick)
|
||||
@@ -235,6 +236,7 @@ namespace NAMESPACE {
|
||||
// we should consider a GC.KeepAlive(this) here.
|
||||
GC.KeepAlive(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
override public void EnlistTransaction(SysTx.Transaction transaction) {
|
||||
CONNECTIONOBJECTNAME.ExecutePermission.Demand();
|
||||
|
@@ -356,7 +356,9 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
Activate(transaction);
|
||||
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfActiveConnections.Increment();
|
||||
#endif
|
||||
}
|
||||
|
||||
internal void AddWeakReference(object value, int tag) {
|
||||
@@ -448,7 +450,9 @@ namespace System.Data.ProviderBase {
|
||||
else {
|
||||
Deactivate(); // ensure we de-activate non-pooled connections, or the data readers and transactions may not get cleaned up...
|
||||
|
||||
#if !MOBILE
|
||||
PerformanceCounters.HardDisconnectsPerSecond.Increment();
|
||||
#endif
|
||||
|
||||
// To prevent an endless recursion, we need to clear
|
||||
// the owning object before we call dispose so that
|
||||
@@ -463,11 +467,17 @@ namespace System.Data.ProviderBase {
|
||||
SetInStasis();
|
||||
}
|
||||
else {
|
||||
#if MONO_PARTIAL_DATA_IMPORT
|
||||
Dispose();
|
||||
#else
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfNonPooledConnections.Decrement();
|
||||
#endif
|
||||
if (this.GetType() != typeof(System.Data.SqlClient.SqlInternalConnectionSmi))
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -513,9 +523,11 @@ namespace System.Data.ProviderBase {
|
||||
Debug.Assert(0 == activateCount, "activated multiple times?");
|
||||
#endif // DEBUG
|
||||
|
||||
#if !MOBILE
|
||||
if (PerformanceCounters != null) { // Pool.Clear will DestroyObject that will clean performanceCounters before going here
|
||||
PerformanceCounters.NumberOfActiveConnections.Decrement();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!_connectionIsDoomed && Pool.UseLoadBalancing) {
|
||||
// If we're not already doomed, check the connection's lifetime and
|
||||
@@ -569,7 +581,9 @@ namespace System.Data.ProviderBase {
|
||||
// once and for all, or the server will have fits about us
|
||||
// leaving connections open until the client-side GC kicks
|
||||
// in.
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfNonPooledConnections.Decrement();
|
||||
#endif
|
||||
Dispose();
|
||||
}
|
||||
// When _pooledCount is 0, the connection is a pooled connection
|
||||
@@ -839,7 +853,9 @@ namespace System.Data.ProviderBase {
|
||||
internal void SetInStasis() {
|
||||
_isInStasis = true;
|
||||
Bid.PoolerTrace("<prov.DbConnectionInternal.SetInStasis|RES|CPOOL> %d#, Non-Pooled Connection has Delegated Transaction, waiting to Dispose.\n", ObjectID);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfStasisConnections.Increment();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void TerminateStasis(bool returningToPool) {
|
||||
@@ -849,7 +865,9 @@ namespace System.Data.ProviderBase {
|
||||
else {
|
||||
Bid.PoolerTrace("<prov.DbConnectionInternal.TerminateStasis|RES|CPOOL> %d#, Delegated Transaction has ended, connection is closed/leaked. Disposing.\n", ObjectID);
|
||||
}
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfStasisConnections.Decrement();
|
||||
#endif
|
||||
_isInStasis = false;
|
||||
}
|
||||
|
||||
|
@@ -235,8 +235,9 @@ namespace System.Data.ProviderBase {
|
||||
Bid.PoolerTrace("<prov.DbConnectionPool.TransactedConnectionPool.PutTransactedObject|RES|CPOOL> %d#, Transaction %d#, Connection %d#, Added.\n", ObjectID, transaction.GetHashCode(), transactedObject.ObjectID );
|
||||
}
|
||||
|
||||
#if !MOBILE
|
||||
Pool.PerformanceCounters.NumberOfFreeConnections.Increment();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
internal void TransactionEnded(SysTx.Transaction transaction, DbConnectionInternal transactedObject)
|
||||
@@ -300,7 +301,9 @@ namespace System.Data.ProviderBase {
|
||||
// connections, we'll put it back...
|
||||
if (0 <= entry)
|
||||
{
|
||||
#if !MOBILE
|
||||
Pool.PerformanceCounters.NumberOfFreeConnections.Decrement();
|
||||
#endif
|
||||
Pool.PutObjectFromTransactedPool(transactedObject);
|
||||
}
|
||||
}
|
||||
@@ -622,7 +625,9 @@ namespace System.Data.ProviderBase {
|
||||
if (_stackOld.TryPop(out obj)) {
|
||||
Debug.Assert(obj != null, "null connection is not expected");
|
||||
// If we obtained one from the old stack, destroy it.
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfFreeConnections.Decrement();
|
||||
#endif
|
||||
|
||||
// Transaction roots must survive even aging out (TxEnd event will clean them up).
|
||||
bool shouldDestroy = true;
|
||||
@@ -709,12 +714,16 @@ namespace System.Data.ProviderBase {
|
||||
// Second, dispose of all the free connections.
|
||||
while (_stackNew.TryPop(out obj)) {
|
||||
Debug.Assert(obj != null, "null connection is not expected");
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfFreeConnections.Decrement();
|
||||
#endif
|
||||
DestroyObject(obj);
|
||||
}
|
||||
while (_stackOld.TryPop(out obj)) {
|
||||
Debug.Assert(obj != null, "null connection is not expected");
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfFreeConnections.Decrement();
|
||||
#endif
|
||||
DestroyObject(obj);
|
||||
}
|
||||
|
||||
@@ -748,7 +757,9 @@ namespace System.Data.ProviderBase {
|
||||
}
|
||||
_objectList.Add(newObj);
|
||||
_totalObjects = _objectList.Count;
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfPooledConnections.Increment(); //
|
||||
#endif
|
||||
}
|
||||
|
||||
// If the old connection belonged to another pool, we need to remove it from that
|
||||
@@ -964,12 +975,16 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
if (removed) {
|
||||
Bid.PoolerTrace("<prov.DbConnectionPool.DestroyObject|RES|CPOOL> %d#, Connection %d#, Removed from pool.\n", ObjectID, obj.ObjectID);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfPooledConnections.Decrement();
|
||||
#endif
|
||||
}
|
||||
obj.Dispose();
|
||||
|
||||
Bid.PoolerTrace("<prov.DbConnectionPool.DestroyObject|RES|CPOOL> %d#, Connection %d#, Disposed.\n", ObjectID, obj.ObjectID);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.HardDisconnectsPerSecond.Increment();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1159,7 +1174,9 @@ namespace System.Data.ProviderBase {
|
||||
DbConnectionInternal obj = null;
|
||||
SysTx.Transaction transaction = null;
|
||||
|
||||
#if !MOBILE
|
||||
PerformanceCounters.SoftConnectsPerSecond.Increment();
|
||||
#endif
|
||||
|
||||
Bid.PoolerTrace("<prov.DbConnectionPool.GetConnection|RES|CPOOL> %d#, Getting connection.\n", ObjectID);
|
||||
|
||||
@@ -1192,10 +1209,12 @@ namespace System.Data.ProviderBase {
|
||||
finally {
|
||||
waitResult = SafeNativeMethods.WaitForMultipleObjectsEx(waitHandleCount, _waitHandles.DangerousGetHandle(), false, waitForMultipleObjectsTimeout, false);
|
||||
|
||||
#if !FULL_AOT_RUNTIME
|
||||
// VSTFDEVDIV 479551 - call GetHRForLastWin32Error immediately after after the native call
|
||||
if (waitResult == WAIT_FAILED) {
|
||||
waitForMultipleObjectsExHR = Marshal.GetHRForLastWin32Error();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// From the WaitAny docs: "If more than one object became signaled during
|
||||
@@ -1316,7 +1335,9 @@ namespace System.Data.ProviderBase {
|
||||
if (CREATION_HANDLE == waitResult) {
|
||||
int result = SafeNativeMethods.ReleaseSemaphore(_waitHandles.CreationHandle.DangerousGetHandle(), 1, IntPtr.Zero);
|
||||
if (0 == result) { // failure case
|
||||
#if !FULL_AOT_RUNTIME
|
||||
releaseSemaphoreResult = Marshal.GetHRForLastWin32Error();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (mustRelease) {
|
||||
@@ -1364,7 +1385,9 @@ namespace System.Data.ProviderBase {
|
||||
/// <param name="oldConnection">Inner connection that will be replaced</param>
|
||||
/// <returns>A new inner connection that is attached to the <paramref name="owningObject"/></returns>
|
||||
internal DbConnectionInternal ReplaceConnection(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) {
|
||||
#if !MOBILE
|
||||
PerformanceCounters.SoftConnectsPerSecond.Increment();
|
||||
#endif
|
||||
Bid.PoolerTrace("<prov.DbConnectionPool.ReplaceConnection|RES|CPOOL> %d#, replacing connection.\n", ObjectID);
|
||||
|
||||
DbConnectionInternal newConnection = UserCreateRequest(owningObject, userOptions, oldConnection);
|
||||
@@ -1402,7 +1425,9 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
if (null != obj) {
|
||||
Bid.PoolerTrace("<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> %d#, Connection %d#, Popped from general pool.\n", ObjectID, obj.ObjectID);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfFreeConnections.Decrement();
|
||||
#endif
|
||||
}
|
||||
return(obj);
|
||||
}
|
||||
@@ -1416,7 +1441,9 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
if (null != obj) {
|
||||
Bid.PoolerTrace("<prov.DbConnectionPool.GetFromTransactedPool|RES|CPOOL> %d#, Connection %d#, Popped from transacted pool.\n", ObjectID, obj.ObjectID);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfFreeConnections.Decrement();
|
||||
#endif
|
||||
|
||||
if (obj.IsTransactionRoot) {
|
||||
try {
|
||||
@@ -1560,14 +1587,17 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
_stackNew.Push(obj);
|
||||
_waitHandles.PoolSemaphore.Release(1);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfFreeConnections.Increment();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
internal void PutObject(DbConnectionInternal obj, object owningObject) {
|
||||
Debug.Assert(null != obj, "null obj?");
|
||||
|
||||
#if !MOBILE
|
||||
PerformanceCounters.SoftDisconnectsPerSecond.Increment();
|
||||
#endif
|
||||
|
||||
// Once a connection is closing (which is the state that we're in at
|
||||
// this point in time) you cannot delegate a transaction to or enlist
|
||||
@@ -1671,7 +1701,9 @@ namespace System.Data.ProviderBase {
|
||||
DbConnectionInternal obj = reclaimedObjects[i];
|
||||
|
||||
Bid.PoolerTrace("<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> %d#, Connection %d#, Reclaiming.\n", ObjectID, obj.ObjectID);
|
||||
#if !MOBILE
|
||||
PerformanceCounters.NumberOfReclaimedConnections.Increment();
|
||||
#endif
|
||||
|
||||
emancipatedObjectFound = true;
|
||||
|
||||
|
@@ -145,7 +145,9 @@ namespace System.Data.ProviderBase {
|
||||
|
||||
|
||||
DbConnectionFactory connectionFactory = pool.ConnectionFactory;
|
||||
#if !MOBILE
|
||||
connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement();
|
||||
#endif
|
||||
connectionFactory.QueuePoolForRelease(pool, true);
|
||||
}
|
||||
}
|
||||
@@ -198,7 +200,9 @@ namespace System.Data.ProviderBase {
|
||||
newPool.Startup(); // must start pool before usage
|
||||
bool addResult = _poolCollection.TryAdd(currentIdentity, newPool);
|
||||
Debug.Assert(addResult, "No other pool with current identity should exist at this point");
|
||||
#if !MOBILE
|
||||
connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Increment();
|
||||
#endif
|
||||
pool = newPool;
|
||||
newPool = null;
|
||||
}
|
||||
@@ -275,7 +279,9 @@ namespace System.Data.ProviderBase {
|
||||
// are completely empty.
|
||||
DbConnectionFactory connectionFactory = pool.ConnectionFactory;
|
||||
|
||||
#if !MOBILE
|
||||
connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement();
|
||||
#endif
|
||||
connectionFactory.QueuePoolForRelease(pool, false);
|
||||
}
|
||||
else {
|
||||
|
@@ -198,12 +198,14 @@ namespace System.Data.ProviderBase {
|
||||
}
|
||||
|
||||
static private void IntegratedSecurityError(int caller) {
|
||||
#if !FULL_AOT_RUNTIME
|
||||
// passing 1,2,3,4,5 instead of true/false so that with a debugger
|
||||
// we could determine more easily which Win32 method call failed
|
||||
int lastError = Marshal.GetHRForLastWin32Error();
|
||||
if ((Win32_CheckTokenMembership != caller) || (E_NotImpersonationToken != lastError)) {
|
||||
Marshal.ThrowExceptionForHR(lastError); // will only throw if (hresult < 0)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -32,7 +32,9 @@ namespace System.Data.ProviderBase {
|
||||
if (null != unknown) {
|
||||
RuntimeHelpers.PrepareConstrainedRegions();
|
||||
try {} finally {
|
||||
#if !FULL_AOT_RUNTIME
|
||||
base.handle = Marshal.GetIUnknownForObject(unknown); //
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user