Browse Source

Move JNI methods to the bottom of the class

Signed-off-by: Grant Limberg <[email protected]>
Grant Limberg 10 years ago
parent
commit
0c8051da15
1 changed files with 31 additions and 28 deletions
  1. 31 28
      java/src/com/zerotierone/sdk/Node.java

+ 31 - 28
java/src/com/zerotierone/sdk/Node.java

@@ -51,10 +51,6 @@ public class Node {
     private final VirtualNetworkFrameListener frameListener;
     private final VirtualNetworkFrameListener frameListener;
     private final VirtualNetworkConfigListener configListener;
     private final VirtualNetworkConfigListener configListener;
     
     
-
-    private native ResultCode node_init(long now);
-    private native void node_delete(long nodeId);
-
 	public Node(long now,
 	public Node(long now,
                 DataStoreGetListener getListener,
                 DataStoreGetListener getListener,
                 DataStorePutListener putListener,
                 DataStorePutListener putListener,
@@ -116,34 +112,19 @@ public class Node {
             frameData, frameLength, nextBackgroundTaskDeadline);
             frameData, frameLength, nextBackgroundTaskDeadline);
     }
     }
 
 
-	private native ResultCode processBackgroundTasks(
-        long nodeId,
-		long now,
-		Long nextBackgroundTaskDeadline);
-
     public ResultCode processBackgroundTasks(long now, long nextBackgroundTaskDeadline) {
     public ResultCode processBackgroundTasks(long now, long nextBackgroundTaskDeadline) {
         return processBackgroundTasks(nodeId, now, nextBackgroundTaskDeadline);
         return processBackgroundTasks(nodeId, now, nextBackgroundTaskDeadline);
     }
     }
 
 
-	private native ResultCode join(long nodeId, long nwid);
-
     public ResultCode join(long nwid) {
     public ResultCode join(long nwid) {
         return join(nodeId, nwid);
         return join(nodeId, nwid);
     }
     }
 
 
-	private native ResultCode leave(long nodeId, long nwid);
-
     public ResultCode leave(long nwid) {
     public ResultCode leave(long nwid) {
         return leave(nodeId, nwid);
         return leave(nodeId, nwid);
     }
     }
 
 
-	private native ResultCode multicastSubscribe(
-        long nodeId,
-		long nwid,
-		long multicastGroup,
-		long multicastAdi);
-
-	public ResultCode multicastSubscribe(
+    public ResultCode multicastSubscribe(
 		long nwid,
 		long nwid,
 		long multicastGroup) {
 		long multicastGroup) {
 		return multicastSubscribe(nodeId, nwid, multicastGroup, 0);
 		return multicastSubscribe(nodeId, nwid, multicastGroup, 0);
@@ -156,12 +137,6 @@ public class Node {
         return multicastSubscribe(nodeId, nwid, multicastGroup, multicastAdi);
         return multicastSubscribe(nodeId, nwid, multicastGroup, multicastAdi);
     }
     }
 
 
-	private native ResultCode multicastUnsubscribe(
-        long nodeId,
-		long nwid,
-		long multicastGroup,
-		long multicastAdi);
-
 	public ResultCode multicastUnsubscribe(
 	public ResultCode multicastUnsubscribe(
 		long nwid,
 		long nwid,
 		long multicastGroup) {
 		long multicastGroup) {
@@ -175,9 +150,37 @@ public class Node {
         return multicastUnsubscribe(nodeId, nwid, multicastGroup, multicastAdi);
         return multicastUnsubscribe(nodeId, nwid, multicastGroup, multicastAdi);
     }
     }
 
 
-	private native long address(long nodeId);
-
     public long address() {
     public long address() {
         return address(nodeId);
         return address(nodeId);
     }
     }
+
+    /**
+     * function declarations for JNI
+     */
+    private native ResultCode node_init(long now);
+
+    private native void node_delete(long nodeId);
+
+    private native ResultCode processBackgroundTasks(
+        long nodeId,
+        long now,
+        Long nextBackgroundTaskDeadline);
+
+    private native ResultCode join(long nodeId, long nwid);
+
+    private native ResultCode leave(long nodeId, long nwid);
+
+    private native ResultCode multicastSubscribe(
+        long nodeId,
+        long nwid,
+        long multicastGroup,
+        long multicastAdi);
+
+    private native ResultCode multicastUnsubscribe(
+        long nodeId,
+        long nwid,
+        long multicastGroup,
+        long multicastAdi);
+
+    private native long address(long nodeId);
 }
 }