public synchronized void stop() throws IOException { if (worker == null) { throw new IllegalStateException("FileSystemWatcher is not started."); // NOI18N } assert rtData != null; assert rtData.length == 2; assert rtData[0] != null; assert rtData[1] != null; cs.FSEventStreamStop(rtData[0]); cs.FSEventStreamInvalidate(rtData[0]); cs.FSEventStreamRelease(rtData[0]); cf.CFRunLoopStop(rtData[1]); worker.shutdown(); worker = null; rtData = null; }