Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Common.Logging to v 3.0.0 #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Rhino.Queues.Tests/Rhino.Queues.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<Reference Include="Common.Logging">
<HintPath>..\packages\Common.Logging\lib\net35\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Core">
<HintPath>..\packages\Common.Logging.Core\lib\net35\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="Esent.Interop">
<HintPath>..\packages\Rhino.ServiceBus.References\lib\Esent.Interop.dll</HintPath>
</Reference>
Expand Down
130 changes: 65 additions & 65 deletions Rhino.Queues/Internal/QueueTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,77 +4,77 @@

namespace Rhino.Queues.Internal
{
public class QueueTransaction : ITransaction
{
private readonly QueueStorage queueStorage;
private readonly Action assertNotDisposed;
private readonly Action onComplete;
private readonly ILog logger = LogManager.GetCurrentClassLogger();
public class QueueTransaction : ITransaction
{
private readonly QueueStorage queueStorage;
private readonly Action assertNotDisposed;
private readonly Action onComplete;
private readonly ILog logger = LogManager.GetLogger<QueueTransaction>();

public QueueTransaction(QueueStorage queueStorage, Action onComplete, Action assertNotDisposed)
{
this.queueStorage = queueStorage;
this.assertNotDisposed = assertNotDisposed;
this.onComplete = onComplete;
Id = Guid.NewGuid();
}
public QueueTransaction(QueueStorage queueStorage, Action onComplete, Action assertNotDisposed)
{
this.queueStorage = queueStorage;
this.assertNotDisposed = assertNotDisposed;
this.onComplete = onComplete;
Id = Guid.NewGuid();
}

public Guid Id { get; private set; }
public Guid Id { get; private set; }

public void Rollback()
{
try
{
assertNotDisposed();
logger.DebugFormat("Rolling back transaction with id: {0}", Id);
queueStorage.Global(actions =>
{
actions.ReverseAllFrom(Id);
actions.DeleteMessageToSend(Id);
actions.Commit();
});
logger.DebugFormat("Rolledback transaction with id: {0}", Id);
}
catch (Exception e)
public void Rollback()
{
try
{
assertNotDisposed();
logger.DebugFormat("Rolling back transaction with id: {0}", Id);
queueStorage.Global(actions =>
{
actions.ReverseAllFrom(Id);
actions.DeleteMessageToSend(Id);
actions.Commit();
});
logger.DebugFormat("Rolledback transaction with id: {0}", Id);
}
catch (Exception e)
{
logger.Warn("Failed to rollback transaction " + Id, e);
throw;
throw;
}
finally
{
onComplete();
}
finally
{
onComplete();
}
}
}

public void Commit()
{
try
{
ActualCommit();
}
catch (Exception e)
{
logger.Warn("Failed to commit transaction " + Id, e);
throw;
}
finally
{
onComplete();
}
}
public void Commit()
{
try
{
ActualCommit();
}
catch (Exception e)
{
logger.Warn("Failed to commit transaction " + Id, e);
throw;
}
finally
{
onComplete();
}
}

private void ActualCommit()
{
assertNotDisposed();
logger.DebugFormat("Committing transaction with id: {0}", Id);
queueStorage.Global(actions =>
{
actions.RemoveReversalsMoveCompletedMessagesAndFinishSubQueueMove(Id);
actions.MarkAsReadyToSend(Id);
actions.DeleteRecoveryInformation(Id);
actions.Commit();
});
logger.DebugFormat("Commited transaction with id: {0}", Id);
}
}
private void ActualCommit()
{
assertNotDisposed();
logger.DebugFormat("Committing transaction with id: {0}", Id);
queueStorage.Global(actions =>
{
actions.RemoveReversalsMoveCompletedMessagesAndFinishSubQueueMove(Id);
actions.MarkAsReadyToSend(Id);
actions.DeleteRecoveryInformation(Id);
actions.Commit();
});
logger.DebugFormat("Commited transaction with id: {0}", Id);
}
}
}
3 changes: 3 additions & 0 deletions Rhino.Queues/Rhino.Queues.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<Reference Include="Common.Logging">
<HintPath>..\packages\Common.Logging\lib\net35\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Core">
<HintPath>..\packages\Common.Logging.Core\lib\net35\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="Esent.Interop">
<HintPath>..\packages\Rhino.ServiceBus.References\lib\Esent.Interop.dll</HintPath>
</Reference>
Expand Down
1 change: 1 addition & 0 deletions default.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ task Release -depends Test {
*\Rhino.Queues.dll `
*\Rhino.Queues.pdb `
*\Common.Logging.dll `
*\Common.Logging.Core.dll `
*\Rhino.Queues.xml `
*\Esent.Interop.dll `
*\Esent.Interop.xml `
Expand Down
Loading