Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
<Compile Include="System\Transactions\VolatileEnlistmentMultiplexing.cs" />
<Compile Include="System\Transactions\VolatileEnlistmentState.cs" />
<Compile Include="System\Transactions\Configuration\AppSettings.cs" />
<Compile Include="System\Transactions\Configuration\ConfigurationStrings.cs" />
<Compile Include="System\Transactions\Configuration\DefaultSettingsSection.cs" />
<Compile Include="System\Transactions\Configuration\MachineSettingsSection.cs" />
<Compile Include="$(CommonPath)System\Obsoletions.cs" Link="Common\System\Obsoletions.cs" />
</ItemGroup>

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.IO;
using System.Runtime.Versioning;
using System.Threading;
using System.Transactions.Configuration;
#if WINDOWS
using System.Transactions.DtcProxyShim;
#endif
Expand Down Expand Up @@ -279,11 +278,7 @@ internal static IsolationLevel DefaultIsolationLevel
}
}

private static DefaultSettingsSection DefaultSettings => field ??= DefaultSettingsSection.GetSection();
private static MachineSettingsSection MachineSettings => field ??= MachineSettingsSection.GetSection();

private static bool s_defaultTimeoutValidated;
private static long s_defaultTimeoutTicks;
private static long s_defaultTimeoutTicks = TimeSpan.FromMinutes(1).Ticks;
public static TimeSpan DefaultTimeout
{
get
Expand All @@ -292,22 +287,6 @@ public static TimeSpan DefaultTimeout
if (etwLog.IsEnabled())
{
etwLog.MethodEnter(TraceSourceType.TraceSourceBase, "TransactionManager.get_DefaultTimeout");
}

if (!s_defaultTimeoutValidated)
{
LazyInitializer.EnsureInitialized(ref s_defaultTimeoutTicks, ref s_defaultTimeoutValidated, ref s_classSyncObject, () => ValidateTimeout(DefaultSettingsSection.Timeout).Ticks);
if (Interlocked.Read(ref s_defaultTimeoutTicks) != DefaultSettingsSection.Timeout.Ticks)
{
if (etwLog.IsEnabled())
{
etwLog.ConfiguredDefaultTimeoutAdjusted();
}
}
}

if (etwLog.IsEnabled())
{
etwLog.MethodExit(TraceSourceType.TraceSourceBase, "TransactionManager.get_DefaultTimeout");
}
return new TimeSpan(Interlocked.Read(ref s_defaultTimeoutTicks));
Expand All @@ -320,17 +299,21 @@ public static TimeSpan DefaultTimeout
etwLog.MethodEnter(TraceSourceType.TraceSourceBase, "TransactionManager.set_DefaultTimeout");
}

Interlocked.Exchange(ref s_defaultTimeoutTicks, ValidateTimeout(value).Ticks);
if (Interlocked.Read(ref s_defaultTimeoutTicks) != value.Ticks)
bool timeoutAdjusted;
lock (ClassSyncObject)
{
TimeSpan validatedTimeout = ValidateTimeout(value);
Interlocked.Exchange(ref s_defaultTimeoutTicks, validatedTimeout.Ticks);
timeoutAdjusted = validatedTimeout != value;
}
if (timeoutAdjusted)
{
if (etwLog.IsEnabled())
{
etwLog.ConfiguredDefaultTimeoutAdjusted();
}
}

s_defaultTimeoutValidated = true;

if (etwLog.IsEnabled())
{
etwLog.MethodExit(TraceSourceType.TraceSourceBase, "TransactionManager.set_DefaultTimeout");
Expand All @@ -339,8 +322,7 @@ public static TimeSpan DefaultTimeout
}


private static bool s_cachedMaxTimeout;
private static TimeSpan s_maximumTimeout;
private static long s_maximumTimeoutTicks = TimeSpan.FromMinutes(10).Ticks;
public static TimeSpan MaximumTimeout
{
get
Expand All @@ -349,16 +331,9 @@ public static TimeSpan MaximumTimeout
if (etwLog.IsEnabled())
{
etwLog.MethodEnter(TraceSourceType.TraceSourceBase, "TransactionManager.get_DefaultMaximumTimeout");
}

LazyInitializer.EnsureInitialized(ref s_maximumTimeout, ref s_cachedMaxTimeout, ref s_classSyncObject, () => MachineSettingsSection.MaxTimeout);

if (etwLog.IsEnabled())
{
etwLog.MethodExit(TraceSourceType.TraceSourceBase, "TransactionManager.get_DefaultMaximumTimeout");
}

return s_maximumTimeout;
return new TimeSpan(Interlocked.Read(ref s_maximumTimeoutTicks));
}
set
{
Expand All @@ -370,13 +345,17 @@ public static TimeSpan MaximumTimeout

ArgumentOutOfRangeException.ThrowIfLessThan(value, TimeSpan.Zero);

s_cachedMaxTimeout = true;
s_maximumTimeout = value;
LazyInitializer.EnsureInitialized(ref s_defaultTimeoutTicks, ref s_defaultTimeoutValidated, ref s_classSyncObject, () => DefaultSettingsSection.Timeout.Ticks);
bool timeoutAdjusted;
lock (ClassSyncObject)
{
Interlocked.Exchange(ref s_maximumTimeoutTicks, value.Ticks);

long defaultTimeoutTicks = Interlocked.Read(ref s_defaultTimeoutTicks);
Interlocked.Exchange(ref s_defaultTimeoutTicks, ValidateTimeout(new TimeSpan(defaultTimeoutTicks)).Ticks);
if (Interlocked.Read(ref s_defaultTimeoutTicks) != defaultTimeoutTicks)
TimeSpan timeout = new TimeSpan(s_defaultTimeoutTicks);
TimeSpan validatedTimeout = ValidateTimeout(timeout);
Interlocked.Exchange(ref s_defaultTimeoutTicks, validatedTimeout.Ticks);
timeoutAdjusted = validatedTimeout != timeout;
}
if (timeoutAdjusted)
{
if (etwLog.IsEnabled())
{
Expand Down Expand Up @@ -615,6 +594,6 @@ internal static Transaction FindOrCreatePromotedTransaction(Guid transactionIden
internal static OletxTransactionManager DistributedTransactionManager =>
// If the distributed transaction manager is not configured, throw an exception
LazyInitializer.EnsureInitialized(ref distributedTransactionManager, ref s_classSyncObject,
() => new OletxTransactionManager(DefaultSettingsSection.DistributedTransactionManagerName));
() => new OletxTransactionManager(""));
}
}