Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added transaction counter.

  • Loading branch information...
commit 085a92fe436ac033f9e4a3aad6997eec313fd752 1 parent a802fcc
Victor Haydin VictorHaydin authored
73 FloatingQueueServer/Core/Server.cs
View
@@ -1,32 +1,45 @@
-using System.Collections.Generic;
-using System.ServiceModel;
-using Autofac;
-using FloatingQueue.ServiceProxy;
-
-namespace FloatingQueue.Server.Core
-{
- public class Server
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.Threading;
+using Autofac;
+using FloatingQueue.ServiceProxy;
+
+namespace FloatingQueue.Server.Core
+{
+ public class Server
{
- public static IContainer ServicesContainer { get; private set; }
-
- public static void Init(IContainer container)
- {
- ServicesContainer = container;
- }
-
- public static ILogger Log
- {
- get { return ServicesContainer.Resolve<ILogger>(); }
- }
-
- public static IConfiguration Configuration
- {
- get { return ServicesContainer.Resolve<IConfiguration>(); }
- }
-
- public static T Resolve<T>()
- {
- return ServicesContainer.Resolve<T>();
+ private static long ms_TransactionCounter = 0;
+
+ public static IContainer ServicesContainer { get; private set; }
+
+ public static void Init(IContainer container)
+ {
+ ServicesContainer = container;
}
- }
-}
+
+ public static ILogger Log
+ {
+ get { return ServicesContainer.Resolve<ILogger>(); }
+ }
+
+ public static IConfiguration Configuration
+ {
+ get { return ServicesContainer.Resolve<IConfiguration>(); }
+ }
+
+ public static long TransactionCounter
+ {
+ get { return ms_TransactionCounter; }
+ }
+
+ public static void FireTransactionCompleted()
+ {
+ Interlocked.Increment(ref ms_TransactionCounter);
+ }
+
+ public static T Resolve<T>()
+ {
+ return ServicesContainer.Resolve<T>();
+ }
+ }
+}
1  FloatingQueueServer/EventsLogic/EventAggregate.cs
View
@@ -62,6 +62,7 @@ public void Commit()
{
// todo: flush the data into file system here
m_HasUncommitedChanges = false;
+ Core.Server.FireTransactionCommited();
}
public void Rollback()
Please sign in to comment.
Something went wrong with that request. Please try again.