Skip to content

Commit 4f9e58f

Browse files
committed
Update to Java commit d433ceb (2025.08.25): Set retryex to be static in LockingTransaction.
1 parent 8dc2c99 commit 4f9e58f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Clojure/Clojure/Lib/LockingTransaction.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
using System;
1616
using System.Collections.Generic;
17-
using System.Threading;
1817
using System.Runtime.Serialization;
18+
using System.Threading;
1919

2020
namespace clojure.lang
2121
{
@@ -74,7 +74,7 @@ public class LockingTransaction
7474
/// The transaction has been committed.
7575
/// </summary>
7676
const int COMMITTED = 4;
77-
77+
7878
#endregion
7979

8080
#region supporting classes
@@ -178,7 +178,7 @@ public long StartPoint
178178
public CountDownLatch Latch
179179
{
180180
get { return _latch; }
181-
}
181+
}
182182

183183

184184
#endregion
@@ -287,7 +287,7 @@ public CFn(IFn fn, ISeq args)
287287
/// Transactions consume a point for init, for each retry,
288288
/// and on commit if writing.</para>
289289
/// </remarks>
290-
private static readonly AtomicLong _lastPoint = new AtomicLong();
290+
private static readonly AtomicLong _lastPoint = new();
291291

292292
/// <summary>
293293
/// The state of the transaction.
@@ -313,32 +313,32 @@ public CFn(IFn fn, ISeq args)
313313
/// <summary>
314314
/// Cached retry exception.
315315
/// </summary>
316-
readonly RetryEx _retryex = new RetryEx();
316+
static readonly RetryEx _retryex = new();
317317

318318
/// <summary>
319319
/// Agent actions pending on this thread.
320320
/// </summary>
321-
readonly List<Agent.Action> _actions = new List<Agent.Action>();
321+
readonly List<Agent.Action> _actions = new();
322322

323323
/// <summary>
324324
/// Ref assignments made in this transaction (both sets and commutes).
325325
/// </summary>
326-
readonly Dictionary<Ref, Object> _vals = new Dictionary<Ref, Object>();
326+
readonly Dictionary<Ref, Object> _vals = new();
327327

328328
/// <summary>
329329
/// Refs that have been set in this transaction.
330330
/// </summary>
331-
readonly HashSet<Ref> _sets = new HashSet<Ref>();
331+
readonly HashSet<Ref> _sets = new();
332332

333333
/// <summary>
334334
/// Ref commutes that have been made in this transaction.
335335
/// </summary>
336-
readonly SortedDictionary<Ref, List<CFn>> _commutes = new SortedDictionary<Ref, List<CFn>>();
336+
readonly SortedDictionary<Ref, List<CFn>> _commutes = new();
337337

338338
/// <summary>
339339
/// The set of Refs holding read locks.
340340
/// </summary>
341-
readonly HashSet<Ref> _ensures = new HashSet<Ref>();
341+
readonly HashSet<Ref> _ensures = new();
342342

343343
#endregion
344344

@@ -402,7 +402,7 @@ void TryWriteLock(Ref r)
402402
if (!r.TryEnterWriteLock(LockWaitMsecs))
403403
throw _retryex;
404404
}
405-
catch (ThreadInterruptedException )
405+
catch (ThreadInterruptedException)
406406
{
407407
throw _retryex;
408408
}
@@ -616,8 +616,8 @@ object Run(IFn fn)
616616

617617
bool done = false;
618618
object ret = null;
619-
List<Ref> locked = new List<Ref>();
620-
List<Notify> notify = new List<Notify>();
619+
List<Ref> locked = new();
620+
List<Notify> notify = new();
621621

622622
for (int i = 0; !done && i < RetryLimit; i++)
623623
{
@@ -649,11 +649,11 @@ object Run(IFn fn)
649649
TryWriteLock(r);
650650
locked.Add(r);
651651

652-
if (wasEnsured && r.CurrentValPoint() > _readPoint )
652+
if (wasEnsured && r.CurrentValPoint() > _readPoint)
653653
throw _retryex;
654654

655655
Info refinfo = r.TInfo;
656-
if ( refinfo != null && refinfo != _info && refinfo.IsRunning)
656+
if (refinfo != null && refinfo != _info && refinfo.IsRunning)
657657
{
658658
if (!Barge(refinfo))
659659
{
@@ -685,7 +685,7 @@ object Run(IFn fn)
685685
Ref r = pair.Key;
686686
object oldval = r.TryGetVal();
687687
object newval = pair.Value;
688-
688+
689689
r.SetValue(newval, commitPoint);
690690
if (r.getWatches().count() > 0)
691691
notify.Add(new Notify(r, oldval, newval));

0 commit comments

Comments
 (0)