System.out.println("Got event '" + codeToString(event.getCode()) + "'");
	public void run() {		while (thread == Thread.currentThread()) {			boolean eventPending = fam.pending();			if (!eventPending) {				try {					Thread.sleep(sleepInterval);				} catch (InterruptedException e) {				}				continue;			}			FAMEvent event = fam.nextEvent();			if (event == null) {				continue;			}			File f = new File(event.getFilename());			if (!f.exists())				f = new File(event.getUserdata() + "/" + event.getFilename());			System.out.println("Got event '" + codeToString(event.getCode()) + "'");			if (event.getCode() == FAM.Changed) {				// write event, used for files not directories since creating a				// directory				// doesnt fire this code..				System.out.println("Write: " + f.getAbsolutePath());				//if (FileUtility.isFileFormatSupport(f))					appendToQueue(f.getAbsolutePath());//				else//					System.out.println("File format not support, no need to watch it.");			}			if (event.getCode() == FAM.Deleted) {				// delete event'				System.out.println("Delete: " + f.getAbsolutePath());				// try to remove it as a dir, might not work if is a file				boolean success = removeDirectoryToMonitor(f.getAbsolutePath());				System.out.println("Deleted with success: " + success);			}			if (event.getCode() == FAM.Created) {				// called when ever a files is created, should be used for				// directories.				System.out.println("Make dir: " + f.getAbsolutePath());				if (f.isDirectory()) {					addDirectoryToMonitor(f.getAbsolutePath());				}				//								// System.out.println(".."+FAM.Acknowledge);				// System.out.println(".."+FAM.Changed);				// System.out.println(".."+FAM.Created);				// System.out.println(".."+FAM.Deleted);				// System.out.println(".."+FAM.EndExist);				// System.out.println(".."+FAM.Exists);				// System.out.println(".."+FAM.Moved);				// System.out.println(".."+FAM.StartExecuting);				// System.out.println(".."+FAM.StopExecuting);			}			if (event.getCode() == FAM.Exists) {				// check for sub dirs and create listener...				if (f.isDirectory() && !f.getAbsolutePath().equals(path)) {					addDirectoryToMonitor(f.getAbsolutePath());				}			}			if (event.getCode() == FAM.EndExist) {				// System.out.println("FAM.EndExist");			}		}	}