Exemplo n.º 1
0
    @Override
    public void onDoneReceive(AsyncReport report) {
      if (delegate != null) {
        delegate.onDoneReceive(report);
      }

      if (finished.getAndSet(true)) {
        errors.add("onDoneReceive has been called multiple times.");
      }

      if (!taskExecutor.isExecutingInThis()) {
        errors.add("onDoneReceive must be executed from the context of the executor.");
      }

      reportRef.set(report);
    }
Exemplo n.º 2
0
    @Override
    public void onDataArrive(ImageResult data) {
      if (delegate != null) {
        delegate.onDataArrive(data);
      }

      if (finished.get()) {
        errors.add("onDataArrive has been called after onDoneReceive.");
      }

      if (!taskExecutor.isExecutingInThis()) {
        errors.add("onDataArrive must be executed from the context of the executor.");
      }

      lastResultRef.set(data);
      numberOfImages.incrementAndGet();
    }