Skip to content
Permalink
Browse files

Problem: JNI bindings are out of sync

Solution: Re-generate them!
  • Loading branch information...
Kevin Sapper
Kevin Sapper committed Jul 17, 2019
1 parent 0457a5b commit f2330105e3b0132f6951b368dfd865cb104e4959
@@ -26,7 +26,7 @@ targetCompatibility = 1.8

dependencies {
compile 'org.zeromq:czmq-jni:+'
compile 'org.scijava:native-lib-loader:2.3.2'
compile 'org.scijava:native-lib-loader:2.3.4'
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-all:1.3'
}
@@ -1,5 +1,6 @@
package org.zeromq.tools;

import java.io.IOException;
import java.util.Set;
import java.util.HashSet;
import org.scijava.nativelib.NativeLoader;
@@ -8,16 +9,16 @@

private static final Set<String> loadedLibraries = new HashSet<>();

public static void loadLibrary(String libname) {
public static void loadLibrary(String libname, boolean optional) {
if (!loadedLibraries.contains(libname)) {
try {
if (System.getProperty("java.vm.vendor").contains("Android")) {
System.loadLibrary(libname);
NativeLoader.loadLibrary(libname);
} catch (IOException e) {
if (optional) {
System.err.println("[WARN] " + e.getMessage() + " from jar. Assuming it is installed on the system.");
} else {
NativeLoader.loadLibrary(libname);
System.exit(-1);
}
} catch (Exception e) {
System.err.println("[WARN] " + e.getMessage() +" from jar. Assuming it is installed on the system.");
}
loadedLibraries.add(libname);
}
@@ -6,29 +6,15 @@
*/
package org.zeromq.zyre;

import java.util.stream.Stream;
import org.zeromq.tools.ZmqNativeLoader;
import org.zeromq.czmq.*;

public class Zyre implements AutoCloseable{
public class Zyre implements AutoCloseable {
static {
Stream.of(
"zmq",
"czmq",
"zyre"
)
.forEach(lib -> {
try {
ZmqNativeLoader.loadLibrary(lib);
} catch (Exception e) {
System.err.println("[WARN] " + e.getMessage() +" from jar. Assuming it is installed on the system.");
}
});
try {
ZmqNativeLoader.loadLibrary("zyrejni");
} catch (Exception e) {
System.exit (-1);
}
ZmqNativeLoader.loadLibrary("zmq", true);
ZmqNativeLoader.loadLibrary("czmq", true);
ZmqNativeLoader.loadLibrary("zyre", true);
ZmqNativeLoader.loadLibrary("zyrejni", false);
}
public long self;
/*
@@ -6,29 +6,15 @@
*/
package org.zeromq.zyre;

import java.util.stream.Stream;
import org.zeromq.tools.ZmqNativeLoader;
import org.zeromq.czmq.*;

public class ZyreEvent implements AutoCloseable{
public class ZyreEvent implements AutoCloseable {
static {
Stream.of(
"zmq",
"czmq",
"zyre"
)
.forEach(lib -> {
try {
ZmqNativeLoader.loadLibrary(lib);
} catch (Exception e) {
System.err.println("[WARN] " + e.getMessage() +" from jar. Assuming it is installed on the system.");
}
});
try {
ZmqNativeLoader.loadLibrary("zyrejni");
} catch (Exception e) {
System.exit (-1);
}
ZmqNativeLoader.loadLibrary("zmq", true);
ZmqNativeLoader.loadLibrary("czmq", true);
ZmqNativeLoader.loadLibrary("zyre", true);
ZmqNativeLoader.loadLibrary("zyrejni", false);
}
public long self;
/*

0 comments on commit f233010

Please sign in to comment.
You can’t perform that action at this time.