730 } else {
731 /* if can write to system root, use exclusive lock.
732 otherwise use shared lock. */
733 shared = !isSystemRootWritable;
734 }
735 synchronized (isUserNode()? userLockFile:systemLockFile) {
736 if (!lockFile(shared))
737 throw(new BackingStoreException("Couldn't get file lock."));
738 final Long newModTime =
739 AccessController.doPrivileged(
740 new PrivilegedAction<Long>() {
741 public Long run() {
742 long nmt;
743 if (isUserNode()) {
744 nmt = userRootModFile.lastModified();
745 isUserRootModified = userRootModTime == nmt;
746 } else {
747 nmt = systemRootModFile.lastModified();
748 isSystemRootModified = systemRootModTime == nmt;
749 }
750 return new Long(nmt);
751 }
752 });
753 try {
754 super.sync();
755 AccessController.doPrivileged(new PrivilegedAction<Void>() {
756 public Void run() {
757 if (isUserNode()) {
758 userRootModTime = newModTime.longValue() + 1000;
759 userRootModFile.setLastModified(userRootModTime);
760 } else {
761 systemRootModTime = newModTime.longValue() + 1000;
762 systemRootModFile.setLastModified(systemRootModTime);
763 }
764 return null;
765 }
766 });
767 } finally {
768 unlockFile();
769 }
770 }
|
730 } else {
731 /* if can write to system root, use exclusive lock.
732 otherwise use shared lock. */
733 shared = !isSystemRootWritable;
734 }
735 synchronized (isUserNode()? userLockFile:systemLockFile) {
736 if (!lockFile(shared))
737 throw(new BackingStoreException("Couldn't get file lock."));
738 final Long newModTime =
739 AccessController.doPrivileged(
740 new PrivilegedAction<Long>() {
741 public Long run() {
742 long nmt;
743 if (isUserNode()) {
744 nmt = userRootModFile.lastModified();
745 isUserRootModified = userRootModTime == nmt;
746 } else {
747 nmt = systemRootModFile.lastModified();
748 isSystemRootModified = systemRootModTime == nmt;
749 }
750 return nmt;
751 }
752 });
753 try {
754 super.sync();
755 AccessController.doPrivileged(new PrivilegedAction<Void>() {
756 public Void run() {
757 if (isUserNode()) {
758 userRootModTime = newModTime.longValue() + 1000;
759 userRootModFile.setLastModified(userRootModTime);
760 } else {
761 systemRootModTime = newModTime.longValue() + 1000;
762 systemRootModFile.setLastModified(systemRootModTime);
763 }
764 return null;
765 }
766 });
767 } finally {
768 unlockFile();
769 }
770 }
|