Merge "Use registerAbstractHandlerService consistently"
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / AbstractEvent.java
index eb8d75154c79136b8e6cf02276a65a41f070afa9..2417749a37aad9b5acbe1a0113329f309f959ccd 100644 (file)
@@ -1,11 +1,9 @@
 /*
- * Copyright (C) 2014 Red Hat, Inc.
+ * Copyright (c) 2014, 2016 Red Hat, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Dave Tucker, Flavio Fernandes
  */
 
 package org.opendaylight.ovsdb.openstack.netvirt;
@@ -29,13 +27,28 @@ public abstract class AbstractEvent {
         NEUTRON_LOAD_BALANCER,
         NEUTRON_LOAD_BALANCER_POOL,
         NEUTRON_LOAD_BALANCER_POOL_MEMBER,
-        NODE;
+        NODE,
+        NEUTRON_L3_ADAPTER,
+        DISTRIBUTED_ARP_SERVICE;
 
         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
@@ -44,6 +57,7 @@ public abstract class AbstractEvent {
     protected AbstractEvent(HandlerType handlerType, Action action) {
         this.handlerType = handlerType;
         this.action = action;
+        this.transactionId = incTxId();
     }
 
     public HandlerType getHandlerType() {
@@ -56,7 +70,8 @@ public abstract class AbstractEvent {
 
     @Override
     public String toString() {
-        return "AbstractEvent [handlerType=" + handlerType + " action=" + action + "]";
+        return "AbstractEvent [transactionId=" + transactionId
+                + " handlerType=" + handlerType + " action=" + action + "]";
     }
 
     @Override