@Override public String submitFutureJob(String callback, byte[] data, Date whenToRun) throws NoServersAvailableException { String uniqueID = UUID.randomUUID().toString(); try { ServerResponse response = sendJobPacket(new SubmitJob(callback, uniqueID, data, whenToRun)); if(response != null) { LOG.debug("Sent future job request to " + response.getConnection()); // If we get back a JOB_CREATED packet, we can continue, // otherwise try the next job manager if (response.getPacket().getType() == PacketType.JOB_CREATED) { String jobHandle = ((JobCreated)response.getPacket()).getJobHandle(); LOG.debug("Created future job %s\n", jobHandle); return jobHandle; } } } catch (NoServersAvailableException nsae) { LOG.warn("No servers available to submit the job."); throw nsae; } return null; }
public String submitJobInBackground(String callback, byte[] data, JobPriority priority) throws NoServersAvailableException { String jobid = UUID.randomUUID().toString(); try { ServerResponse response = sendJobPacket(new SubmitJob(callback, jobid, data, true, priority)); if(response != null) { LOG.debug("Sent background job request to " + response.getConnection()); // If we get back a JOB_CREATED packet, we can continue, // otherwise try the next job manager if (response.getPacket().getType() == PacketType.JOB_CREATED) { String jobHandle = ((JobCreated)response.getPacket()).getJobHandle(); LOG.debug(format("Created background job %s, with priority %s\n", jobHandle, priority.toString())); return jobHandle; } } } catch (NoServersAvailableException nsae) { LOG.warn("No servers available to submit the job."); throw nsae; } return null; }
ServerResponse response = sendJobPacket(new SubmitJob(callback, jobid, data, false, priority)); if(response != null)