Skip to content

Commit

Permalink
Apply review
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericDelaporte committed Feb 8, 2024
1 parent ba17141 commit ec2b74d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
8 changes: 1 addition & 7 deletions src/NHibernate/Engine/ISessionImplementor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,7 @@ internal static IDisposable BeginProcess(this ISessionImplementor session)
}

internal static bool IsProcessing(this ISessionImplementor session)
{
if (session == null)
return false;
return session is AbstractSessionImpl impl
? impl.IsProcessing
: false;
}
=> session is AbstractSessionImpl impl && impl.IsProcessing;

//6.0 TODO: Expose as ISessionImplementor.FutureBatch and replace method usages with property
internal static IQueryBatch GetFutureBatch(this ISessionImplementor session)
Expand Down
18 changes: 10 additions & 8 deletions src/NHibernate/Transaction/AdoNetWithSystemTransactionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,11 @@ protected virtual void CompleteTransaction(bool isCommitted)
// Throwing would give up attempting to close the session if need be, which may still succeed. So,
// just log an error.
_logger.Error(
"A synchronization timeout occurred at transaction completion: the session is still processing. Attempting " +
"to finalize the transaction concurrently, which may cause thread safety failure. You may " +
"raise {0} if it is set too low. It may also be a limitation of the data provider, like not " +
"supporting transaction scope timeouts occurring on concurrent threads.",
"A synchronization timeout occurred at transaction completion: the session is still processing. " +
"Attempting to finalize the transaction concurrently, which may cause a thread concurrency failure. " +
"You may raise {0} if it is set too low. It may also be a limitation of the data provider, " +
"like locks applied on its side while processing transaction cancellations occurring on concurrent threads, " +
"thus preventing the session to finish its current processing during a transaction cancellation.",
Cfg.Environment.SystemTransactionCompletionLockTimeout);
}
}
Expand Down Expand Up @@ -526,10 +527,11 @@ protected virtual void CompleteTransaction(bool isCommitted)
if (isSessionProcessing)
{
throw new HibernateException(
"A synchronization timeout occurred at transaction completion: the session was still processing. You may " +
$"raise {Cfg.Environment.SystemTransactionCompletionLockTimeout} if it is set too low. It may also " +
"be a limitation of the data provider, like not supporting transaction scope timeouts occurring on " +
"concurrent threads.");
"A synchronization timeout occurred at transaction completion: the session was still processing. " +
$"You may raise {Cfg.Environment.SystemTransactionCompletionLockTimeout} if it is set too low. " +
"It may also be a limitation of the data provider, " +
"like locks applied on its side while processing transaction cancellations occurring on concurrent threads, " +
"thus preventing the session to finish its current processing during a transaction cancellation.");
}
}

Expand Down

0 comments on commit ec2b74d

Please sign in to comment.