From 526cbb181ae68d4858473a7774a81d7c1414b9e5 Mon Sep 17 00:00:00 2001 From: Tomas Olvecky Date: Thu, 9 Jan 2014 14:08:08 +0100 Subject: [PATCH] Always set interrupted flag when catching InterruptedException. Fixed catching InterruptedException in config-subsystem and netconf. In netconf persister propagate interrupted exception as it indicates that netconf connection was not established and thus config pushing does not work. Change-Id: I7934bddd2b7c6591d1a4557a60df39a6de15dc72 Signed-off-by: Tomas Olvecky --- .../osgi/NetconfOperationServiceFactoryImpl.java | 1 + .../netconf/persist/impl/osgi/ConfigPersisterActivator.java | 5 ++++- .../controller/netconf/client/NetconfClient.java | 1 + .../controller/netconf/ssh/threads/SocketThread.java | 2 ++ .../util/handler/ssh/virtualsocket/ChannelInputStream.java | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java index 35695f7510..2db3c9d4f1 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java @@ -45,6 +45,7 @@ public class NetconfOperationServiceFactoryImpl implements NetconfOperationServi try { Thread.sleep(ATTEMPT_TIMEOUT_MS); } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); throw new RuntimeException(e1); } continue; diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java index 656091115c..3c901c3f59 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java @@ -78,7 +78,10 @@ public class ConfigPersisterActivator implements BundleActivator { ignoredMissingCapabilityRegex); jmxNotificationHandler.init(); } catch (InterruptedException e) { - logger.info("Interrupted while waiting for netconf connection"); + Thread.currentThread().interrupt(); + logger.error("Interrupted while waiting for netconf connection"); + // uncaught exception handler will deal with this failure + throw new RuntimeException("Interrupted while waiting for netconf connection", e); } } }; diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java index 8b8c886a1c..67d95bb90f 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java @@ -110,6 +110,7 @@ public class NetconfClient implements Closeable { try { return sessionListener.getLastMessage(attempts, attemptMsDelay); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(this + " Cannot read message from " + address, e); } catch (IllegalStateException e) { throw new IllegalStateException(this + " Cannot read message from " + address, e); diff --git a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java index 32de75ca39..6df1915511 100644 --- a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java +++ b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java @@ -108,6 +108,7 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser netconf_ssh_input.join(); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); logger.error("netconf_ssh_input join error ",e); } @@ -116,6 +117,7 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser netconf_ssh_output.join(); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); logger.error("netconf_ssh_output join error ",e); } diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java index 07c81b0ccb..4b9bfbf5f8 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java @@ -57,6 +57,7 @@ public class ChannelInputStream extends InputStream implements ChannelInboundHan try { lock.wait(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } -- 2.36.6