Called whenever a block is done resolving, whether it was successfully resolved or if it
was abandoned.
777254
protected void blockFinished (SceneBlock block)
    {
        --_pendingBlocks;

        // once all the visible pending blocks have completed their
        // resolution, recompute our visible object set and show ourselves
        if (_visiBlocks.remove(block) && _visiBlocks.size() == 0) {
            allBlocksFinished();
        }
    }
1026057
private static function captureSuccessfulBlockResultIfEnabled(
        array $result,
        array $block,
        CaptureAggregatorInterface $captures
    ): void {
        if (BlockReplies::isResultSuccessful($result) === true) {
            $isCaptureEnabled = $block[BlockSerializer::PROPERTIES][BaseRule::PROPERTY_IS_CAPTURE_ENABLED] ?? false;
            if ($isCaptureEnabled === true) {
                $name  = $block[BlockSerializer::PROPERTIES][BaseRule::PROPERTY_NAME];
                $value = BlockReplies::extractResultOutput($result);
                $captures->remember($name, $value);
            }
        }
    }
119329
protected synchronized void handleCompleted() {
        latch.countDown();
        for (final ShutdownListener listener : listeners) {
            listener.handleCompleted();
        }
        listeners.clear();
    }
84682
private void checkDone() {
    if (doneHandler != null) {
      if (cause != null) {
        doneHandler.handle(new DefaultFutureResult<T>(cause));
      } else {
        if (count == required) {
          doneHandler.handle(new DefaultFutureResult<T>((T) null));
        }
      }
    }
  }
1271317
synchronized void deleteBlock(Block block) {
    if (!isInitialized()) {
      return;
    }
    BlockScanInfo info = blockMap.get(block);
    if ( info != null ) {
      delBlockInfo(info);
    }
  }
1270954
function doResolve(fn, onFulfilled, onRejected) {
		var done = false;
		try {
			fn(function (value) {
				if (done) return;
				done = true;
				onFulfilled(value);
			}, function (reason) {
				if (done) return;
				done = true;
				onRejected(reason);
			})
		} catch (ex) {
			if (done) return;
			done = true;
			onRejected(ex);
		}
	}
576364
public boolean isFinished() {
    // If we have a HandshakeResult, we are done.
    if (result != null) {
      return true;
    }
    // If we have an error status, we are done.
    if (status != null && status.getCode() != Status.Code.OK.value()) {
      return true;
    }
    return false;
  }
1088775
public void finish() {
        if ( finSignal == null && finished )
            return;
        // signal finish of execution, so remoting can clean up callback id mappings
        // override if always single result or finish can be emitted by the remote method
        // note one can send FINSILENT to avoid the final message to be visible to receiver callback/spore
        cb.complete(null, null);
        finished = true;
    }
50066
protected function processEndOfBlock()
	{
		if ($this->context['statements'] < 2 && !$this->mustPreserveBraces())
		{
			$this->removeBracesInCurrentContext();
		}

		$this->context = $this->context['parent'];

		// Propagate the "lastBlock" property upwards to handle multiple nested if statements
		$this->context['parent']['lastBlock'] = $this->context['lastBlock'];
	}
444014
@Override
  public void onCompleted() {
    RpcUtils.streamingRPCAndLog(LOG, new RpcUtils.StreamingRpcCallable<OpenLocalBlockResponse>() {
      @Override
      public OpenLocalBlockResponse call() throws Exception {
        if (mLockId != BlockLockManager.INVALID_LOCK_ID) {
          mWorker.unlockBlock(mLockId);
          mLockId = BlockLockManager.INVALID_LOCK_ID;
        } else if (mRequest != null) {
          LOG.warn("Close a closed block {}.", mRequest.getBlockId());
        }
        return null;
      }

      @Override
      public void exceptionCaught(Throwable e) {
        mResponseObserver.onError(GrpcExceptionUtils.fromThrowable(e));
        mLockId = BlockLockManager.INVALID_LOCK_ID;
      }
    }, "CloseBlock", false, true, mResponseObserver, "Session=%d, Request=%s",
        mSessionId, mRequest);
  }
413351
protected function ackOrNackBlock()
    {
        if (! $this->lastDeliveryTag) {
            return;
        }

        $result = $this->flushDeferred();

        switch ($result) {
            case FlushDeferredResult::MSG_ACK():
                $this->ack();
                break;
            case FlushDeferredResult::MSG_REJECT():
                $this->nackAll(false);
                break;
            case FlushDeferredResult::MSG_REJECT_REQUEUE():
                $this->nackAll(true);
                break;
        }
    }
