feat:remove Context instance before js destory
This commit is contained in:
parent
b1cd69437a
commit
1a6b730146
@ -162,19 +162,6 @@ public class DoricContext {
|
|||||||
|
|
||||||
public void teardown() {
|
public void teardown() {
|
||||||
callEntity(DoricConstant.DORIC_ENTITY_DESTROY);
|
callEntity(DoricConstant.DORIC_ENTITY_DESTROY);
|
||||||
DoricContextManager.getInstance().destroyContext(this).setCallback(new AsyncResult.Callback<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public void onResult(Boolean result) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable t) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFinish() {
|
|
||||||
getDriver().asyncCall(new Callable<Object>() {
|
getDriver().asyncCall(new Callable<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public Object call() {
|
public Object call() {
|
||||||
@ -185,8 +172,7 @@ public class DoricContext {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, ThreadMode.UI);
|
}, ThreadMode.UI);
|
||||||
}
|
DoricContextManager.getInstance().destroyContext(this);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DoricJavaPlugin obtainPlugin(DoricMetaInfo<DoricJavaPlugin> doricMetaInfo) {
|
public DoricJavaPlugin obtainPlugin(DoricMetaInfo<DoricJavaPlugin> doricMetaInfo) {
|
||||||
|
@ -57,6 +57,7 @@ public class DoricContextManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AsyncResult<Boolean> destroyContext(final DoricContext context) {
|
AsyncResult<Boolean> destroyContext(final DoricContext context) {
|
||||||
|
doricContextMap.remove(context.getContextId());
|
||||||
final AsyncResult<Boolean> result = new AsyncResult<>();
|
final AsyncResult<Boolean> result = new AsyncResult<>();
|
||||||
context.getDriver().destroyContext(context.getContextId()).setCallback(new AsyncResult.Callback<Boolean>() {
|
context.getDriver().destroyContext(context.getContextId()).setCallback(new AsyncResult.Callback<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
@ -71,7 +72,6 @@ public class DoricContextManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
doricContextMap.remove(context.getContextId());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
@ -70,11 +70,10 @@ - (DoricContext *)getContext:(NSString *)contextId {
|
|||||||
|
|
||||||
- (void)destroyContext:(DoricContext *)context {
|
- (void)destroyContext:(DoricContext *)context {
|
||||||
NSString *contextId = context.contextId;
|
NSString *contextId = context.contextId;
|
||||||
[context.driver destroyContext:contextId].finishCallback = ^{
|
|
||||||
dispatch_sync(self.mapQueue, ^() {
|
dispatch_sync(self.mapQueue, ^() {
|
||||||
[self.doricContextMap removeObjectForKey:contextId];
|
[self.doricContextMap removeObjectForKey:contextId];
|
||||||
});
|
});
|
||||||
};
|
[context.driver destroyContext:contextId];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)aliveContexts {
|
- (NSArray *)aliveContexts {
|
||||||
|
Reference in New Issue
Block a user