龙将斩千 v5.5.5.39856版本的 MD5 值为:5c05b1d6f8d872ca3fe0343d6ff07caf
以下内容为反编译后的 h.java 源代码,内容仅作参考
package com.qiyukf.nimlib.session;
import android.os.SystemClock;
import android.util.Pair;
import ch.qos.logback.core.spi.AbstractComponentTracker;
import com.qiyukf.nimlib.net.a.d.a;
import com.qiyukf.nimlib.sdk.msg.constant.SessionTypeEnum;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class h {
private static final ArrayList<Pair<c, Long>> a = new ArrayList<>(8);
private static final Object b = new Object();
private static ScheduledExecutorService c = null;
public static void a() {
if (!com.qiyukf.nimlib.c.v() || c != null) {
return;
}
com.qiyukf.nimlib.j.b.c("MessageReporter", "start msg report timer");
ScheduledExecutorService newScheduledThreadPool = Executors.newScheduledThreadPool(1);
c = newScheduledThreadPool;
newScheduledThreadPool.scheduleWithFixedDelay(new Runnable() {
@Override
public final void run() {
h.d();
}
}, 0L, AbstractComponentTracker.LINGERING_TIMEOUT, TimeUnit.MILLISECONDS);
}
public static void d() {
synchronized (b) {
if (!com.qiyukf.nimlib.q.d.a((Collection) a)) {
c();
}
}
}
public static void a(c cVar) {
if (!com.qiyukf.nimlib.c.v() || cVar.getSessionType() != SessionTypeEnum.P2P) {
return;
}
long elapsedRealtime = SystemClock.elapsedRealtime();
synchronized (b) {
a.add(new Pair<>(cVar, Long.valueOf(elapsedRealtime)));
if (a.size() >= 5) {
c();
}
}
}
private static void c() {
String str;
if (com.qiyukf.nimlib.q.d.a((Collection) a)) {
return;
}
long b2 = com.qiyukf.nimlib.q.t.b();
if (b2 <= 0) {
com.qiyukf.nimlib.q.t.c();
return;
}
JSONArray jSONArray = new JSONArray();
Iterator<Pair<c, Long>> it = a.iterator();
while (it.hasNext()) {
Pair<c, Long> next = it.next();
c cVar = (c) next.first;
long longValue = ((Long) next.second).longValue() + b2;
if (cVar != null && longValue > 0) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.putOpt("accid", com.qiyukf.nimlib.c.k());
jSONObject.putOpt("fromAccid", cVar.getFromAccount());
jSONObject.putOpt("msgId", Long.valueOf(cVar.getServerId()));
jSONObject.putOpt("serverTime", Long.valueOf(cVar.getTime()));
jSONObject.putOpt("receiveTime", Long.valueOf(longValue));
jSONObject.putOpt("sessionId", cVar.getSessionId());
} catch (JSONException e) {
e.printStackTrace();
}
if (!com.qiyukf.nimlib.e.e.a() && !com.qiyukf.nimlib.e.e.b()) {
str = "online";
jSONObject.putOpt("env", str);
jSONArray.put(jSONObject);
}
str = "test";
jSONObject.putOpt("env", str);
jSONArray.put(jSONObject);
}
}
com.qiyukf.nimlib.j.b.c("MessageReporter", "report msg, len=" + jSONArray.length());
a.C0041a<String> a2 = com.qiyukf.nimlib.net.a.d.a.a("https://statistic.live.126.net/statics/report/im/sdk/msgreceived", null, jSONArray);
if (a2.a == 200) {
a.clear();
}
com.qiyukf.nimlib.j.b.c("MessageReporter", "report msg result, code=" + a2.a);
}
public static void b() {
if (c == null) {
return;
}
c.shutdown();
c = null;
}
}