Files
flipper/android/android/SonarClientImpl.java
John Knox cebc409da6 Change SonarInitConfig to take two EventBases
Summary:
We currently give sonar one event base from java / obj-c code to use for scheduling tasks.
This causes a problem, because we schedule reconnect tasks on the event base, and then these tasks interact with rsocket which schedules it's own tasks.
The problem is that we're passing rsocket the same event base. So the reconnect code executes and blocks waiting for rsocket to connect.
But rsocket can never connect because it never executes because that thread is blocked, so we get deadlock.

This is the first step which just changes the interface to pass two event bases.
The consumers will be changed to pass in different threads next.

Reviewed By: danielbuechele

Differential Revision: D8748350

fbshipit-source-id: 481d6f23644f28fd0f1c786252605287019c999c
2018-07-09 07:49:07 -07:00

59 lines
1.3 KiB
Java

/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
package com.facebook.sonar.android;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.soloader.SoLoader;
import com.facebook.sonar.BuildConfig;
import com.facebook.sonar.core.SonarClient;
import com.facebook.sonar.core.SonarPlugin;
@DoNotStrip
class SonarClientImpl implements SonarClient {
static {
if (BuildConfig.IS_INTERNAL_BUILD) {
SoLoader.loadLibrary("sonar");
}
}
private final HybridData mHybridData;
private SonarClientImpl(HybridData hd) {
mHybridData = hd;
}
public static native void init(
EventBase callbackWorker,
EventBase connectionWorker,
String host,
String os,
String device,
String deviceId,
String app,
String appId,
String privateAppDirectory);
public static native SonarClientImpl getInstance();
@Override
public native void addPlugin(SonarPlugin plugin);
@Override
public native <T extends SonarPlugin> T getPlugin(String id);
@Override
public native void removePlugin(SonarPlugin plugin);
@Override
public native void start();
@Override
public native void stop();
}