Example #1
0
  /**
   * Handler for the Trace Opened signal
   *
   * @param signal The incoming signal
   * @since 2.0
   */
  @TmfSignalHandler
  public void traceOpened(TmfTraceOpenedSignal signal) {
    boolean signalIsForUs = false;
    for (ITmfTrace trace : TmfTraceManager.getTraceSet(signal.getTrace())) {
      if (trace == this) {
        signalIsForUs = true;
        break;
      }
    }

    if (!signalIsForUs) {
      return;
    }

    /*
     * The signal is either for this trace, or for an experiment containing
     * this trace.
     */
    IStatus status = executeAnalysis();
    if (!status.isOK()) {
      Activator.log(status);
    }

    TmfTraceManager.refreshSupplementaryFiles(this);

    if (signal.getTrace() == this) {
      /* Additionally, the signal is directly for this trace. */
      if (getNbEvents() == 0) {
        return;
      }

      /* For a streaming trace, the range updated signal should be sent
       * by the subclass when a new safe time is determined.
       */
      if (getStreamingInterval() > 0) {
        return;
      }

      final TmfTimeRange timeRange = new TmfTimeRange(getStartTime(), TmfTimestamp.BIG_CRUNCH);
      final TmfTraceRangeUpdatedSignal rangeUpdatedsignal =
          new TmfTraceRangeUpdatedSignal(this, this, timeRange);

      // Broadcast in separate thread to prevent deadlock
      broadcastAsync(rangeUpdatedsignal);
      return;
    }
  }
Example #2
0
  @Override
  @TmfSignalHandler
  public void traceOpened(TmfTraceOpenedSignal signal) {
    if (signal.getTrace() == this) {
      initializeStreamingMonitor();

      /* Initialize the analysis */
      MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
      status.add(executeAnalysis());
      if (!status.isOK()) {
        Activator.log(status);
      }
      TmfTraceManager.refreshSupplementaryFiles(this);
    }
  }