Java 类com.facebook.react.common.futures.SimpleSettableFuture 实例源码

项目:rnrecord    文件:AwaitablePromise.java   
public AwaitablePromise() {
    this.resolveFuture = new SimpleSettableFuture<>();
    this.rejectFuture = new SimpleSettableFuture();

    promise = new PromiseImpl(new Callback() {
        @Override
        public void invoke(Object... args) {
            resolveFuture.set((T)args[0]);
        }
    }, new Callback() {
        @Override
        public void invoke(Object... args) {
            rejectFuture.set(args[0]);
        }
    });
}
项目:RNLearn_Project1    文件:MessageQueueThreadImpl.java   
@DoNotStrip
@Override
public <T> Future<T> callOnQueue(final Callable<T> callable) {
  final SimpleSettableFuture<T> future = new SimpleSettableFuture<>();
  runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          try {
            future.set(callable.call());
          } catch (Exception e) {
            future.setException(e);
          }
        }
      });
  return future;
}
项目:RNLearn_Project1    文件:DevSupportManagerImpl.java   
private WebsocketJavaScriptExecutor.JSExecutorConnectCallback getExecutorConnectCallback(
    final SimpleSettableFuture<Boolean> future) {
  return new WebsocketJavaScriptExecutor.JSExecutorConnectCallback() {
    @Override
    public void onSuccess() {
      future.set(true);
      mDevLoadingViewController.hide();
      mDevLoadingViewVisible = false;
    }

    @Override
    public void onFailure(final Throwable cause) {
      mDevLoadingViewController.hide();
      mDevLoadingViewVisible = false;
      FLog.e(ReactConstants.TAG, "Unable to connect to remote debugger", cause);
      future.setException(
          new IOException(
              mApplicationContext.getString(R.string.catalyst_remotedbg_error), cause));
    }
  };
}
项目:RNLearn_Project1    文件:ReactIntegrationTestCase.java   
public void shutDownContext() {
  if (mInstance != null) {
    final ReactContext contextToDestroy = mReactContext;
    mReactContext = null;
    mInstance = null;

    final SimpleSettableFuture<Void> semaphore = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        if (contextToDestroy != null) {
          contextToDestroy.destroy();
        }
        semaphore.set(null);
      }
    });
    semaphore.getOrThrow();
  }
}
项目:RNLearn_Project1    文件:ReactIntegrationTestCase.java   
/**
 * Timing module needs to be created on the main thread so that it gets the correct Choreographer.
 */
protected Timing createTimingModule() {
  final SimpleSettableFuture<Timing> simpleSettableFuture = new SimpleSettableFuture<Timing>();
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          Timing timing = new Timing(getContext(), mock(DevSupportManager.class));
          simpleSettableFuture.set(timing);
        }
      });
  try {
    return simpleSettableFuture.get(5000, TimeUnit.MILLISECONDS);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
项目:RNLearn_Project1    文件:MessageQueueThreadImpl.java   
@DoNotStrip
@Override
public <T> Future<T> callOnQueue(final Callable<T> callable) {
  final SimpleSettableFuture<T> future = new SimpleSettableFuture<>();
  runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          try {
            future.set(callable.call());
          } catch (Exception e) {
            future.setException(e);
          }
        }
      });
  return future;
}
项目:RNLearn_Project1    文件:DevSupportManagerImpl.java   
private WebsocketJavaScriptExecutor.JSExecutorConnectCallback getExecutorConnectCallback(
    final SimpleSettableFuture<Boolean> future) {
  return new WebsocketJavaScriptExecutor.JSExecutorConnectCallback() {
    @Override
    public void onSuccess() {
      future.set(true);
      mDevLoadingViewController.hide();
      mDevLoadingViewVisible = false;
    }

    @Override
    public void onFailure(final Throwable cause) {
      mDevLoadingViewController.hide();
      mDevLoadingViewVisible = false;
      FLog.e(ReactConstants.TAG, "Unable to connect to remote debugger", cause);
      future.setException(
          new IOException(
              mApplicationContext.getString(R.string.catalyst_remotedbg_error), cause));
    }
  };
}
项目:RNLearn_Project1    文件:ReactIntegrationTestCase.java   
public void shutDownContext() {
  if (mInstance != null) {
    final ReactContext contextToDestroy = mReactContext;
    mReactContext = null;
    mInstance = null;

    final SimpleSettableFuture<Void> semaphore = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        if (contextToDestroy != null) {
          contextToDestroy.destroy();
        }
        semaphore.set(null);
      }
    });
    semaphore.getOrThrow();
  }
}
项目:RNLearn_Project1    文件:ReactIntegrationTestCase.java   
/**
 * Timing module needs to be created on the main thread so that it gets the correct Choreographer.
 */
