Exemple #1
0
 /**
  * Copy constructor
  *
  * @param trace the original trace
  * @throws TmfTraceException Should not happen usually
  */
 public TmfTrace(final TmfTrace trace) throws TmfTraceException {
   super();
   if (trace == null) {
     throw new IllegalArgumentException();
   }
   fCacheSize = trace.getCacheSize();
   fStreamingInterval = trace.getStreamingInterval();
   fParser = trace.fParser;
   initialize(trace.getResource(), trace.getPath(), trace.getEventType());
 }
  /**
   * Initialization of an experiment, taking the type, path, traces, indexPageSize and resource
   *
   * @param type the event type
   * @param path the experiment path
   * @param traces the experiment set of traces
   * @param indexPageSize the experiment index page size
   * @param resource the resource associated to the experiment
   * @since 3.0
   */
  public void initExperiment(
      final Class<? extends ITmfEvent> type,
      final String path,
      final ITmfTrace[] traces,
      final int indexPageSize,
      IResource resource) {
    setCacheSize(indexPageSize);
    setStreamingInterval(0);
    setParser(this);
    // traces have to be set before super.initialize()
    fTraces = traces;
    try {
      super.initialize(resource, path, type);
    } catch (TmfTraceException e) {
      Activator.logError("Error initializing experiment", e); // $NON-NLS-1$
    }

    if (resource != null) {
      try {
        this.synchronizeTraces();
      } catch (TmfTraceException e) {
        Activator.logError("Error synchronizing experiment", e); // $NON-NLS-1$
      }
    }
  }
  /** Clears the experiment */
  @Override
  public synchronized void dispose() {

    // Clean up the index if applicable
    if (getIndexer() != null) {
      getIndexer().dispose();
    }

    if (fTraces != null) {
      for (final ITmfTrace trace : fTraces) {
        trace.dispose();
      }
      fTraces = null;
    }
    super.dispose();
  }