Finishes the current response.
976278
private void finish() throws IOException
	{
		if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
			logger.logp(Level.FINE, CLASS_NAME,"finish", "finish");
        }
		if (length == -1 && total != 0)
			length = total;
		//PK89810 Start
		if (WCCustomProperties.FINISH_RESPONSE_ON_CLOSE) {			
			WebContainerRequestState reqState = WebContainerRequestState.getInstance(false);		
			if (reqState==null || reqState.getAttribute("com.ibm.ws.webcontainer.appIsArdEnabled")==null){
				if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
        			logger.logp(Level.FINE, CLASS_NAME,"finish", "finishresponseonclose and appIsNotArdEnabled, setLastBuffer to true");
				response.setLastBuffer(true);	
			}       	
		}//PK89810 End
		flush();
	}
857603
public function end()
    {
        // Already ended, skip
        if ($this->ended === true) {
            return;
        }

        if (function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        }

        $this->ended = true;

        $this->completeContext();
        $this->completeResponse();

        // We really want to avoid throwing exceptions there
        try {
            $this->log();
        } catch (Exception $e) {
            error_log($e->getMessage());
        }
    }
835119
public synchronized void finish() {
    if (!this.isInitialized()) {
      throw new IllegalStateException("Torrent not yet initialized!");
    }

    if (!this.isComplete()) {
      throw new IllegalStateException("Torrent download is not complete!");
    }

    eventDispatcher.multicaster().downloadComplete();
    setClientState(ClientState.SEEDING);
  }
875353
function flush(done) {
    this.once('done', done);

    if (this._res.finished) {
      this.emit('done', new Error('Response was closed, unable to flush content'));
    }

    if (!this._queue.length) this.emit('done');
    var data = new Buffer(this.join(), this.charset);

    if (data.length) {
      this.debug('Writing %d bytes of %s to response', data.length, this.charset);
      this._res.write(data, this.emits('done'));
    }

    //
    // Optional write confirmation, it got added in more recent versions of
    // node, so if it's not supported we're just going to call the callback
    // our selfs.
    //
    if (this._res.write.length !== 3 || !data.length) this.emit('done');
  }
1157609
public void finish() {
		if (mSuccessful) {
			mDb.setTransactionSuccessful();
		}
		mDb.endTransaction();

		if (mSuccessful) {
			for (OnTransactionCommittedListener listener : mOnTransactionCommittedListeners) {
				listener.onTransactionCommitted();
			}
		}
	}
350703
def _finish(self):
        """"""
        self.finished = True
        if self._callback:
            self._callback(self)
        self._finish_event.set()
1293577
public void finished()
  {
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, "finished");
      
    anycastIHIterator = null;
      
    if (tc.isEntryEnabled()) 
      SibTr.exit(tc, "finished");
  }
1002319
private boolean completeResponse(OperationResponse response, Runnable callback) {
    // If the response is null, that indicates an exception occurred. The best we can do is complete
    // the response in sequential order.
    if (response == null) {
      log.trace("Completing failed request");
      callback.run();
      return true;
    }

    // If the response's event index is greater than the current event index, that indicates that events that were
    // published prior to the response have not yet been completed. Attempt to complete pending events.
    if (response.eventIndex() > eventIndex) {
      // For each pending event with an eventIndex less than or equal to the response eventIndex, complete the event.
      // This is safe since we know that sequenced responses should see sequential order of events.
      EventCallback eventCallback = eventCallbacks.peek();
      while (eventCallback != null && eventCallback.request.eventIndex() <= response.eventIndex()) {
        eventCallbacks.remove();
        log.trace("Completing event {}", eventCallback.request);
        eventCallback.run();
        eventIndex = eventCallback.request.eventIndex();
        eventCallback = eventCallbacks.peek();
      }
    }

    // If after completing pending events the eventIndex is greater than or equal to the response's eventIndex, complete the response.
    // Note that the event protocol initializes the eventIndex to the session ID.
    if (response.eventIndex() <= eventIndex || (eventIndex == 0 && response.eventIndex() == state.getSessionId().id())) {
      log.trace("Completing response {}", response);
      callback.run();
      return true;
    } else {
      return false;
    }
  }
1046644
public void finished()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "finished");

    synchronized (this)
    {
      parent.sendBrowseStatus(SIMPConstants.BROWSE_CLOSE, browseId);

      if (keepAliveAlarmHandle != null)
      {
        keepAliveAlarmHandle.cancel();
        keepAliveAlarmHandle = null;
      }

      parent.removeBrowseCursor(browseId);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "finished");
  }
731538
def finish(self):
        
        # Update the last_offset in the mar header
        self.write_header()
        # Write out the index of contents
        self.write_index()

        if not self.use_old_format:
            # Refresh the signature
            sigs = self.calculate_signatures()
            self.write_signatures(sigs)
1180458
public void finish() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Finishing " + this);
        }
        // if there is a print writer, flush any content unless it is already
        // closed. We don't need to do this with streams.
        if (null != this.outWriter) {
            this.outWriter.checkError();
        }
    }
116406
function () {

            var res = arguments[0];

            userOptions.emit('response', req, res);

            if (callback && userOptions.resCallback) callback.apply(this, arguments);

            res.on('end', function() {
                userOptions.emit('afterResponse', req, res);
            });

        }
158116
public function onFinish()
    {
        $this->onResponse->executeAll($this, false);
        $this->onResponse = null;
        if ($this->pool && ($this->url !== null)) {
            $this->pool->detachConnFromUrl($this, $this->url);
        }
        parent::onFinish();
    }
