Commit Graph

18 Commits

Author SHA1 Message Date
Peter Johnson
8b3f4aa68c Remove unused member variable. 2015-12-21 09:03:30 -08:00
Peter Johnson
65e4eeeb7c Fix Windows linkage.
Windows needs ATOMIC_STATIC_INIT.
2015-12-20 21:06:17 -08:00
Peter Johnson
298dc54910 Fix Windows build. 2015-12-20 20:55:36 -08:00
Peter Johnson
32001427d4 Java: call JNI AttachCurrentThread less frequently.
Each call to AttachCurrentThread results in a new Java thread object being
created.  This is inefficient and also causes debugging issues with Eclipse
due to constant creation and removal of threads.  Now AttachCurrentThread is
only called once for (all) listeners and once for logging (if used).
2015-12-20 20:42:09 -08:00
Peter Johnson
3cd20d3ff2 Java: Fix getValue(). 2015-12-06 08:22:34 -08:00
Peter Johnson
c76e60324b Add Java support for raw values.
Either ByteBuffer or byte[] can be used for putRaw().
getRaw() returns byte[].
2015-11-20 01:22:26 -08:00
Peter Johnson
9200b7c78c Add extern "C" to JNI definitions to catch mismatches. 2015-11-01 07:44:43 -08:00
Peter Johnson
90959defd9 Provide more extensive listener features.
This enables listeners to be notified of not only value updates, but also flag
changes and deletions by using a bitmask to specify what notifications are
desired.  The old API (which only provided a new/not new) flag is still
supported.  This also subsumes the feature to listen to local changes (that's
one of the bitmask options).
2015-09-27 01:55:32 -07:00
Peter Johnson
424bf51a7b Implement local notification.
The default behavior is to only notify remote changes, but for some
applications (e.g. GUI's) it's advantageous to know about local
changes as well.

This is (slightly) optimized in that local changes only result in
additional resources being consumed if (any) local listeners have been
created.
2015-09-23 00:56:08 -07:00
Peter Johnson
c5d456f3a6 Add ITable/NetworkTable GetKeys and GetSubTables accessors. 2015-09-16 00:51:05 -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
702b6de734 Java: Fix crash on JVM exit.
Fixes #22.
2015-09-05 11:05:02 -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