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).
This commit is contained in:
Peter Johnson
2015-12-20 20:42:09 -08:00
parent b4c0583896
commit 32001427d4
7 changed files with 248 additions and 71 deletions

View File

@@ -65,6 +65,14 @@ void Flush() {
* Callback Creation Functions
*/
void SetListenerOnStart(std::function<void()> on_start) {
Notifier::GetInstance().SetOnStart(on_start);
}
void SetListenerOnExit(std::function<void()> on_exit) {
Notifier::GetInstance().SetOnExit(on_exit);
}
unsigned int AddEntryListener(StringRef prefix, EntryListenerCallback callback,
unsigned int flags) {
Notifier& notifier = Notifier::GetInstance();