Initial commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package com.ubt.jimu.controller.syn;
|
||||
|
||||
import com.ubt.jimu.base.entities.RobotLite;
|
||||
import com.ubt.jimu.transport3.api.DiyTransportServiceProxy;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OfficialSyncExecutor implements Runnable {
|
||||
private RobotLite a;
|
||||
private DiyTransportServiceProxy b = new DiyTransportServiceProxy();
|
||||
private SyncCompletedListener c;
|
||||
|
||||
public interface SyncCompletedListener {
|
||||
void a();
|
||||
}
|
||||
|
||||
public OfficialSyncExecutor(RobotLite robotLite) {
|
||||
this.a = robotLite;
|
||||
}
|
||||
|
||||
public void a(SyncCompletedListener syncCompletedListener) {
|
||||
this.c = syncCompletedListener;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.add(new OfficialActionFileSyncTask(this.a, this.b));
|
||||
arrayList.add(new OfficialModelFileSynTask(this.a, this.b));
|
||||
try {
|
||||
try {
|
||||
Executors.newSingleThreadExecutor().invokeAll(arrayList, 20000L, TimeUnit.MILLISECONDS);
|
||||
if (this.c == null) {
|
||||
return;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
if (this.c == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
LogUtils.c("数据同步完成");
|
||||
this.c.a();
|
||||
} catch (Throwable th) {
|
||||
if (this.c != null) {
|
||||
LogUtils.c("数据同步完成");
|
||||
this.c.a();
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user