This function will cancel an existing fax job.

@param   faxJob
The fax job object containing the needed information
196465
@Override
    protected void cancelFaxJobImpl(FaxJob faxJob)
    {
        //create HTTP request
        HTTPRequest httpRequest=this.createCancelFaxJobHTTPRequest(faxJob);
        
        //submit HTTP request
        this.submitHTTPRequest(faxJob,httpRequest,FaxActionType.CANCEL_FAX_JOB);
    }
1235807
@Override
    protected void suspendFaxJobImpl(FaxJob faxJob)
    {
        //create HTTP request
        HTTPRequest httpRequest=this.createSuspendFaxJobHTTPRequest(faxJob);
        
        //submit HTTP request
        this.submitHTTPRequest(faxJob,httpRequest,FaxActionType.SUSPEND_FAX_JOB);
    }
500645
@Override
    protected void submitFaxJobImpl(FaxJob faxJob)
    {
        //create HTTP request
        HTTPRequest httpRequest=this.createSubmitFaxJobHTTPRequest(faxJob);
        
        //submit HTTP request
        this.submitHTTPRequest(faxJob,httpRequest,FaxActionType.SUBMIT_FAX_JOB);
    }
1090252
public function cancelJob($job)
    {
        $jobId = Utilities::getEntityId(
            $job,
            'WindowsAzure\MediaServices\Models\Job'
        );
        $jobIdEncoded = urlencode($jobId);

        $method = Resources::HTTP_GET;
        $headers = [];
        $postParams = [];
        $queryParams = [];
        $path = "CancelJob?jobid='{$jobIdEncoded}'";
        $statusCode = Resources::STATUS_NO_CONTENT;

        $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode
        );
    }
240627
@Override
    protected void resumeFaxJobImpl(FaxJob faxJob)
    {
        //get fax job
        HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob;
        
        //get client
        HylaFAXClient client=this.getHylaFAXClient();

        try
        {
            this.resumeFaxJob(hylaFaxJob,client);
        }
        catch(FaxException exception)
        {
            throw exception;
        }
        catch(Exception exception)
        {
            throw new FaxException("General error.",exception);
        }
    }
310284
@Override
    protected void resumeFaxJobImpl(FaxJob faxJob)
    {
        //create command
        String command=this.createResumeFaxJobProcessCommand(faxJob);
        
        //execute command
        this.executeProcess(faxJob,command,FaxActionType.RESUME_FAX_JOB);
    }
3820
private void winCancelFaxJob(String serverName,int faxJobID)
    {
        synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK)
        {
            //pre native call
            this.preNativeCall();
            
            //invoke native
            WindowsJNIFaxClientSpi.cancelFaxJobNative(serverName,faxJobID);
        }
    }
396257
@Override
    protected void suspendFaxJobImpl(FaxJob faxJob)
    {
        //get fax job
        HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob;
        
        //get client
        HylaFAXClient client=this.getHylaFAXClient();

        try
        {
            this.suspendFaxJob(hylaFaxJob,client);
        }
        catch(FaxException exception)
        {
            throw exception;
        }
        catch(Exception exception)
        {
            throw new FaxException("General error.",exception);
        }
    }
1254761
protected void submitFaxJobViaFaxModem(FaxJob faxJob) throws Exception
    {
        //get type
        String type=faxJob.getProperty(FaxJobExtendedPropertyConstants.DATA_TYPE_FAX_JOB_PROPERTY_KEY.toString(),"TEXT");

        //get common values
        int width=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.WIDTH_FAX_JOB_PROPERTY_KEY.toString(),null));
        int height=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.HEIGHT_FAX_JOB_PROPERTY_KEY.toString(),null));
        int imageType=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.IMAGE_TYPE_FAX_JOB_PROPERTY_KEY.toString(),String.valueOf(BufferedImage.TYPE_INT_RGB)));

        //create image
        BufferedImage image=new BufferedImage(width,height,imageType);
        
        //create fax producer
        Object faxProducer=null;
        if(type.equalsIgnoreCase("PDF"))
        {
            //get type
            Class<?> classDefinition=ReflectionHelper.getType("com.java4less.rfax.PDFFaxProducer");

            //create fax producer
            faxProducer=ReflectionHelper.createInstance(classDefinition);
            
            ReflectionHelper.invokeMethod(classDefinition,faxProducer,"setPDFFile",new Class[]{String.class},new Object[]{faxJob.getFilePath()});
            Field field=ReflectionHelper.getField(classDefinition,"pageImage");
            field.set(faxProducer,image);
        }
        else if(type.equalsIgnoreCase("TEXT"))
        {
            //get type
            Class<?> classDefinition=ReflectionHelper.getType("com.java4less.rfax.TextFaxProducer");

            //create fax producer
            faxProducer=ReflectionHelper.createInstance(classDefinition);
            
            String text=IOHelper.readTextFile(faxJob.getFile());
            Field field=ReflectionHelper.getField(classDefinition,"text");
            field.set(faxProducer,text);
            field=ReflectionHelper.getField(classDefinition,"pageImage");
            field.set(faxProducer,image);
            ReflectionHelper.invokeMethod(classDefinition,faxProducer,"prepare",null,null);
        }
        else
        {
            throw new FaxException("Unsupported type provided: "+type);
        }

        //init fax modem
        Class<?> faxModemClassDefinition=ReflectionHelper.getType("com.java4less.rfax.FaxModem");
        Object faxModem=ReflectionHelper.createInstance(faxModemClassDefinition);
        ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"setPortName",new Class[]{String.class},new Object[]{this.portName});
        Field field=ReflectionHelper.getField(faxModemClassDefinition,"faxClass");
        field.set(faxModem,Integer.valueOf(this.faxClass));

        //send fax
        Class<?> faxProducerClassDefinition=ReflectionHelper.getType("com.java4less.rfax.FaxProducer");
        ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"open",new Class[]{faxProducerClassDefinition},new Object[]{faxProducer});
        boolean faxSent=((Boolean)ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"sendFax",new Class[]{String.class},new Object[]{faxJob.getTargetAddress()})).booleanValue();
        
        //release fax modem
        ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"close",null,null);
        
        if(!faxSent)
        {
            field=ReflectionHelper.getField(faxModemClassDefinition,"lastError");
            String lastError=(String)field.get(faxModem);
            throw new FaxException("Error while sending fax. Error: "+lastError);
        }
    }