1206205
function(chain) {
      var method = status > 0 ? "resolve" :
                   status < 0 ? "reject" :
                   null;
      if (method) for (var i in chain) {
        chain[i][method](result);
      }
    }
899004
@SuppressWarnings("unchecked")
    protected void triggerDone(Response<T> resolved) {
        for (io.reinert.gdeferred.DoneCallback<T> callback : getDoneCallbacks()) {
            try {
                if (callback instanceof DoneCallback) {
                    ((DoneCallback) callback).onDone(resolved);
                } else {
                    callback.onDone(resolved.getPayload());
                }
            } catch (Exception e) {
                log.log(Level.SEVERE, "An uncaught exception occurred in a DoneCallback", e);
            }
        }
    }
905137
function finish(err) {
      if (!calledDone) {
        calledDone = true;
        exports.finalize(err, resolve, reject);
      }
    }
1279405
private final void complete(Transaction tx, boolean readOnly)
	{
		if (log.isTraceEnabled())
			log.trace("Complete " + tx);

		if (!readOnly)
			tx.commit();
		else
			tx.rollback();
	}
1037618
public void finish() throws IOException {
		int lastBlockSize = (int)(byteCount % blockSize);
		if(lastBlockSize!=0) {
			while(lastBlockSize<blockSize) {
				out.write(padding);
				byteCount++;
				lastBlockSize++;
			}
		}
		out.flush();
	}
713121
public boolean resolve ()
    {
        // if we got canned before we were resolved, go ahead and bail now
        if (_panel != null) {
            if (_panel.getBlock(_bounds.x, _bounds.y) != this) {
                // Log.info("Not resolving abandoned block " + this + ".");
                _wasAbandoned = true;
                return false;
            }
            _panel.blockResolving(this);
        }
        // We're doing our work, we're needed!
        _wasAbandoned = false;

        // start with the bounds of the footprint polygon
        Rectangle sbounds = new Rectangle(_footprint.getBounds());
        Rectangle obounds = null;

        // resolve our base tiles
        long now = System.currentTimeMillis();
        int baseCount = 0, fringeCount = 0;
        for (int yy = 0; yy < _bounds.height; yy++) {
            for (int xx = 0; xx < _bounds.width; xx++) {
                int x = _bounds.x + xx, y = _bounds.y + yy;
                int fqTileId = _model.getBaseTileId(x, y);
                if (fqTileId <= 0) {
                    continue;
                }

                // load up this base tile
                updateBaseTile(fqTileId, x, y);
                baseCount++;

                // if there's no tile here, we don't need no fringe
                int tidx = index(x, y);
                if (_base[tidx] == null) {
                    continue;
                }

                // compute the fringe for this tile
                _fringe[tidx] = computeFringeTile(x, y);
                fringeCount++;
            }
        }

        // DEBUG: check for long resolution times
        long stamp = System.currentTimeMillis();
        long elapsed = stamp - now;
        if (elapsed > 500L) {
            log.warning("Base and fringe resolution took long time " +
                        "[block=" + this + ", baseCount=" + baseCount +
                        ", fringeCount=" + fringeCount +
                        ", elapsed=" + elapsed + "].");
        }

        // resolve our objects
        ObjectSet set = new ObjectSet();
        _model.getObjects(_bounds, set);
        ArrayList<SceneObject> scobjs = Lists.newArrayList();
        now = System.currentTimeMillis();
        for (int ii = 0, ll = set.size(); ii < ll; ii++) {
            SceneObject scobj = makeSceneObject(set.get(ii));
            // ignore this object if it failed to resolve
            if (scobj.bounds == null) {
                continue;
            }
            sbounds.add(scobj.bounds);
            obounds = GeomUtil.grow(obounds, scobj.bounds);
            scobjs.add(scobj);

            // DEBUG: check for long resolution times
            stamp = System.currentTimeMillis();
            elapsed = stamp - now;
            now = stamp;
            if (elapsed > 250L) {
                log.warning("Scene object took look time to resolve " +
                            "[block=" + this + ", scobj=" + scobj +
                            ", elapsed=" + elapsed + "].");
            }
        }
        _objects = scobjs.toArray(new SceneObject[scobjs.size()]);

        // resolve our default tileset
        int bsetid = _model.getDefaultBaseTileSet();
        try {
            if (bsetid > 0) {
                _defset = _tileMgr.getTileSet(bsetid);
            }
        } catch (Exception e) {
            log.warning("Unable to fetch default base tileset [tsid=" + bsetid +
                        ", error=" + e + "].");
        }

        // this both marks us as resolved and makes all our other updated
        // fields visible
        synchronized (this) {
            _obounds = obounds;
            _sbounds = sbounds;
        }

        return true;
    }