Fix Jdk8 compatibility
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / HandshakeManagerImpl.java
index db88573e8209fb0a7f6ff959aa0054771aa823d3..b108d336380b8429d28a512c53d9a7b19873220e 100644 (file)
@@ -14,6 +14,10 @@ import java.util.concurrent.TimeoutException;
 
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
 import org.opendaylight.openflowplugin.ConnectionException;
+import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
+import org.opendaylight.openflowplugin.api.openflow.md.core.ErrorHandler;
+import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeListener;
+import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeManager;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
@@ -116,6 +120,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
         } catch (Exception ex) {
             errorHandler.handleException(ex, null);
             connectionAdapter.disconnect();
+            handshakeListener.onHandshakeFailure();
             LOG.trace("ret - shake fail: {}", ex.getMessage());
         }
     }
@@ -291,6 +296,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("FIRST HELLO sent.", e);
             }
+            handshakeListener.onHandshakeFailure();
             throw new ConnectionException("FIRST HELLO sending failed because of connection issue.");
         }
     }
@@ -299,7 +305,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
     /**
      * after handshake set features, register to session
      * @param proposedVersion
-     * @param xId
+     * @param xid
      * @throws Exception 
      */
     protected void postHandshake(Short proposedVersion, Long xid) throws Exception {
@@ -333,11 +339,13 @@ public class HandshakeManagerImpl implements HandshakeManager {
             // handshake failed
             LOG.warn("issuing disconnect during handshake, reason: future expired", e);
             connectionAdapter.disconnect();
+            handshakeListener.onHandshakeFailure();
             throw e;
         } catch (Exception e) {
             // handshake failed
             LOG.warn("issuing disconnect during handshake, reason - RPC: {}", e.getMessage(), e);
             connectionAdapter.disconnect();
+            handshakeListener.onHandshakeFailure();
             throw e;
         }