1077390
protected FaxJobStatus getFaxJobStatusFromWindowsFaxJobStatusString(String faxJobStatusStr)
    {
        FaxJobStatus faxJobStatus=FaxJobStatus.UNKNOWN;
        if((faxJobStatusStr!=null)&&(faxJobStatusStr.length()>0))
        {
            if((faxJobStatusStr.equalsIgnoreCase("Pending"))||(faxJobStatusStr.equalsIgnoreCase("Paused"))||(faxJobStatusStr.equalsIgnoreCase("Retrying")))
            {
                faxJobStatus=FaxJobStatus.PENDING;
            }
            else if(faxJobStatusStr.equalsIgnoreCase("In Progress"))
            {
                faxJobStatus=FaxJobStatus.IN_PROGRESS;
            }
            else if((faxJobStatusStr.equalsIgnoreCase("Failed"))||(faxJobStatusStr.equalsIgnoreCase("No Line"))||(faxJobStatusStr.equalsIgnoreCase("Retries Exceeded")))
            {
                faxJobStatus=FaxJobStatus.ERROR;
            }
        }
        
        return faxJobStatus;
    }
707773
public void submitFaxJob(FaxJob faxJob)
    {
        //validate fax job
        this.invokeFaxJobNullValidation(faxJob);

        //validate fax job target address
        String targetAddress=faxJob.getTargetAddress();
        if((targetAddress==null)||(targetAddress.length()==0))
        {
            throw new FaxException("Fax job target address not provided.");
        }

        //validate fax job file
        File file=faxJob.getFile();
        if(file==null)
        {
            throw new FaxException("Fax job file not provided.");
        }
        else if(!file.exists())
        {
            throw new FaxException("Fax job file "+file.getPath()+" does not exist.");
        }
        else if(!file.isFile())
        {
            throw new FaxException("Fax job file "+file.getPath()+" is not a file.");
        }
        else if(file.length()==0)
        {
            throw new FaxException("Fax job file "+file.getPath()+" is empty.");
        }

        //invoke action
        this.submitFaxJobImpl(faxJob);
        
        //fire event
        this.fireFaxEvent(FaxClientActionEventID.SUBMIT_FAX_JOB,faxJob);

        //start monitoring fax job if and only if monitoring is supported and there are existing listeners
        if(this.isFaxMonitorEventsSupported())
        {
            synchronized(this.faxMonitorEventListeners)
            {
                if(!this.faxMonitorEventListeners.isEmpty())
                {
                    //monitor the submitted fax job
                    this.spiFaxJobMonitor.monitorFaxJob(this,faxJob);
                }
            }
        }
    }
1118543
@Override
    public void cancelJob(int idJob)
    {
        try
        {
            target.path("ji/cancelled/" + idJob).request().post(null);
        }
        catch (BadRequestException e)
        {
            throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e);
        }
        catch (Exception e)
        {
            throw new JqmClientException(e);
        }
    }
457038
public void cancel(Throwable ex){
    if(ex instanceof JobCancelledException || ex.getMessage() != null && ex.getMessage().contains("job was cancelled"))
      return;
    if(ex instanceof  IllegalArgumentException || ex.getCause() instanceof IllegalArgumentException) {
      cancel("Illegal argument: " + ex.getMessage());
      return;
    }
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    ex.printStackTrace(pw);
    String stackTrace = sw.toString();
    cancel("Got exception '" + ex.getClass() + "', with msg '" + ex.getMessage() + "'\n" + stackTrace, JobState.FAILED);
    if(_fjtask != null && !_fjtask.isDone()) _fjtask.completeExceptionally(ex);
  }
1326626
def mark_job_as_canceling(self, job_id):
        

        job, _ = self._update_job_state(job_id, State.CANCELING)
        return job
615117
public void unregisterJob(GramJob job) {
	String id = job.getIDAsString();
	_jobs.remove(id);
    }
1337144
@Override
    protected String createCancelFaxJobProcessCommand(FaxJob faxJob)
    {
        //get arguments
        String commandArguments=this.createProcessCommandArgumentsForExistingFaxJob(Fax4jExeConstants.CANCEL_ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT_VALUE.toString(),faxJob);
        
        //create command
        String command=this.createProcessCommand(commandArguments);
        
        return command;
    }
174851
public void cancel(final String msg) {
    JobState js = msg == null ? JobState.CANCELLED : JobState.FAILED;
    cancel(msg, js);
  }