public void swapOut() {
    if (fTestRoot == null) return;
    if (isRunning() || isStarting() || isKeptAlive()) return;

    Object[] listeners = fSessionListeners.getListeners();
    for (int i = 0; i < listeners.length; ++i) {
      ITestSessionListener registered = (ITestSessionListener) listeners[i];
      if (!registered.acceptsSwapToDisk()) return;
    }

    try {
      File swapFile = getSwapFile();

      DLTKTestingModel.exportTestRunSession(this, swapFile);
      fTestResult = fTestRoot.getTestResult(true);
      fTestRoot = null;
      fTestRunnerClient = null;
      fIdToTest = new HashMap<String, TestElement>();
      fCategoryMap = new HashMap<String, TestCategoryElement>();
      fIncompleteTestSuites = null;
      fUnrootedSuite = null;

    } catch (IllegalStateException e) {
      DLTKTestingPlugin.log(e);
    } catch (CoreException e) {
      DLTKTestingPlugin.log(e);
    }
  }
  public void swapIn() {
    if (fTestRoot != null) return;

    try {
      DLTKTestingModel.importIntoTestRunSession(getSwapFile(), this);
    } catch (IllegalStateException e) {
      DLTKTestingPlugin.log(e);
      fTestRoot = new TestRoot(this);
      fTestResult = null;
    } catch (CoreException e) {
      DLTKTestingPlugin.log(e);
      fTestRoot = new TestRoot(this);
      fTestResult = null;
    }
  }