protected Timing createTimingModule() {
  final SimpleSettableFuture<Timing> simpleSettableFuture = new SimpleSettableFuture<Timing>();
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          Timing timing = new Timing(getContext(), mock(DevSupportManager.class));
          simpleSettableFuture.set(timing);
        }
      });
  try {
    return simpleSettableFuture.get(5000, TimeUnit.MILLISECONDS);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
项目:ReactNativeSignatureExample    文件:MessageQueueThreadImpl.java   
@DoNotStrip
@Override
public <T> Future<T> callOnQueue(final Callable<T> callable) {
  final SimpleSettableFuture<T> future = new SimpleSettableFuture<>();
  runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          try {
            future.set(callable.call());
          } catch (Exception e) {
            future.setException(e);
          }
        }
      });
  return future;
}
项目:ReactNativeSignatureExample    文件:MessageQueueThreadImpl.java   
/**
 * @return a MessageQueueThreadImpl corresponding to Android's main UI thread.
 */
private static MessageQueueThreadImpl createForMainThread(
    String name,
    QueueThreadExceptionHandler exceptionHandler) {
  Looper mainLooper = Looper.getMainLooper();
  final MessageQueueThreadImpl mqt =
      new MessageQueueThreadImpl(name, mainLooper, exceptionHandler);

  // Ensure that the MQT is registered by the time this method returns
  if (UiThreadUtil.isOnUiThread()) {
    MessageQueueThreadRegistry.register(mqt);
  } else {
    final SimpleSettableFuture<Void> registrationFuture = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            MessageQueueThreadRegistry.register(mqt);
            registrationFuture.set(null);
          }
        });
    registrationFuture.getOrThrow();
  }
  return mqt;
}
项目:ReactNativeSignatureExample    文件:DevSupportManagerImpl.java   
private WebsocketJavaScriptExecutor.JSExecutorConnectCallback getExecutorConnectCallback(
    final ProgressDialog progressDialog,
    final SimpleSettableFuture<Boolean> future) {
  return new WebsocketJavaScriptExecutor.JSExecutorConnectCallback() {
    @Override
    public void onSuccess() {
      future.set(true);
      progressDialog.dismiss();
    }

    @Override
    public void onFailure(final Throwable cause) {
      progressDialog.dismiss();
      FLog.e(ReactConstants.TAG, "Unable to connect to remote debugger", cause);
      future.setException(
          new IOException(
              mApplicationContext.getString(R.string.catalyst_remotedbg_error), cause));
    }
  };
}
项目:ReactNativeSignatureExample    文件:ReactIntegrationTestCase.java   
public void shutDownContext() {
  if (mInstance != null) {
    final ReactContext contextToDestroy = mReactContext;
    mReactContext = null;
    mInstance = null;

    final SimpleSettableFuture<Void> semaphore = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        if (contextToDestroy != null) {
          contextToDestroy.destroy();
        }
        semaphore.set(null);
      }
    });
    semaphore.getOrThrow();
  }
}
项目:ReactNativeSignatureExample    文件:ReactIntegrationTestCase.java   
/**
 * Timing module needs to be created on the main thread so that it gets the correct Choreographer.
 */
protected Timing createTimingModule() {
  final SimpleSettableFuture<Timing> simpleSettableFuture = new SimpleSettableFuture<Timing>();
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          Timing timing = new Timing(getContext());
          simpleSettableFuture.set(timing);
        }
      });
  try {
    return simpleSettableFuture.get(5000, TimeUnit.MILLISECONDS);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
项目:react-native-ibeacon-android    文件:MessageQueueThreadImpl.java   
@DoNotStrip
@Override
public <T> Future<T> callOnQueue(final Callable<T> callable) {
  final SimpleSettableFuture<T> future = new SimpleSettableFuture<>();
  runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          try {
            future.set(callable.call());
          } catch (Exception e) {
            future.setException(e);
          }
        }
      });
  return future;
}
项目:react-native-ibeacon-android    文件:MessageQueueThreadImpl.java   
/**
 * @return a MessageQueueThreadImpl corresponding to Android's main UI thread.
 */
