public void removeJobs() { Integer throttle = Main.getThrottle(function); if (throttle != null && throttle > 0) { throttle = throttle * -1; Main.setThrottle(function, throttle); } ServerInstructionSet.this.removeJobs(function); throttle = Main.getThrottle(function); if (throttle != null && throttle < 0) { throttle = throttle * -1; Main.setThrottle(function, throttle); } }
public void update_throttle( final String[] args, final ServerClient client) { // String function, Integer throttle){ String function = args[1]; Integer throttle = 0; StringBuilder sb = new StringBuilder(); if (args[2].equalsIgnoreCase("NOTHROTTLE")) { System.out.println("REMOVE THROTTLE" + function); Main.removeThrottle(function); sb.append(function); sb.append('\t'); sb.append("remove throttle"); sb.append('\n'); } else if (args[2].equalsIgnoreCase("KILL")) { System.out.println("KILL FUNCTION"); RemoveClass remove = new RemoveClass(function); Thread t = new Thread(remove); t.start(); sb.append(function); sb.append('\t'); sb.append("kill"); sb.append('\n'); } else { throttle = Integer.parseInt(args[2]); ; if (throttle != null && throttle >= 0) { System.out.println("Putthing throttle: " + throttle + " for function " + function); Main.setThrottle(function, throttle); sb.append(function); sb.append('\t'); sb.append(throttle); sb.append('\n'); } } client.sendPacket(GearmanPacket.createTEXT(sb.toString()), null /*TODO*/); return; }