コード例 #1
0
 private static void errorCallbackFromNative(int error) {
   ErrorCallback errorCallback = null;
   synchronized (AudioSystem.class) {
     if (mErrorCallback != null) {
       errorCallback = mErrorCallback;
     }
   }
   if (errorCallback != null) {
     errorCallback.onError(error);
   }
 }
コード例 #2
0
  /**
   * Triggers an error for the Future
   *
   * @param error The error
   */
  public void triggerError(Throwable error) {
    synchronized (mErrorLock) {
      if (mErrorCallback.size() > 0) {
        for (ErrorCallback handler : mErrorCallback) {
          handler.onError(error);
        }
      } else {
        mErrorQueue.add(error);
      }

      mError = error;
      mResultSemaphore.release();
    }
  }
コード例 #3
0
 /*
  * Registers a callback to be invoked when an error occurs.
  * @param cb the callback to run
  */
 public static void setErrorCallback(ErrorCallback cb) {
   synchronized (AudioSystem.class) {
     mErrorCallback = cb;
     if (cb != null) {
       cb.onError(checkAudioFlinger());
     }
   }
 }
コード例 #4
0
  /**
   * Handles error during the execution of the Future. If it's the first time the method is invoked
   * on the object and errors were already triggered, the handler will be called once per error,
   * right away.
   *
   * @param errorCallback The handler
   */
  public OfficeFuture<V> onError(ErrorCallback errorCallback) {
    synchronized (mErrorLock) {
      mErrorCallback.add(errorCallback);

      while (!mErrorQueue.isEmpty()) {
        // Only the first error handler will get the queued errors
        if (errorCallback != null) {
          errorCallback.onError(mErrorQueue.poll());
        }
      }
    }

    return this;
  }
コード例 #5
0
ファイル: FileIOUtils.java プロジェクト: akjava/akjava_gwtlib
 @Override
 public void fileErrorCallback(FileError fileError) {
   callback.onError(message, fileError);
 }