private final void work_fail(final GearmanPacket packet, final ServerClient client) { /* * This is to notify the server (and any listening clients) that * the job failed. * * Arguments: * - Job handle. */ final byte[] jobHandle = packet.getArgumentData(0); assert jobHandle != null; final ByteArray jobHandleBA = new ByteArray(jobHandle); final ServerJob job = ServerJobAbstract.getJob(jobHandleBA); if (job == null) { client.sendPacket(ServerStaticPackets.ERROR_JOB_NOT_FOUND, null /*TODO*/); } else { job.workComplete(packet); } }
private final void work_complete(final GearmanPacket packet, final ServerClient client) { /* * This is to notify the server (and any listening clients) that * the job completed successfully. * * Arguments: * - NULL byte terminated job handle. * - Opaque data that is returned to the client as a response. */ final byte[] jobHandle = packet.getArgumentData(0); assert jobHandle != null; final ByteArray jobHandleBA = new ByteArray(jobHandle); final ServerJob job = ServerJobAbstract.getJob(jobHandleBA); if (job == null) { client.sendPacket(ServerStaticPackets.ERROR_JOB_NOT_FOUND, null /*TODO*/); } else { // Construct a WORK_COMPLETE response packet client.jobCOmplete(); job.workComplete(packet); } }