My file structure has a symlink to the directory / home / me / myDir → / some / other / dir. This link is updated by another process and notifies my process. After notification, I try to get a new canonical path:
public static String getPath() { File file = new File("/home/me/myDir"); if(file.exists()) { try { String canonical = file.getCanonicalPath(); return canonical; } catch ... }
}
The problem is that after the link has been changed (I checked its changes), it takes 3-5 times to call the above getPath () method to actually get the new path before the previous path is returned. The only thing I can think of is that java can optimize this method and return the old path. Any ideas or insights are greatly appreciated.
brad12s
source share