@@ -75,10 +75,10 @@ public async Task WillGetSessionIdFromSessionLogsConcurrentAsync()
75
75
using ( var s = Sfi . OpenSession ( ) )
76
76
{
77
77
sessionIds . AddOrUpdate (
78
- Thread . CurrentThread . ManagedThreadId ,
78
+ i ,
79
79
s . GetSessionImplementation ( ) . SessionId ,
80
- ( tId , old ) => throw new InvalidOperationException (
81
- $ "Thread { tId } has already session id { old } , while attempting to set it to" +
80
+ ( ti , old ) => throw new InvalidOperationException (
81
+ $ "Thread number { ti } has already session id { old } , while attempting to set it to" +
82
82
$ " { s . GetSessionImplementation ( ) . SessionId } ") ) ;
83
83
semaphore . Wait ( ) ;
84
84
@@ -97,7 +97,7 @@ public async Task WillGetSessionIdFromSessionLogsConcurrentAsync()
97
97
using ( var spy = new TextLogSpy ( "NHibernate.SQL" , "%message | SessionId: %property{sessionId}" ) )
98
98
{
99
99
Array . ForEach ( array , thread => thread . Start ( ) ) ;
100
- // Give some time to threads for reaching the wait, having this way all of them ready to do most of their job concurrently.
100
+ // Give some time to threads for reaching the wait, having all of them ready to do most of their job concurrently.
101
101
await ( Task . Delay ( 100 ) ) ;
102
102
semaphore . Set ( ) ;
103
103
Array . ForEach ( array , thread => thread . Join ( ) ) ;
@@ -108,7 +108,7 @@ public async Task WillGetSessionIdFromSessionLogsConcurrentAsync()
108
108
for ( var i = 1 ; i < 11 ; i ++ )
109
109
for ( var j = 0 ; j < 10 ; j ++ )
110
110
{
111
- var sessionId = sessionIds [ array [ i - 1 ] . ManagedThreadId ] ;
111
+ var sessionId = sessionIds [ i ] ;
112
112
Assert . That ( loggingEvent , Does . Contain ( $ "@p0 = { i * 10 + j } [Type: Int32 (0:0:0)] | SessionId: { sessionId } ") ) ;
113
113
}
114
114
}
0 commit comments