public void run() {
    try {
      ObjectOutputStream outputStream = new ObjectOutputStream(_clientSocket.getOutputStream());
      outputStream.flush();

      DataInputStream inputStream = new DataInputStream(_clientSocket.getInputStream());

      while (true) {
        String request = inputStream.readUTF();

        Trace.info("Received request: " + request);

        RMResult response = processIfComposite(request);
        if (response == null) {
          response = processIfCIDRequired(request);
          if (response == null) {
            response = processAtomicRequest(request);
          }
        }

        outputStream.writeObject(response);
        outputStream.flush();
      }
    } catch (EOFException eof) {
      Trace.info("A client closed a connection.");
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
 @SuppressWarnings({"unchecked", "rawtypes"})
 private void truncate(Trace<?> dest, Trace<?> orig) throws IOException {
   long min_time = minTime * orig.ticsPerSecond();
   long max_time = maxTime * orig.ticsPerSecond();
   Converter truncater;
   if (orig.isStateful()) {
     truncater =
         new StatefulSubtraceConverter(
             (StatefulTrace<?, ?>) dest, (StatefulTrace<?, ?>) orig, min_time, max_time);
   } else {
     truncater = new SubtraceConverter(dest, orig, min_time, max_time);
   }
   truncater.convert();
 }
 @Override
 protected void run()
     throws IOException, NoSuchTraceException, AlreadyExistsException, LoadTraceException {
   if (orig_trace_name != null) {
     Trace<?> orig_trace = orig_store.getTrace(orig_trace_name);
     Trace<?> dest_trace = dest_store.newTrace(dest_trace_name, orig_trace.type(), force);
     truncate(dest_trace, orig_trace);
   } else {
     for (Trace<?> orig_trace : orig_store.listTraces()) {
       Trace<?> dest_trace = dest_store.newTrace(orig_trace.name(), orig_trace.type(), force);
       truncate(dest_trace, orig_trace);
     }
   }
 }
Example #4
0
  public MbeanGenerator(ResourceManager mgr, MibNode aGroup, Context ctxt) throws IOException {
    super(mgr, aGroup, ctxt);

    gentype = ctxt.gentype;

    // Specify oid of the current bean ...
    //
    oid = node.getComputedOid();

    // Try to find a symbol to associate to the group
    //
    varName = node.getSymbolName();
    if (varName == null) varName = getClassName(node.getComputedOid());
    symboleName = getNodeSymbolName(node);

    Trace.info(MessageHandler.getMessage("generate.info.var", varName));

    // Open the file which will represent the M-bean.
    //
    out = openFile(symboleName + Def.JAVA);

    // Write generic header ...
    //
    writeHeader();

    // write our own header ...
    //
    writeClassDeclaration();

    // write the beginning of the constructor
    //
    buildConstructorHeader();
  }