summaryrefslogtreecommitdiffstats
path: root/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro')
-rw-r--r--vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy3
-rw-r--r--vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy7
-rw-r--r--vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy2
3 files changed, 8 insertions, 4 deletions
diff --git a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy
index 5016d4e19..e056f38f8 100644
--- a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy
+++ b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy
@@ -21,6 +21,7 @@ import com.google.inject.name.Named
import groovy.transform.ToString
import groovy.util.logging.Slf4j
import io.fd.honeycomb.infra.distro.ProviderTrait
+import io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule
import io.fd.honeycomb.translate.read.ReaderFactory
import org.opendaylight.controller.md.sal.binding.api.DataBroker
import io.fd.honeycomb.vpp.context.ContextsReaderFactory
@@ -33,7 +34,7 @@ import io.fd.honeycomb.vpp.context.ContextsReaderFactory
class ContextsReaderFactoryProvider extends ProviderTrait<ReaderFactory> {
@Inject
- @Named("honeycomb-context")
+ @Named(ContextPipelineModule.HONEYCOMB_CONTEXT)
DataBroker contextDataBroker
def create() { new ContextsReaderFactory(contextDataBroker) }
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()
diff --git a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy
index 4c2573ca1..68261c34d 100644
--- a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy
+++ b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy
@@ -34,7 +34,7 @@ public final class VppCommonModule extends AbstractModule {
bind(FutureJVpp).toProvider(JVppProvider).in(Singleton)
- // Naming contexts reader exposing context storage over REST/NETCONF
+ // Naming contexts reader exposing context storage over REST/HONEYCOMB_NETCONF
Multibinder.newSetBinder(binder(), ReaderFactory.class).with {
addBinding().toProvider(ContextsReaderFactoryProvider).in(Singleton)
}