private void process ( Path dir , Path file , WatchEvent . Kind < ? > evtType ) throws TTException , IOException , InterruptedException { // LOGGER.info("Processing " + file.getFileName() + " with event " // + evtType); IFilelistenerWriteTrx trx = null ; String rootPath = getListenerRootPath ( dir ) ; String relativePath = file . toFile ( ) . getAbsolutePath ( ) ; relativePath = relativePath . substring ( getListenerRootPath ( dir ) . length ( ) , relativePath . length ( ) ) ; for ( Entry < String , String > e : mFilelistenerToPaths . entrySet ( ) ) { if ( e . getValue ( ) . equals ( getListenerRootPath ( dir ) ) ) { trx = mTrx . get ( e . getKey ( ) ) ; } } if ( file . toFile ( ) . isDirectory ( ) ) { if ( evtType == ENTRY_CREATE ) { addSubDirectory ( dir , file ) ; return ; } else if ( evtType == ENTRY_DELETE ) { for ( String s : trx . getFilePaths ( ) ) { if ( s . contains ( relativePath ) ) { trx . removeFile ( s ) ; } } } } else { // if (mLockedFiles.get(rootPath + File.separator // + file.toFile().getName()) != null) { // if (mLockedFiles.get( // rootPath + File.separator + file.toFile().getName()) // .isFinished()) { // ExecutorService s = mExecutorMap // .get(getListenerRootPath(dir)); // if (s != null && !s.isShutdown()) { // // FilesystemNotification n = new FilesystemNotification( // file.toFile(), relativePath, rootPath, evtType, // trx); // if (mObserver != null) { // n.addObserver(mObserver); // } // mFsnOnHold.remove(rootPath + File.separator // + file.toFile().getName()); // mLockedFiles.put(rootPath + File.separator // + file.toFile().getName(), n); // s.submit(n); // } // } else { // FilesystemNotification n = new FilesystemNotification( // file.toFile(), relativePath, rootPath, evtType, trx); // if (mObserver != null) { // n.addObserver(mObserver); // } // mFsnOnHold.put(rootPath + File.separator // + file.toFile().getName(), n); // } // } else { ExecutorService s = mExecutorMap . get ( getListenerRootPath ( dir ) ) ; if ( s != null && ! s . isShutdown ( ) ) { FilesystemNotification n = new FilesystemNotification ( file . toFile ( ) , relativePath , rootPath , evtType , trx ) ; if ( mObserver != null ) { n . addObserver ( mObserver ) ; } // mLockedFiles.put(rootPath + File.separator // + file.toFile().getName(), n); s . submit ( n ) ; // } } } }
This method is used to process the file system modifications .