Ejemplo n.º 1
0
  public void getMemStats(final ServerClient client) {

    StringBuilder sb = new StringBuilder();
    sb.append(Main.memUsed());
    sb.append('\t');
    sb.append(Main.getThreadCount());
    sb.append('\t');
    sb.append(Main.getActiveThreadCount());
    sb.append('\t');
    sb.append(Main.getUpTime());
    sb.append('\n');
    client.sendPacket(GearmanPacket.createTEXT(sb.toString()), null /*TODO*/);
    return;
  }
Ejemplo n.º 2
0
  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;
  }