Merge "BUG-5006: Rework testEnqueueEvent to avoid private methods"
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / AbstractEvent.java
index 1848ad705fde9880cb4b6f19671ca5c1f62f6b6c..c110bfc75803d1960d6f83fa287412db0fbc4158 100644 (file)
@@ -27,13 +27,27 @@ public abstract class AbstractEvent {
         NEUTRON_LOAD_BALANCER,
         NEUTRON_LOAD_BALANCER_POOL,
         NEUTRON_LOAD_BALANCER_POOL_MEMBER,
-        NODE;
+        NODE,
+        NEUTRON_L3_ADAPTER;
 
         public static final int size = HandlerType.values().length;
     }
 
     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 +56,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 +69,8 @@ public abstract class AbstractEvent {
 
     @Override
     public String toString() {
-        return "AbstractEvent [handlerType=" + handlerType + " action=" + action + "]";
+        return "AbstractEvent [transactionId=" + transactionId
+                + " handlerType=" + handlerType + " action=" + action + "]";
     }
 
     @Override