-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathQueryCounterSessionHandlerMock.cs
More file actions
34 lines (28 loc) · 1.06 KB
/
QueryCounterSessionHandlerMock.cs
File metadata and controls
34 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Xtensive.Orm.Internals;
using Xtensive.Orm.Providers;
namespace Xtensive.Orm.Tests.Storage.Prefetch
{
internal class QueryCounterSessionHandlerMock : ChainingSessionHandler
{
private volatile int syncCounter;
private volatile int asyncCounter;
public int GetSyncCounter() => syncCounter;
public int GetAsyncCounter() => asyncCounter;
public QueryCounterSessionHandlerMock(SessionHandler chainedHandler) : base(chainedHandler)
{
}
public override void ExecuteQueryTasks(IEnumerable<QueryTask> queryTasks, bool allowPartialExecution)
{
_ = Interlocked.Increment(ref syncCounter);
base.ExecuteQueryTasks(queryTasks, allowPartialExecution);
}
public override Task ExecuteQueryTasksAsync(IEnumerable<QueryTask> queryTasks, bool allowPartialExecution, CancellationToken token)
{
_ = Interlocked.Increment(ref asyncCounter);
return base.ExecuteQueryTasksAsync(queryTasks, allowPartialExecution, token);
}
}
}