增加超时方法

This commit is contained in:
lbl8603
2024-05-08 23:58:38 +08:00
parent be767ae300
commit b57a38e81e
5 changed files with 43 additions and 4 deletions
+7 -1
View File
@@ -11,7 +11,7 @@ import java.io.IOException;
public class Vnt implements Closeable {
private final long raw;
public Vnt(Config config, CallBack callBack) throws Exception{
public Vnt(Config config, CallBack callBack) throws Exception {
this.raw = new0(config, callBack);
if (this.raw == 0) {
throw new RuntimeException();
@@ -26,6 +26,10 @@ public class Vnt implements Closeable {
wait0(raw);
}
public boolean awaitTimeout(long ms) {
return waitTimeout0(raw, ms);
}
public PeerRouteInfo[] list() {
return list0(raw);
}
@@ -36,6 +40,8 @@ public class Vnt implements Closeable {
private native void wait0(long raw);
private native boolean waitTimeout0(long raw, long ms);
private native void drop0(long raw);
private native PeerRouteInfo[] list0(long raw);