private static MessageQueueThreadImpl createForMainThread(
    String name,
    QueueThreadExceptionHandler exceptionHandler) {
  Looper mainLooper = Looper.getMainLooper();
  final MessageQueueThreadImpl mqt =
      new MessageQueueThreadImpl(name, mainLooper, exceptionHandler);

  // Ensure that the MQT is registered by the time this method returns
  if (UiThreadUtil.isOnUiThread()) {
    MessageQueueThreadRegistry.register(mqt);
  } else {
    final SimpleSettableFuture<Void> registrationFuture = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            MessageQueueThreadRegistry.register(mqt);
            registrationFuture.set(null);
          }
        });
    registrationFuture.getOrThrow();
  }
  return mqt;
}
项目:react-native-ibeacon-android    文件:DevSupportManagerImpl.java   
private WebsocketJavaScriptExecutor.JSExecutorConnectCallback getExecutorConnectCallback(
    final ProgressDialog progressDialog,
    final SimpleSettableFuture<Boolean> future) {
  return new WebsocketJavaScriptExecutor.JSExecutorConnectCallback() {
    @Override
    public void onSuccess() {
      future.set(true);
      progressDialog.dismiss();
    }

    @Override
    public void onFailure(final Throwable cause) {
      progressDialog.dismiss();
      FLog.e(ReactConstants.TAG, "Unable to connect to remote debugger", cause);
      future.setException(
          new IOException(
              mApplicationContext.getString(R.string.catalyst_remotedbg_error), cause));
    }
  };
}
项目:react-native-ibeacon-android    文件:ReactIntegrationTestCase.java   
public void shutDownContext() {
  if (mInstance != null) {
    final ReactContext contextToDestroy = mReactContext;
    mReactContext = null;
    mInstance = null;

    final SimpleSettableFuture<Void> semaphore = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        if (contextToDestroy != null) {
          contextToDestroy.destroy();
        }
        semaphore.set(null);
      }
    });
    semaphore.getOrThrow();
  }
}
项目:react-native-ibeacon-android    文件:ReactIntegrationTestCase.java   
/**
 * Timing module needs to be created on the main thread so that it gets the correct Choreographer.
 */
protected Timing createTimingModule() {
  final SimpleSettableFuture<Timing> simpleSettableFuture = new SimpleSettableFuture<Timing>();
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          Timing timing = new Timing(getContext());
          simpleSettableFuture.set(timing);
        }
      });
  try {
    return simpleSettableFuture.get(5000, TimeUnit.MILLISECONDS);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
项目:react-native-box-loaders    文件:MessageQueueThreadImpl.java   
@DoNotStrip
@Override
public <T> Future<T> callOnQueue(final Callable<T> callable) {
  final SimpleSettableFuture<T> future = new SimpleSettableFuture<>();
  runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          try {
            future.set(callable.call());
          } catch (Exception e) {
            future.setException(e);
          }
        }
      });
  return future;
}
项目:react-native-box-loaders    文件:MessageQueueThreadImpl.java   
/**
 * @return a MessageQueueThreadImpl corresponding to Android's main UI thread.
 */
private static MessageQueueThreadImpl createForMainThread(
    String name,
    QueueThreadExceptionHandler exceptionHandler) {
  Looper mainLooper = Looper.getMainLooper();
  final MessageQueueThreadImpl mqt =
      new MessageQueueThreadImpl(name, mainLooper, exceptionHandler);

  // Ensure that the MQT is registered by the time this method returns
  if (UiThreadUtil.isOnUiThread()) {
    MessageQueueThreadRegistry.register(mqt);
  } else {
    final SimpleSettableFuture<Void> registrationFuture = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            MessageQueueThreadRegistry.register(mqt);
            registrationFuture.set(null);
          }
        });
    registrationFuture.getOrThrow();
  }
  return mqt;
}
项目:react-native-box-loaders    文件:DevSupportManagerImpl.java   
private WebsocketJavaScriptExecutor.JSExecutorConnectCallback getExecutorConnectCallback(
    final ProgressDialog progressDialog,
    final SimpleSettableFuture<Boolean> future) {
  return new WebsocketJavaScriptExecutor.JSExecutorConnectCallback() {
    @Override
    public void onSuccess() {
      future.set(true);
      progressDialog.dismiss();
    }

    @Override
    public void onFailure(final Throwable cause) {
      progressDialog.dismiss();
      FLog.e(ReactConstants.TAG, "Unable to connect to remote debugger", cause);
      future.setException(
          new IOException(
              mApplicationContext.getString(R.string.catalyst_remotedbg_error), cause));
    }
  };
}
项目:react-native-box-loaders    文件:ReactIntegrationTestCase.java   
public void shutDownContext() {
  if (mInstance != null) {
    final ReactContext contextToDestroy = mReactContext;
    mReactContext = null;
    mInstance = null;

    final SimpleSettableFuture<Void> semaphore = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        if (contextToDestroy != null) {
          contextToDestroy.destroy();
        }
        semaphore.set(null);
      }
    });
    semaphore.getOrThrow();
  }
}
项目:react-native-box-loaders    文件:ReactIntegrationTestCase.java   
/**
 * Timing module needs to be created on the main thread so that it gets the correct Choreographer.
 */
