Cancel a particular download in progress. Returns 1 if the download Id is found else returns 0.

@param downloadId
@return int
325436
int cancel(int downloadId) {
		synchronized (mCurrentRequests) {
			for (DownloadRequest request : mCurrentRequests) {
				if (request.getDownloadId() == downloadId) {
					request.cancel();
					return 1;
				}
			}
		}

		return 0;
	}
417581
public synchronized String getTaskStatus(final int taskId) throws NotFoundException {

    final TaskEntity running = getTask(taskId, runningTasks);
    if (running != null) {
      return "Running : " + running.toString();
    }

    final TaskEntity waiting = getTask(taskId, taskQueue);
    if (waiting != null) {
      return "Waiting : " + waiting.toString();
    }

    final TaskEntity finished = getTask(taskId, finishedTasks);
    if (finished != null) {
      return "Finished : " + finished.toString();
    }

    final TaskEntity canceled = getTask(taskId, canceledTasks);
    if (canceled != null) {
      return "Canceled: " + canceled.toString();
    }

    throw new NotFoundException(
        new StringBuilder().append("Task with ID ").append(taskId).append(" is not found").toString());
  }
1112423
@Override
	int getOldID() {
		int ID_ = getID();

		if (m_userOldestWkid != -1)
			return m_userOldestWkid;

		m_userOldestWkid = Wkid.wkid_to_old(ID_);

		if (m_userOldestWkid != -1)
			return m_userOldestWkid;

		return ID_;
	}
1021173
public int getUserID()
    {
        int iUserID = -1;
        String strUserID = DBConstants.BLANK;
        if (this.getRecord().getRecordOwner() != null)
            if (this.getRecord().getRecordOwner().getTask() != null)
                if (this.getRecord().getRecordOwner().getTask().getApplication() != null)
            strUserID = ((BaseApplication)this.getRecord().getRecordOwner().getTask().getApplication()).getUserID();
        try   {
            iUserID = Integer.parseInt(strUserID);
            if (iUserID == 0)
                iUserID = -1;
        } catch (NumberFormatException e) {
            iUserID = -1;
        }
        return iUserID;
    }
65190
public int deleteByIdCascade(String id) throws SQLException {
		int count = 0;
		if (id != null) {
			TableIndex tableIndex = queryForId(id);
			if (tableIndex != null) {
				count = deleteCascade(tableIndex);
			}
		}
		return count;
	}
380189
public int decrementAndGet(Object key)
    {
        long hashCode = getHashCode(key);
        int previousCount = addTo(hashCode, -1);
        if (previousCount == 1) {
            remove(hashCode);
        }
        return previousCount - 1;
    }
442441
public function cancelFromId( $FileUploadId){
        $Service = sprintf( self::API_UPLOAD_CANCEL, $FileUploadId);
        $rest = $this->getService( $Service);
        $rest->DELETE();

        return $rest->getSuccess();
    }
338672
@Override
    public int cancel2(long channelId, long callId) throws AsyncException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "cancel2: channel = " + channelId + " call id = " + callId);
        }
        int rc = 0;
        synchronized (oneAtATime) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "have lock");
            }
            if (aioInitialized == AIO_INITIALIZED) {
                try {
                    // Ask the native code to perform a cancel operation
                    rc = aio_cancel2(channelId, callId);
                } catch (Throwable t) {
                    if (aioInitialized != AIO_SHUTDOWN) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "caught throwable:" + t);
                        }
                        throw new AsyncException("Throwable caught from aio dll: aio_cancel2: " + t.getMessage());
                    }
                }
            }
        } // end-sync
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "cancel2: " + rc);
        }
        return rc;
    }
22863
public int getStartingID()
    {
        int iStartingID = 1;   // (default)
        if (this.getProperty(STARTING_ID) != null)
        {
            try {
                iStartingID = Integer.parseInt(this.getProperty(STARTING_ID));
            } catch (NumberFormatException e) {
                iStartingID = 1;
            }
        }
        return iStartingID;
    }
1340326
public void cancel(int entryId) {
        NotificationEntry entry = mCenter.getEntry(ID, entryId);
        if (entry != null) {
            cancel(entry);
        }
    }
209896
public Number getStreamIdForChannelId(int channelId) {
        if (channelId < 4) {
            return 0;
        }
        Number streamId = Math.floor(((channelId - 4) / 5.0d) + 1);
        if (log.isTraceEnabled()) {
            log.trace("Stream id: {} requested for channel id: {}", streamId, channelId);
        }
        return streamId;
    }
264969
public function markFeedAsRead($downloadFeedId)
    {
        $service = sprintf(self::API_DOWNLOAD_FEEDS_ITEMS_MARK_AS_READ, $downloadFeedId);
        $rest    = $this->callService('POST', $service);

        return $rest->getSuccess();
    }
1285412
public int add(DownloadRequest request) {
    request = checkNotNull(request, "request == null");
    if (isDownloading(request.uri().toString())) {
      return -1;
    }

    request.context(context);
    request.downloader(downloader.copy());

    /* add download request into download request queue */
    return downloadRequestQueue.add(request) ? request.downloadId() : -1;
  }
11078
public int stop(String home)
   {
      Process p = instances.get(home);
      if (p != null)
      {
         try
         {
            p.destroy();
            return p.exitValue();

         }
         catch (Throwable t)
         {
            return -1;
         }
         finally
         {
            instances.remove(home);
         }
      }

      return 0;
   }
167534
public function removeFeed( $downloadFeedId){
        $service = sprintf( self::API_DOWNLOAD_FEEDS_ITEM, $downloadFeedId);
        $rest = $this->getService( $service);
        $rest->DELETE();

        return $rest->getSuccess();
    }
1117702
def termination_check(self):
        # type: (Downloader) -> bool
        
        with self._transfer_lock:
            with self._disk_operation_lock:
                return (self._download_terminate or
                        len(self._exceptions) > 0 or
                        (self._all_remote_files_processed and
                         len(self._transfer_set) == 0 and
                         len(self._disk_set) == 0))
1315270
public static function tid(): int
    {
        if (!ServerUtil::coroutineIsEnabled()) {
            return -1;
        }

        $id = SwCoroutine::getuid();

        return self::$idMap[$id] ?? $id;
    }