summaryrefslogtreecommitdiffstats
path: root/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy')
-rw-r--r--vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy7
1 files changed, 5 insertions, 2 deletions
diff --git a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy
index dfd0c44ae..51bf5be9e 100644
--- a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy
+++ b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy
@@ -25,6 +25,9 @@ import org.openvpp.jvpp.VppJNIConnection
import org.openvpp.jvpp.future.FutureJVpp
import org.openvpp.jvpp.future.FutureJVppFacade
+/**
+ * This must be a singleton due to shutdown hook usage.
+ */
@Slf4j
@ToString
class JVppProvider extends ProviderTrait<FutureJVpp> {
@@ -38,8 +41,8 @@ class JVppProvider extends ProviderTrait<FutureJVpp> {
def jVpp = new JVppImpl(connection)
// Closing JVpp connection with shutdown hook to erase the connection from VPP so HC will be able
- // to connect next time
- // TODO is there a safer way than a shutdown hook ?
+ // to connect next time. If JVM is force closed, this will not be executed and VPP connection
+ // with name from config will stay open and prevent next startup of HC to success
Runtime.addShutdownHook {
log.info("Disconnecting from VPP")
jVpp.close()