protected Timing createTimingModule() {
  final SimpleSettableFuture<Timing> simpleSettableFuture = new SimpleSettableFuture<Timing>();
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          Timing timing = new Timing(getContext());
          simpleSettableFuture.set(timing);
        }
      });
  try {
    return simpleSettableFuture.get(5000, TimeUnit.MILLISECONDS);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
项目:Ironman    文件:MessageQueueThreadImpl.java   
@DoNotStrip
@Override
public <T> Future<T> callOnQueue(final Callable<T> callable) {
  final SimpleSettableFuture<T> future = new SimpleSettableFuture<>();
  runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          try {
            future.set(callable.call());
          } catch (Exception e) {
            future.setException(e);
          }
        }
      });
  return future;
}
项目:Ironman    文件:DevSupportManagerImpl.java   
private WebsocketJavaScriptExecutor.JSExecutorConnectCallback getExecutorConnectCallback(
    final AlertDialog progressDialog,
    final SimpleSettableFuture<Boolean> future) {
  return new WebsocketJavaScriptExecutor.JSExecutorConnectCallback() {
    @Override
    public void onSuccess() {
      future.set(true);
      progressDialog.dismiss();
    }

    @Override
    public void onFailure(final Throwable cause) {
      progressDialog.dismiss();
      FLog.e(ReactConstants.TAG, "Unable to connect to remote debugger", cause);
      future.setException(
          new IOException(
              mApplicationContext.getString(R.string.catalyst_remotedbg_error), cause));
    }
  };
}
项目:Ironman    文件:ReactIntegrationTestCase.java   
public void shutDownContext() {
  if (mInstance != null) {
    final ReactContext contextToDestroy = mReactContext;
    mReactContext = null;
    mInstance = null;

    final SimpleSettableFuture<Void> semaphore = new SimpleSettableFuture<>();
    UiThreadUtil.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        if (contextToDestroy != null) {
          contextToDestroy.destroy();
        }
        semaphore.set(null);
      }
    });
    semaphore.getOrThrow();
  }
}
项目:Ironman    文件:ReactIntegrationTestCase.java   
/**
 * Timing module needs to be created on the main thread so that it gets the correct Choreographer.
 */
protected Timing createTimingModule() {
  final SimpleSettableFuture<Timing> simpleSettableFuture = new SimpleSettableFuture<Timing>();
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          Timing timing = new Timing(getContext(), mock(DevSupportManager.class));
          simpleSettableFuture.set(timing);
        }
      });
  try {
    return simpleSettableFuture.get(5000, TimeUnit.MILLISECONDS);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
项目:ReactNativeSignatureExample    文件:CatalystInstanceImpl.java   
private void synchronouslyDisposeBridgeOnJSThread() {
  final SimpleSettableFuture<Void> bridgeDisposeFuture = new SimpleSettableFuture<>();
  mReactQueueConfiguration.getJSQueueThread().runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          mBridge.destroy();
          mBridge.dispose();
          bridgeDisposeFuture.set(null);
        }
      });
  bridgeDisposeFuture.getOrThrow();
}
项目:react-native-ibeacon-android    文件:CatalystInstanceImpl.java   
private void synchronouslyDisposeBridgeOnJSThread() {
  final SimpleSettableFuture<Void> bridgeDisposeFuture = new SimpleSettableFuture<>();
  mReactQueueConfiguration.getJSQueueThread().runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          mBridge.destroy();
          mBridge.dispose();
          bridgeDisposeFuture.set(null);
        }
      });
  bridgeDisposeFuture.getOrThrow();
}
项目:react-native-box-loaders    文件:CatalystInstanceImpl.java   
private void synchronouslyDisposeBridgeOnJSThread() {
  final SimpleSettableFuture<Void> bridgeDisposeFuture = new SimpleSettableFuture<>();
  mReactQueueConfiguration.getJSQueueThread().runOnQueue(
      new Runnable() {
        @Override
        public void run() {
          mBridge.destroy();
          mBridge.dispose();
          bridgeDisposeFuture.set(null);
        }
      });
  bridgeDisposeFuture.getOrThrow();
}