@Override public void run() { for (File file : DirList.listDirectory(m_inputDir)) { PBFile window = null; try { window = WindowFactory.getInstance().createWindow(file); } catch (IOException e) { e.printStackTrace(); } catch (RecognitionException e) { e.printStackTrace(); } if (window != null) buffer.add(window); long now = QDateTime.currentMSecsSinceEpoch(); if (now - lastEmitted > 200 && !buffer.isEmpty()) { // push the queue every 200ms newDataVectorReady.emit(buffer); buffer = new Vector<PBFile>(); lastEmitted = now; } } if (!buffer.isEmpty()) { newDataVectorReady.emit(buffer); } }