summaryrefslogtreecommitdiffstats
path: root/acl
diff options
context:
space:
mode:
Diffstat (limited to 'acl')
-rw-r--r--acl/acl-impl/pom.xml6
-rw-r--r--acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/JVppAclProvider.java17
2 files changed, 13 insertions, 10 deletions
diff --git a/acl/acl-impl/pom.xml b/acl/acl-impl/pom.xml
index e7fad9e0a..638ea54c2 100644
--- a/acl/acl-impl/pom.xml
+++ b/acl/acl-impl/pom.xml
@@ -35,6 +35,12 @@
<dependencies>
<dependency>
+ <groupId>io.fd.honeycomb</groupId>
+ <artifactId>cfg-init</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>io.fd.hc2vpp.acl</groupId>
<artifactId>acl-api</artifactId>
<version>${project.version}</version>
diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/JVppAclProvider.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/JVppAclProvider.java
index be8c48894..96e26a4e3 100644
--- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/JVppAclProvider.java
+++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/JVppAclProvider.java
@@ -19,6 +19,7 @@ package io.fd.hc2vpp.acl;
import com.google.inject.Inject;
import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.honeycomb.binding.init.ProviderTrait;
+import io.fd.honeycomb.data.init.ShutdownHandler;
import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.acl.JVppAclImpl;
@@ -37,24 +38,20 @@ class JVppAclProvider extends ProviderTrait<FutureJVppAclFacade> implements Jvpp
@Inject
private JVppRegistry registry;
- private static JVppAclImpl initAclApi() {
+ @Inject
+ private ShutdownHandler shutdownHandler;
+
+ private static JVppAclImpl initAclApi(final ShutdownHandler shutdownHandler) {
final JVppAclImpl jvppAcl = new JVppAclImpl();
// Free jvpp-acl plugin's resources on shutdown
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- LOG.info("Unloading jvpp-acl plugin");
- jvppAcl.close();
- LOG.info("Successfully unloaded jvpp-acl plugin");
- }
- });
+ shutdownHandler.register("jvpp-acl", jvppAcl);
return jvppAcl;
}
@Override
protected FutureJVppAclFacade create() {
try {
- return reportVersionAndGet(initAclApi());
+ return reportVersionAndGet(initAclApi(shutdownHandler));
} catch (IOException e) {
throw new IllegalStateException("Unable to open VPP management connection", e);
} catch (TimeoutException | VppBaseCallException e) {