896997
public void finishStage(ResponseBuilder rb) {
    // System.out.println(
    // "collection: " + System.nanoTime() + " - " +
    // Thread.currentThread().getId()
    // + " - " + rb.req.getParams().getBool("isShard", false)
    // + " FINISHSTAGE " + rb.stage + " " + rb.req.getParamString());
    if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)) {
      if (rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY
          && rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
        ComponentFields mtasFields = getMtasFields(rb);
        if (mtasFields.doCollection) {
          if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) {
            // mtas response
            NamedList<Object> mtasResponse = null;
            try {
              mtasResponse = (NamedList<Object>) rb.rsp.getValues()
                  .get(MtasSolrSearchComponent.NAME);
            } catch (ClassCastException e) {
              log.debug(e);
              mtasResponse = null;
            }
            if (mtasResponse == null) {
              mtasResponse = new SimpleOrderedMap<>();
              rb.rsp.add(MtasSolrSearchComponent.NAME, mtasResponse);
            }
            ArrayList<Object> mtasCollectionResponses;
            if (mtasResponse.get(NAME) != null
                && mtasResponse.get(NAME) instanceof ArrayList) {
              mtasCollectionResponses = (ArrayList<Object>) mtasResponse
                  .get(NAME);
            } else {
              mtasCollectionResponses = new ArrayList<>();
              mtasResponse.add(NAME, mtasCollectionResponses);
            }
            MtasSolrCollectionResult collectionResult;
            for (ComponentCollection componentCollection : mtasFields.collection) {
              try {
                collectionResult = createMtasSolrCollectionResult(
                    componentCollection, false);
                // Create response
                SimpleOrderedMap<Object> mtasCollectionResponse = new SimpleOrderedMap<>();
                mtasCollectionResponse.add("key", componentCollection.key);
                mtasCollectionResponse.add("data", collectionResult);
                mtasCollectionResponses.add(mtasCollectionResponse);
              } catch (IOException e) {
                log.debug(e);
              }
            }
          }
          // decode shard responses
          for (ShardRequest sreq : rb.finished) {
            if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
                && sreq.params.getBool(PARAM_MTAS_COLLECTION, false)) {
              for (ShardResponse shardResponse : sreq.responses) {
                NamedList<Object> solrShardResponse = shardResponse
                    .getSolrResponse().getResponse();
                try {
                  ArrayList<SimpleOrderedMap<Object>> data = (ArrayList<SimpleOrderedMap<Object>>) solrShardResponse
                      .findRecursive(MtasSolrSearchComponent.NAME, NAME);
                  if (data != null) {
                    MtasSolrResultUtil.decode(data);
                    if (rb.stage > ResponseBuilder.STAGE_EXECUTE_QUERY) {
                      ArrayList<SimpleOrderedMap<Object>> filteredData = new ArrayList<>();
                      for (SimpleOrderedMap<Object> dataItem : data) {
                        if (dataItem.get("data") != null && dataItem
                            .get("data") instanceof MtasSolrCollectionResult) {
                          MtasSolrCollectionResult collectionResult = (MtasSolrCollectionResult) dataItem
                              .get("data");
                          if (rb.stage <= MtasSolrSearchComponent.STAGE_COLLECTION_INIT) {
                            if (!collectionResult.action()
                                .equals(ComponentCollection.ACTION_CREATE)
                                && !collectionResult.action()
                                    .equals(ComponentCollection.ACTION_LIST)
                                && !collectionResult.action()
                                    .equals(ComponentCollection.ACTION_CHECK)) {
                              filteredData.add(dataItem);
                            }
                          } else if (rb.stage <= MtasSolrSearchComponent.STAGE_COLLECTION_FINISH) {
                            if (!collectionResult.action()
                                .equals(ComponentCollection.ACTION_POST)
                                && !collectionResult.action()
                                    .equals(ComponentCollection.ACTION_IMPORT)
                                && !collectionResult.action()
                                    .equals(ComponentCollection.ACTION_CHECK)) {
                              filteredData.add(dataItem);
                            }
                          }
                        } else {
                          filteredData.add(dataItem);
                        }
                      }
                      data.clear();
                      data.addAll(filteredData);
                    }
                  }
                } catch (ClassCastException e) {
                  log.debug(e);
                  // shouldn't happen
                }
              }
            }
          }
        }
      }
    }
  }
1318897
private void finishStatus(MtasSolrStatus status) {
		if (!status.finished()) {
			status.setFinished();
			if (requestHandler != null) {
				try {
					requestHandler.finishStatus(status);
				} catch (IOException e) {
					log.error(e);
				}
			}
		}
	}
702569
def finish (self):
        """"""
        if not self.urlqueue.empty():
            # This happens when all checker threads died.
            self.cancel()
        for t in self.threads:
            t.stop()
1106193
protected synchronized void postTaskExecution() {
		if (stopped) {
			// Stopped, so don't count the task(s) as done.
			// (worker threads call this method even if the task was not really executed.)
			return;
		}
		tasksDoneCount++;
		int percentageComplete = tasksDoneCount * 100 / tasksTotalCount;

		// Compute the progress and notify the listeners
		this.notifyListenersSpiderProgress(percentageComplete, tasksDoneCount, tasksTotalCount - tasksDoneCount);

		// Check for ending conditions
		if (tasksDoneCount == tasksTotalCount && initialized) {
			this.complete();
		}
	}