-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58d11d2
commit 0bb7cf3
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/NHibernate.Search/Async/Backend/Impl/PostTransactionWorkQueueSynchronization.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by AsyncGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
|
||
using NHibernate.Transaction; | ||
using NHibernate.Util; | ||
|
||
namespace NHibernate.Search.Backend.Impl | ||
{ | ||
using System.Threading.Tasks; | ||
using System.Threading; | ||
internal partial class PostTransactionWorkQueueSynchronization : ITransactionCompletionSynchronization | ||
{ | ||
public Task ExecuteBeforeTransactionCompletionAsync(CancellationToken cancellationToken) | ||
{ | ||
if (cancellationToken.IsCancellationRequested) | ||
{ | ||
return Task.FromCanceled<object>(cancellationToken); | ||
} | ||
try | ||
{ | ||
ExecuteBeforeTransactionCompletion(); | ||
return Task.CompletedTask; | ||
} | ||
catch (System.Exception ex) | ||
{ | ||
return Task.FromException<object>(ex); | ||
} | ||
} | ||
|
||
public Task ExecuteAfterTransactionCompletionAsync(bool success, CancellationToken cancellationToken) | ||
{ | ||
if (cancellationToken.IsCancellationRequested) | ||
{ | ||
return Task.FromCanceled<object>(cancellationToken); | ||
} | ||
try | ||
{ | ||
ExecuteAfterTransactionCompletion(success); | ||
return Task.CompletedTask; | ||
} | ||
catch (System.Exception ex) | ||
{ | ||
return Task.FromException<object>(ex); | ||
} | ||
} | ||
} | ||
} |