private void registerToSubTree(boolean isRoot, WatchData parentWatch, File root, boolean fireCreatedEvents) throws JNotifyException
	{
		if (!parentWatch._user)
		{
			throw new RuntimeException("!parentWatch._user");
		}

		// make sure user really requested to be notified on this event.
		// (in case of recursive listening, this IN_CREATE flag is always on, even if
		// the user is not interester in creation events).
		if (fireCreatedEvents && (parentWatch._mask & JNotify.FILE_CREATED) != 0)
		{
			String name = root.toString().substring(parentWatch._path.length()+1);
			parentWatch.notifyFileCreated(name);
		}

		
		if (root.isDirectory())
		{
			// root was already registered by the calling method.
			if (!isRoot)
			{
				try
				{
					createWatch(parentWatch, false, root, parentWatch._mask, parentWatch._linuxMask, parentWatch._watchSubtree, parentWatch._listener);
				}
				catch (JNotifyException e)
				{
					if (e.getErrorCode() == JNotifyException.ERROR_WATCH_LIMIT_REACHED)
						JNotify_linux.warn("JNotifyAdapterLinux.registerToSubTree : warning, failed to register " + root + " :" + e.getMessage());
					{
						throw e;
					}
					// else, on any other error, try subtree anyway..
				}
			}
			
			String files[] = root.list();
			if (files != null)
			{
				for (int i = 0; i < files.length; i++)
				{
					String file = files[i];
					registerToSubTree(false, parentWatch, new File(root, file), fireCreatedEvents);
				}
			}
		}
	}