public void acceptDataSet(DataSetEvent e) {
    if (m_splitThread == null) {
      final Instances dataSet = new Instances(e.getDataSet());
      m_splitThread = new Thread() {
	  public void run() {
	    try {
	      dataSet.randomize(new Random(m_randomSeed));
	      int trainSize = 
                (int)Math.round(dataSet.numInstances() * m_trainPercentage / 100);
	      int testSize = dataSet.numInstances() - trainSize;
      
	      Instances train = new Instances(dataSet, 0, trainSize);
	      Instances test = new Instances(dataSet, trainSize, testSize);
      
	      TrainingSetEvent tse =
		new TrainingSetEvent(TrainTestSplitMaker.this, train);
	      tse.m_setNumber = 1; tse.m_maxSetNumber = 1;
	      if (m_splitThread != null) {
		notifyTrainingSetProduced(tse);
	      }
    
	      // inform all test set listeners
	      TestSetEvent teste = 
		new TestSetEvent(TrainTestSplitMaker.this, test);
	      teste.m_setNumber = 1; teste.m_maxSetNumber = 1;
	      if (m_splitThread != null) {
		notifyTestSetProduced(teste);
	      } else {
		if (m_logger != null) {
		  m_logger.logMessage("[TrainTestSplitMaker] "
		      + statusMessagePrefix() + " Split has been canceled!");
		  m_logger.statusMessage(statusMessagePrefix()
		      + "INTERRUPTED");
		}
	      }
	    } catch (Exception ex) {
	      stop(); // stop all processing
	      if (m_logger != null) {
	          m_logger.statusMessage(statusMessagePrefix()
	              + "ERROR (See log for details)");
	          m_logger.logMessage("[TrainTestSplitMaker] " 
	              + statusMessagePrefix()
	              + " problem during split creation. " 
	              + ex.getMessage());
	      }
	      ex.printStackTrace();
	    } finally {
	      if (isInterrupted()) {
	        if (m_logger != null) {
	          m_logger.logMessage("[TrainTestSplitMaker] "
	              + statusMessagePrefix() + " Split has been canceled!");
	          m_logger.statusMessage(statusMessagePrefix()
	              + "INTERRUPTED");
	        }
	      }
	      block(false);
	    }
	  }
	};
      m_splitThread.setPriority(Thread.MIN_PRIORITY);
      m_splitThread.start();

      //      if (m_splitThread.isAlive()) {
      block(true);
      //      }
      m_splitThread = null;
    }
  }