WXBridgeManager implements Callback,BactchExecutor { public void destroyInstance(final String instanceId) { if ( mJSHandler == null || TextUtils.isEmpty(instanceId)) { return; } if(mDestroyedInstanceId!=null) { mDestroyedInstanceId.add(instanceId); } mJSHandler.removeCallbacksAndMessages(instanceId); post(new Runnable() { @Override public void run() { removeTaskByInstance(instanceId); invokeDestroyInstance(instanceId); } }, instanceId); } private  WXBridgeManager(); static WXBridgeManager getInstance(); boolean callModuleMethod(String instanceId, String moduleStr, String methodStr, JSONArray args); void restart(); synchronized void setStackTopInstance(final String instanceId); @Override void post(Runnable r); @Override void setInterceptor(Interceptor interceptor); void post(Runnable r, Object token); void sendMessageDelayed(Message message, long delayMillis); void removeMessage(int what,Object obj); int callNative(String instanceId, String tasks, String callback); int callAddElement(String instanceId, String ref,String dom,String index, String callback); synchronized void initScriptsFramework(String framework); @Deprecated void fireEvent(final String instanceId, final String ref,
                        final String type, final Map<String, Object> data); @Deprecated void fireEvent(final String instanceId, final String ref,
                        final String type, final Map<String, Object> data,final Map<String, Object> domChanges); void fireEventOnNode(final String instanceId, final String ref,
                        final String type, final Map<String, Object> data,final Map<String, Object> domChanges); @Deprecated void callback(String instanceId, String callback,String data); @Deprecated void callback(final String instanceId, final String callback,
                       final Map<String, Object> data); @Deprecated void callback(final String instanceId, final String callback,
                       final Object data,boolean keepAlive); void refreshInstance(final String instanceId, final WXRefreshData jsonData); void commitJSBridgeAlarmMonitor(String instanceId, WXErrorCode errCode); void commitAlert(final String type, final WXErrorCode errorCode); void createInstance(final String instanceId, final String template,
                             final Map<String, Object> options, final String data); void destroyInstance(final String instanceId); @Override boolean handleMessage(Message msg); void registerModules(final Map<String, Object> modules); void registerComponents(final List<Map<String, String>> components); void destroy(); void reportJSException(String instanceId, String function,
                                String exception); static final String METHOD_CREATE_INSTANCE; static final String METHOD_DESTROY_INSTANCE; static final String METHOD_CALL_JS; static final String METHOD_SET_TIMEOUT; static final String METHOD_REGISTER_MODULES; static final String METHOD_REGISTER_COMPONENTS; static final String METHOD_FIRE_EVENT; static final String METHOD_CALLBACK; static final String METHOD_REFRESH_INSTANCE; static final String KEY_METHOD; static final String KEY_ARGS; static final String MODULE; static final String METHOD; static final String ARGS; }
@Test public void testDestroyInstance() throws Exception { getInstance().destroyInstance(instance.getInstanceId()); }