genie-web/src/main/java/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImpl.java
@Override
    public void killJob(
        final String jobId,
        final String reason
    ) throws GenieException {
        final StreamObserver<JobKillRegistrationResponse> responseObserver =
            parkedJobKillResponseObservers.remove(jobId);

        if (responseObserver == null) {
            log.error("Job not killed. No response observer found for killing the job with id: {} ", jobId);
            throw new GenieServerException(
                "Job not killed. No response observer found for killing the job with id: " + jobId);
        }

        try {
            if (this.persistenceService.getJobStatus(jobId).isFinished()) {
                log.info("v4 job {} was already finished when the kill request came", jobId);
            } else { //Non null response observer and an unfinished job. Send a kill to the agent
                responseObserver.onNext(
                    JobKillRegistrationResponse.newBuilder().build()
                );
                responseObserver.onCompleted();

                log.info("Agent notified for killing job {}", jobId);
            }
        } catch (final NotFoundException e) {
            throw new GenieNotFoundException(e.getMessage(), e);
        }
    }
/**
     * Kill the job with the given id if possible.
     *
     * @param jobId  id of job to kill
     * @param reason brief reason for requesting the job be killed
     * @throws GenieServerException in case there is no response observer found to communicate with the agent
     */
Kill the job with the given id if possible.
@param jobId  id of job to kill
@param reason brief reason for requesting the job be killed
@throws GenieServerException in case there is no response observer found to communicate with the agent
Kill the job with the given id if possible . @param jobId id of job to kill @param reason brief reason for requesting the job be killed @throws GenieServerException in case there is no response observer found to communicate with the agent
@Override
    public void killJob(
        final String jobId,
        final String reason
    ) throws GenieException {
        final StreamObserver<JobKillRegistrationResponse> responseObserver =
            parkedJobKillResponseObservers.remove(jobId);
        if (responseObserver == null) {
            log.error("Job not killed. No response observer found for killing the job with id: {} ", jobId);
            throw new GenieServerException(
                "Job not killed. No response observer found for killing the job with id: " + jobId);
        }
        try {
            if (this.persistenceService.getJobStatus(jobId).isFinished()) {
                log.info("v4 job {} was already finished when the kill request came", jobId);
            } else { 
                responseObserver.onNext(
                    JobKillRegistrationResponse.newBuilder().build()
                );
                responseObserver.onCompleted();
                log.info("Agent notified for killing job {}", jobId);
            }
        } catch (final NotFoundException e) {
            throw new GenieNotFoundException(e.getMessage(), e);
        }
    }
@ Override public void killJob ( final String jobId , final String reason ) throws GenieException { final StreamObserver < JobKillRegistrationResponse > responseObserver = parkedJobKillResponseObservers . remove ( jobId ) ; if ( responseObserver == null ) { log . error ( "Job not killed. No response observer found for killing the job with id: {} " , jobId ) ; throw new GenieServerException ( "Job not killed. No response observer found for killing the job with id: " + jobId ) ; } try { if ( this . persistenceService . getJobStatus ( jobId ) . isFinished ( ) ) { log . info ( "v4 job {} was already finished when the kill request came" , jobId ) ; } else { responseObserver . onNext ( JobKillRegistrationResponse . newBuilder ( ) . build ( ) ) ; responseObserver . onCompleted ( ) ; log . info ( "Agent notified for killing job {}" , jobId ) ; } } catch ( final NotFoundException e ) { throw new GenieNotFoundException ( e . getMessage ( ) , e ) ; } }
Kill the job with the given id if possible.
Kill the job with the given id if possible .
//Non null response observer and an unfinished job. Send a kill to the agent