Merge "Bug 4735 - null pointer exception in SouthboundImpl"
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / AbstractEvent.java
index 1848ad705fde9880cb4b6f19671ca5c1f62f6b6c..d503a8d55fb40b04b59a8dc09f2af5b16541fcfe 100644 (file)
@@ -34,6 +34,19 @@ public abstract class AbstractEvent {
 
     private HandlerType handlerType;
     private Action action;
+    private int transactionId;
+
+    public int getTransactionId() {
+        return transactionId;
+    }
+
+    private static int txId = 0;
+    private static int incTxId() {
+        return ++txId;
+    }
+    public static int getTxId() {
+        return txId;
+    }
 
     private AbstractEvent() {
         // this is private to force proper construction
@@ -42,6 +55,7 @@ public abstract class AbstractEvent {
     protected AbstractEvent(HandlerType handlerType, Action action) {
         this.handlerType = handlerType;
         this.action = action;
+        this.transactionId = incTxId();
     }
 
     public HandlerType getHandlerType() {
@@ -54,7 +68,8 @@ public abstract class AbstractEvent {
 
     @Override
     public String toString() {
-        return "AbstractEvent [handlerType=" + handlerType + " action=" + action + "]";
+        return "AbstractEvent [transactionId=" + transactionId
+                + " handlerType=" + handlerType + " action=" + action + "]";
     }
 
     @Override