Commit Graph

16 Commits

Author SHA1 Message Date
Peter Johnson
6cbc219427 Add ITable/NetworkTable accessors for new features. 2015-09-15 23:43:42 -07:00
Peter Johnson
4b06e74a14 Java: Return boolean from put functions.
The put functions return false if the key already exists with a different type.
2015-09-15 22:23:34 -07:00
Peter Johnson
42f973ebe0 Java: Don't raise illegal state exceptions unless really necessary.
- Ignore no-op calls to setServerMode() / setClientMode().
- Duplicate calls to initialize() act as a restart.
- shutdown() silently does nothing if not running.
2015-09-15 22:03:11 -07:00
Peter Johnson
84e7d5906c Java: Use Global instead of WeakGlobal for callbacks.
For some reason, weak globals don't work as they (unexpectedly) are
getting destroyed even though we save the callback in a map at the Java
level.
2015-09-15 21:32:51 -07:00
Peter Johnson
51eb96903c Java: Improve robustness against JVM crashes on exit.
The JVM doesn't always do a good job of telling JNI modules that the JVM
is going away, which results in a crash in the JavaGlobal and/or
JavaWeakGlobal destructors as they try to delete the associated references
after the JVM has already gone away.

To protect against this, the Notifier now has a static variable that's set
when the Notifier instance (a singleton) is destroyed.  This is used by
JavaGlobal and JavaWeakGlobal to detect when a process exit is in process.
2015-09-14 22:00:22 -07:00
Peter Johnson
5181c4e5be Java: Don't free locals after detaching thread.
We use a smart pointer to hold local java variables, and it was getting
destructed after DetachCurrentThread() was called, causing a JVM crash.
2015-09-11 16:28:58 -07:00
Peter Johnson
a2ec638db8 Java: Use empty string as default IP rather than null.
Using null can crash the JVM if initialize() is called before setIPAddress.
2015-09-11 12:06:22 -07:00
Peter Johnson
702b6de734 Java: Fix crash on JVM exit.
Fixes #22.
2015-09-05 11:05:02 -07:00
Peter Johnson
6233b3477b Java: Fix fallback on external library. 2015-09-05 10:57:37 -07:00
Peter Johnson
e516200e09 Java: Add shutdown method to NetworkTable. 2015-08-28 23:57:37 -07:00
Peter Johnson
1ca0157768 Java: Add backwards compat shims for array types. 2015-08-28 21:09:46 -07:00
Peter Johnson
dbe4168d8d Java: allow both object arrays and native arrays.
This allows easier use of things like ArrayList<Double>.
2015-08-28 20:48:29 -07:00
Peter Johnson
969916851c Need to return nullptr, not false. 2015-08-28 17:17:20 -07:00
Peter Johnson
2b9e7c6af1 Silence MSVC warnings regarding bool conversions. 2015-08-28 14:07:51 -07:00
Peter Johnson
b971c741d7 Fix JNI for Windows and implement JNI getValue functions. 2015-08-28 13:52:16 -07:00
Peter Johnson
a990859db6 Initial commit of Java wrappers.
The JNI bindings are built directly into the shared library.  In the gradle
build, all built shared libraries are embedded into the generated jar.

Java bindings may be disabled via -DWITHOUT_JAVA (cmake) or -PskipJava=true
(gradle).

TODO:
- getEntryInfo() and RPC are not yet implemented.
- The cmake build doesn't integrate the built objects into the jar.
- The Java client and server tests are not built (but have been manually
  tested).

This has not yet been tested on Windows.
2015-08-28 12:43:49 -07:00