APIdia Launch Partner
Top Description Inners Fields Constructors Methods
java.util.prefs

pack-priv Class FileSystemPreferences

extends AbstractPreferences
Class Inheritance
Imports
java.util.*, java.io.*, java.security.PrivilegedActionException, sun.util.logging.PlatformLogger

Preferences implementation for Unix. Preferences are stored in the file system, with one directory per preferences node. All of the preferences at each node are stored in a single file. Atomic file system operations (e.g. File.renameTo) are used to ensure integrity. An in-memory cache of the "explored" portion of the tree is maintained for performance, and written back to the disk periodically. File-locking is used to ensure reasonable behavior when multiple VMs are running at the same time. (The file lock is obtained only for sync(), flush() and removeNode().)
Author
Josh Bloch
Since
1.4
See Also
Preferences

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
FileSystemPreferences.Change

Represents a change to a preference.

private static class
FileSystemPreferences.NodeCreate

Represents the creation of this node.

private class
FileSystemPreferences.Put

Represents a preference put.

private class
FileSystemPreferences.Remove

Represents a preference remove.

Field Summary

Modifier and TypeField and Description
pack-priv final List<FileSystemPreferences.Change>
changeLog

A list of all uncommitted preference changes.

private final File
dir

The directory representing this preference node.

private static final int
EACCES

Unix error code for denied access.

private static final int
EAGAIN

Unix error code for locked file.

private static final String[]
private static final int
private static final int
INIT_SLEEP_TIME

Initial time between lock attempts, in ms.

private static boolean
private static boolean
private final boolean
private static boolean
isUserRootModified

Flag, which indicated whether userRoot was modified by another VM

private static boolean
private long
lastSyncTime

The last modification time of the file backing this node at the time that prefCache was last synchronized (or initially read).

private static final int
private static final int
MAX_ATTEMPTS

Maximum number of lock attempts.

pack-priv FileSystemPreferences.NodeCreate
nodeCreate

NodeCreate object for this node.

private Map<String, String>
prefsCache

Locally cached preferences for this node (includes uncommitted changes).

private final File
prefsFile

The file representing this preference node's preferences.

private static final int
SYNC_INTERVAL

Sync interval in seconds.

private static final Timer
pack-priv static File
systemLockFile

The lock file for the system tree.

private static volatile Preferences
systemRoot

The system root.

private static File
systemRootDir

Directory for system preferences.

private static int
systemRootLockHandle

Unix lock handle for systemRoot.

private static File
private static long
systemRootModTime

Keeps track of systemRoot modification time.

private final File
tmpFile

A temporary file used for saving changes to preferences.

private static final int
USER_READ_WRITE

Unix user write/read permission

private static final int
private static final int
private static final int
pack-priv static File
userLockFile

The lock file for the user tree.

private static volatile Preferences
userRoot

The user root.

private static File
userRootDir

Directory for user preferences.

private static int
userRootLockHandle

Unix lock handle for userRoot.

private static File
userRootModFile

File, which keeps track of global modifications of userRoot.

private static long
userRootModTime

Keeps track of userRoot modification time.

Inherited from java.util.prefs.AbstractPreferences:
CODE_POINT_U0000locknewNodeparent

Constructor Summary

AccessConstructor and Description
private
FileSystemPreferences(boolean user)

Special constructor for roots (both user and system).

private
FileSystemPreferences(FileSystemPreferences parent, String name)

Construct a new FileSystemPreferences instance with the specified parent node and name.

Method Summary

Modifier and TypeMethod and Description
private static void
private static byte[]
byteArray(String s)

Translate a string into a byte array by translating each character into two bytes, high-byte first ("big-endian").

private void
checkLockFile0ErrorCode(int errorCode)

Checks if unlockFile0() returned an error.

protected String[]
childrenNamesSpi()

Implements abstract java.util.prefs.AbstractPreferences.childrenNamesSpi.

Returns the names of the children of this preference node.

protected AbstractPreferences
childSpi(String name)

Implements abstract java.util.prefs.AbstractPreferences.childSpi.

Returns the named child of this preference node, creating it if it does not already exist.

private static native int
chmod(String fileName, int permission)

Changes UNIX file permissions.

private static String
dirName(String nodeName)

Returns the directory name corresponding to the specified node name.

public void
flush()

Overrides java.util.prefs.AbstractPreferences.flush.

Implements the flush method as per the specification in Preferences#flush().

protected void
flushSpi()

Implements abstract java.util.prefs.AbstractPreferences.flushSpi.

This method is invoked with this node locked.

private static PlatformLogger
getLogger()

Returns logger for error messages.

protected String
getSpi(String key)

Implements abstract java.util.prefs.AbstractPreferences.getSpi.

Return the value associated with the specified key at this preference node, or null if there is no association for this key, or the association cannot be determined at this time.

pack-priv static Preferences
pack-priv static Preferences
private void
initCacheIfNecessary()

Initialize prefsCache if it has yet to be initialized.

private static boolean
isDirChar(char ch)

Returns true if the specified character is appropriate for use in Unix directory names.

public boolean
isUserNode()

Overrides java.util.prefs.AbstractPreferences.isUserNode.

Implements the isUserNode method as per the specification in Preferences#isUserNode().

protected String[]
keysSpi()

Implements abstract java.util.prefs.AbstractPreferences.keysSpi.

Returns all of the keys that have an associated value in this preference node.

private void
loadCache()

Attempt to load prefsCache from the backing store.

private static void
private boolean
lockFile(boolean shared)

Try to acquire the appropriate file lock (user or system).

private static native int[]

Returns:

Returns a lock handle, used to unlock the file.
lockFile0
(String
Absolute file name of the lock file.
fileName
,
int permission, boolean shared)

Locks file using UNIX file locking.

private static String
nodeName(String dirName)

Returns the node name corresponding to the specified directory name.

protected void
putSpi(String key, String value)

Implements abstract java.util.prefs.AbstractPreferences.putSpi.

Put the given key-value association into this preference node.

public void
removeNode()

Overrides java.util.prefs.AbstractPreferences.removeNode.

Implements the removeNode() method as per the specification in Preferences#removeNode().

protected void
removeNodeSpi()

Implements abstract java.util.prefs.AbstractPreferences.removeNodeSpi.

Called with file lock held (in addition to node locks).

protected void
removeSpi(String key)

Implements abstract java.util.prefs.AbstractPreferences.removeSpi.

Remove the association (if any) for the specified key at this preference node.

private void
replayChanges()

Replay changeLog against prefsCache.

private static void
private static void
public synchronized void
sync()

Overrides java.util.prefs.AbstractPreferences.sync.

Implements the sync method as per the specification in Preferences#sync().

protected void
syncSpi()

Implements abstract java.util.prefs.AbstractPreferences.syncSpi.

This method is invoked with this node locked.

private static void
private void
unlockFile()

Release the appropriate file lock (user or system).

private static native int

Returns:

Returns zero if OK, UNIX error code if failure.
unlockFile0
(int
Handle to the file lock.
lockHandle
)

Unlocks file previously locked by lockFile0().

private void
writeBackCache()

Attempt to write back prefsCache to the backing store.

Inherited from java.util.prefs.AbstractPreferences:
absolutePathaddNodeChangeListeneraddPreferenceChangeListenercachedChildrenchildrenNamesclearexportNodeexportSubtreegetgetBooleangetByteArraygetChildgetDoublegetFloatgetIntgetLongisRemovedkeysnamenodenodeExistsnodeListenersparentprefListenersputputBooleanputByteArrayputDoubleputFloatputIntputLongremoveremoveNodeChangeListenerremovePreferenceChangeListenertoString

Field Detail

changeLogback to summary
pack-priv final List<FileSystemPreferences.Change> changeLog

A list of all uncommitted preference changes. The elements in this list are of type PrefChange. If this node is concurrently modified on disk by another VM, the two sets of changes are merged when this node is sync'ed by overwriting our prefsCache with the preference map last written out to disk (by the other VM), and then replaying this change log against that map. The resulting map is then written back to the disk.

dirback to summary
private final File dir

The directory representing this preference node. There is no guarantee that this directory exits, as another VM can delete it at any time that it (the other VM) holds the file-lock. While the root node cannot be deleted, it may not yet have been created, or the underlying directory could have been deleted accidentally.

EACCESback to summary
private static final int EACCES

Unix error code for denied access.

EAGAINback to summary
private static final int EAGAIN

Unix error code for locked file.

EMPTY_STRING_ARRAYback to summary
private static final String[] EMPTY_STRING_ARRAY

Hides java.util.prefs.AbstractPreferences.EMPTY_STRING_ARRAY.

ERROR_CODEback to summary
private static final int ERROR_CODE
INIT_SLEEP_TIMEback to summary
private static final int INIT_SLEEP_TIME

Initial time between lock attempts, in ms. The time is doubled after each failing attempt (except the first).

isSystemRootModifiedback to summary
private static boolean isSystemRootModified
isSystemRootWritableback to summary
private static boolean isSystemRootWritable
isUserNodeback to summary
private final boolean isUserNode
isUserRootModifiedback to summary
private static boolean isUserRootModified

Flag, which indicated whether userRoot was modified by another VM

isUserRootWritableback to summary
private static boolean isUserRootWritable
lastSyncTimeback to summary
private long lastSyncTime

The last modification time of the file backing this node at the time that prefCache was last synchronized (or initially read). This value is set *before* reading the file, so it's conservative; the actual timestamp could be (slightly) higher. A value of zero indicates that we were unable to initialize prefsCache from the disk, or have not yet attempted to do so. (If prefsCache is non-null, it indicates the former; if it's null, the latter.)

LOCK_HANDLEback to summary
private static final int LOCK_HANDLE
MAX_ATTEMPTSback to summary
private static final int MAX_ATTEMPTS

Maximum number of lock attempts.

nodeCreateback to summary
pack-priv FileSystemPreferences.NodeCreate nodeCreate

NodeCreate object for this node.

prefsCacheback to summary
private Map<String, String> prefsCache

Locally cached preferences for this node (includes uncommitted changes). This map is initialized with from disk when the first get or put operation occurs on this node. It is synchronized with the corresponding disk file (prefsFile) by the sync operation. The initial value is read *without* acquiring the file-lock.

prefsFileback to summary
private final File prefsFile

The file representing this preference node's preferences. The file format is undocumented, and subject to change from release to release, but I'm sure that you can figure it out if you try real hard.

SYNC_INTERVALback to summary
private static final int SYNC_INTERVAL

Sync interval in seconds.

syncTimerback to summary
private static final Timer syncTimer
systemLockFileback to summary
pack-priv static File systemLockFile

The lock file for the system tree.

systemRootback to summary
private static volatile Preferences systemRoot

The system root.

systemRootDirback to summary
private static File systemRootDir

Directory for system preferences.

systemRootLockHandleback to summary
private static int systemRootLockHandle

Unix lock handle for systemRoot. Zero, if unlocked.

systemRootModFileback to summary
private static File systemRootModFile
systemRootModTimeback to summary
private static long systemRootModTime

Keeps track of systemRoot modification time. This time is reset to zero after system reboot, and is increased by 1 second each time systemRoot is modified.

tmpFileback to summary
private final File tmpFile

A temporary file used for saving changes to preferences. As part of the sync operation, changes are first saved into this file, and then atomically renamed to prefsFile. This results in an atomic state change from one valid set of preferences to another. The file-lock is held for the duration of this transformation.

USER_READ_WRITEback to summary
private static final int USER_READ_WRITE

Unix user write/read permission

USER_RW_ALL_READback to summary
private static final int USER_RW_ALL_READ
USER_RWXback to summary
private static final int USER_RWX
USER_RWX_ALL_RXback to summary
private static final int USER_RWX_ALL_RX
userLockFileback to summary
pack-priv static File userLockFile

The lock file for the user tree.

userRootback to summary
private static volatile Preferences userRoot

The user root.

userRootDirback to summary
private static File userRootDir

Directory for user preferences.

userRootLockHandleback to summary
private static int userRootLockHandle

Unix lock handle for userRoot. Zero, if unlocked.

userRootModFileback to summary
private static File userRootModFile

File, which keeps track of global modifications of userRoot.

userRootModTimeback to summary
private static long userRootModTime

Keeps track of userRoot modification time. This time is reset to zero after UNIX reboot, and is increased by 1 second each time userRoot is modified.

Constructor Detail

FileSystemPreferencesback to summary
private FileSystemPreferences(boolean user)

Special constructor for roots (both user and system). This constructor will only be called twice, by the static initializer.

FileSystemPreferencesback to summary
private FileSystemPreferences(FileSystemPreferences parent, String name)

Construct a new FileSystemPreferences instance with the specified parent node and name. This constructor, called from childSpi, is used to make every node except for the two //roots.

Method Detail

addShutdownHookback to summary
private static void addShutdownHook()
byteArrayback to summary
private static byte[] byteArray(String s)

Translate a string into a byte array by translating each character into two bytes, high-byte first ("big-endian").

checkLockFile0ErrorCodeback to summary
private void checkLockFile0ErrorCode(int errorCode) throws SecurityException

Checks if unlockFile0() returned an error. Throws a SecurityException, if access denied. Logs a warning otherwise.

childrenNamesSpiback to summary
protected String[] childrenNamesSpi()

Implements abstract java.util.prefs.AbstractPreferences.childrenNamesSpi.

Doc from java.util.prefs.AbstractPreferences.childrenNamesSpi.

Returns the names of the children of this preference node. (The returned array will be of size zero if this node has no children.) This method need not return the names of any nodes already cached, but may do so without harm.

This method is invoked with the lock on this node held.

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing childrenNames() invocation.

childSpiback to summary
protected AbstractPreferences childSpi(String name)

Implements abstract java.util.prefs.AbstractPreferences.childSpi.

Doc from java.util.prefs.AbstractPreferences.childSpi.

Returns the named child of this preference node, creating it if it does not already exist. It is guaranteed that name is non-null, non-empty, does not contain the slash character ('/'), and is no longer than MAX_NAME_LENGTH characters. Also, it is guaranteed that this node has not been removed. (The implementor needn't check for any of these things.)

Finally, it is guaranteed that the named node has not been returned by a previous invocation of this method or getChild(String) after the last time that it was removed. In other words, a cached value will always be used in preference to invoking this method. Subclasses need not maintain their own cache of previously returned children.

The implementer must ensure that the returned node has not been removed. If a like-named child of this node was previously removed, the implementer must return a newly constructed AbstractPreferences node; once removed, an AbstractPreferences node cannot be "resuscitated."

If this method causes a node to be created, this node is not guaranteed to be persistent until the flush method is invoked on this node or one of its ancestors (or descendants).

This method is invoked with the lock on this node held.

chmodback to summary
private static native int chmod(String fileName, int permission)

Changes UNIX file permissions.

dirNameback to summary
private static String dirName(String nodeName)

Returns the directory name corresponding to the specified node name. Generally, this is just the node name. If the node name includes inappropriate characters (as per isDirChar) it is translated to Base64. with the underscore character ('_', 0x5f) prepended.

flushback to summary
public void flush() throws BackingStoreException

Overrides java.util.prefs.AbstractPreferences.flush.

Doc from java.util.prefs.AbstractPreferences.flush.

Implements the flush method as per the specification in Preferences#flush().

This implementation calls a recursive helper method that locks this node, invokes flushSpi() on it, unlocks this node, and recursively invokes this method on each "cached child." A cached child is a child of this node that has been created in this VM and not subsequently removed. In effect, this method does a depth first traversal of the "cached subtree" rooted at this node, calling flushSpi() on each node in the subTree while only that node is locked. Note that flushSpi() is invoked top-down.

If this method is invoked on a node that has been removed with the removeNode() method, flushSpi() is invoked on this node, but not on others.

Exceptions
BackingStoreException:
if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
flushSpiback to summary
protected void flushSpi() throws BackingStoreException

Implements abstract java.util.prefs.AbstractPreferences.flushSpi.

Doc from java.util.prefs.AbstractPreferences.flushSpi.

This method is invoked with this node locked. The contract of this method is to force any cached changes in the contents of this preference node to the backing store, guaranteeing their persistence. (It is perfectly possible that this node does not exist on the backing store, either because it has been deleted by another VM, or because it has not yet been created.) Note that this method should not flush the preferences in any subnodes of this node. If the backing store naturally flushes an entire subtree at once, the implementer is encouraged to override flush(), rather than merely overriding this method.

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing flush() invocation.

Exceptions
BackingStoreException:
if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
getLoggerback to summary
private static PlatformLogger getLogger()

Returns logger for error messages. Backing store exceptions are logged at WARNING level.

getSpiback to summary
protected String getSpi(String key)

Implements abstract java.util.prefs.AbstractPreferences.getSpi.

Doc from java.util.prefs.AbstractPreferences.getSpi.

Return the value associated with the specified key at this preference node, or null if there is no association for this key, or the association cannot be determined at this time. It is guaranteed that key is non-null. Also, it is guaranteed that this node has not been removed. (The implementor needn't check for either of these things.)

Generally speaking, this method should not throw an exception under any circumstances. If, however, if it does throw an exception, the exception will be intercepted and treated as a null return value.

This method is invoked with the lock on this node held.

getSystemRootback to summary
pack-priv static Preferences getSystemRoot()
getUserRootback to summary
pack-priv static Preferences getUserRoot()
initCacheIfNecessaryback to summary
private void initCacheIfNecessary()

Initialize prefsCache if it has yet to be initialized. When this method returns, prefsCache will be non-null. If the data was successfully read from the file, lastSyncTime will be updated. If prefsCache was null, but it was impossible to read the file (because it didn't exist or for any other reason) prefsCache will be initialized to an empty, modifiable Map, and lastSyncTime remain zero.

isDirCharback to summary
private static boolean isDirChar(char ch)

Returns true if the specified character is appropriate for use in Unix directory names. A character is appropriate if it's a printable ASCII character (> 0x1f && < 0x7f) and unequal to slash ('/', 0x2f), dot ('.', 0x2e), or underscore ('_', 0x5f).

isUserNodeback to summary
public boolean isUserNode()

Overrides java.util.prefs.AbstractPreferences.isUserNode.

Doc from java.util.prefs.AbstractPreferences.isUserNode.

Implements the isUserNode method as per the specification in Preferences#isUserNode().

This implementation compares this node's root node (which is stored in a private field) with the value returned by Preferences#userRoot(). If the two object references are identical, this method returns true.

keysSpiback to summary
protected String[] keysSpi()

Implements abstract java.util.prefs.AbstractPreferences.keysSpi.

Doc from java.util.prefs.AbstractPreferences.keysSpi.

Returns all of the keys that have an associated value in this preference node. (The returned array will be of size zero if this node has no preferences.) It is guaranteed that this node has not been removed.

This method is invoked with the lock on this node held.

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing keys() invocation.

loadCacheback to summary
private void loadCache() throws BackingStoreException

Attempt to load prefsCache from the backing store. If the attempt succeeds, lastSyncTime will be updated (the new value will typically correspond to the data loaded into the map, but it may be less, if another VM is updating this node concurrently). If the attempt fails, a BackingStoreException is thrown and both prefsCache and lastSyncTime are unaffected by the call.

loadPrefsLibback to summary
private static void loadPrefsLib()
Annotations
@SuppressWarnings:restricted
lockFileback to summary
private boolean lockFile(boolean shared) throws SecurityException

Try to acquire the appropriate file lock (user or system). If the initial attempt fails, several more attempts are made using an exponential backoff strategy. If all attempts fail, this method returns false.

Exceptions
SecurityException:
if file access denied.
lockFile0back to summary
private static native int[] lockFile0(String fileName, int permission, boolean shared)

Locks file using UNIX file locking.

Parameters
fileName:String

Absolute file name of the lock file.

Returns:int[]

Returns a lock handle, used to unlock the file.

nodeNameback to summary
private static String nodeName(String dirName)

Returns the node name corresponding to the specified directory name. (Inverts the transformation of dirName(String).

putSpiback to summary
protected void putSpi(String key, String value)

Implements abstract java.util.prefs.AbstractPreferences.putSpi.

Doc from java.util.prefs.AbstractPreferences.putSpi.

Put the given key-value association into this preference node. It is guaranteed that key and value are non-null and of legal length. Also, it is guaranteed that this node has not been removed. (The implementor needn't check for any of these things.)

This method is invoked with the lock on this node held.

removeNodeback to summary
public void removeNode() throws BackingStoreException

Overrides java.util.prefs.AbstractPreferences.removeNode.

Doc from java.util.prefs.AbstractPreferences.removeNode.

Implements the removeNode() method as per the specification in Preferences#removeNode().

This implementation checks to see that this node is the root; if so, it throws an appropriate exception. Then, it locks this node's parent, and calls a recursive helper method that traverses the subtree rooted at this node. The recursive method locks the node on which it was called, checks that it has not already been removed, and then ensures that all of its children are cached: The childrenNamesSpi() method is invoked and each returned child name is checked for containment in the child-cache. If a child is not already cached, the childSpi(String) method is invoked to create a Preferences instance for it, and this instance is put into the child-cache. Then the helper method calls itself recursively on each node contained in its child-cache. Next, it invokes removeNodeSpi(), marks itself as removed, and removes itself from its parent's child-cache. Finally, if there are any node change listeners, it enqueues a notification event for processing by the event dispatch thread.

Note that the helper method is always invoked with all ancestors up to the "closest non-removed ancestor" locked.

Exceptions
BackingStoreException:
if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
removeNodeSpiback to summary
protected void removeNodeSpi() throws BackingStoreException

Implements abstract java.util.prefs.AbstractPreferences.removeNodeSpi.

Called with file lock held (in addition to node locks).

Exceptions
BackingStoreException:

Doc from java.util.prefs.AbstractPreferences.removeNodeSpi.

if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.

removeSpiback to summary
protected void removeSpi(String key)

Implements abstract java.util.prefs.AbstractPreferences.removeSpi.

Doc from java.util.prefs.AbstractPreferences.removeSpi.

Remove the association (if any) for the specified key at this preference node. It is guaranteed that key is non-null. Also, it is guaranteed that this node has not been removed. (The implementor needn't check for either of these things.)

This method is invoked with the lock on this node held.

replayChangesback to summary
private void replayChanges()

Replay changeLog against prefsCache.

setupSystemRootback to summary
private static void setupSystemRoot()
setupUserRootback to summary
private static void setupUserRoot()
syncback to summary
public synchronized void sync() throws BackingStoreException

Overrides java.util.prefs.AbstractPreferences.sync.

Doc from java.util.prefs.AbstractPreferences.sync.

Implements the sync method as per the specification in Preferences#sync().

This implementation calls a recursive helper method that locks this node, invokes syncSpi() on it, unlocks this node, and recursively invokes this method on each "cached child." A cached child is a child of this node that has been created in this VM and not subsequently removed. In effect, this method does a depth first traversal of the "cached subtree" rooted at this node, calling syncSpi() on each node in the subTree while only that node is locked. Note that syncSpi() is invoked top-down.

Exceptions
BackingStoreException:
if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
syncSpiback to summary
protected void syncSpi() throws BackingStoreException

Implements abstract java.util.prefs.AbstractPreferences.syncSpi.

Doc from java.util.prefs.AbstractPreferences.syncSpi.

This method is invoked with this node locked. The contract of this method is to synchronize any cached preferences stored at this node with any stored in the backing store. (It is perfectly possible that this node does not exist on the backing store, either because it has been deleted by another VM, or because it has not yet been created.) Note that this method should not synchronize the preferences in any subnodes of this node. If the backing store naturally syncs an entire subtree at once, the implementer is encouraged to override sync(), rather than merely overriding this method.

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing sync() invocation.

Exceptions
BackingStoreException:
if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
syncWorldback to summary
private static void syncWorld()
unlockFileback to summary
private void unlockFile()

Release the appropriate file lock (user or system).

Exceptions
SecurityException:
if file access denied.
unlockFile0back to summary
private static native int unlockFile0(int lockHandle)

Unlocks file previously locked by lockFile0().

Parameters
lockHandle:int

Handle to the file lock.

Returns:int

Returns zero if OK, UNIX error code if failure.

writeBackCacheback to summary
private void writeBackCache() throws BackingStoreException

Attempt to write back prefsCache to the backing store. If the attempt succeeds, lastSyncTime will be updated (the new value will correspond exactly to the data thust written back, as we hold the file lock, which prevents a concurrent write. If the attempt fails, a BackingStoreException is thrown and both the backing store (prefsFile) and lastSyncTime will be unaffected by this call. This call will NEVER leave prefsFile in a corrupt state.

java.util.prefs back to summary

private abstract Class FileSystemPreferences.Change

extends Object
Class Inheritance
Known Direct Subclasses
java.util.prefs.FileSystemPreferences.Put, java.util.prefs.FileSystemPreferences.Remove, java.util.prefs.FileSystemPreferences.NodeCreate

Represents a change to a preference.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
replay()

Reapplies the change to prefsCache.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Changeback to summary
private Change()

Method Detail

replayback to summary
pack-priv abstract void replay()

Reapplies the change to prefsCache.

java.util.prefs back to summary

private Class FileSystemPreferences.NodeCreate

extends Change
Class Inheritance

Represents the creation of this node.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv void
replay()

Implements abstract java.util.prefs.FileSystemPreferences.Change.replay.

Performs no action, but the presence of this object in changeLog will force the node and its ancestors to be made permanent at the next sync.

Constructor Detail

NodeCreateback to summary
private NodeCreate()

Method Detail

replayback to summary
pack-priv void replay()

Implements abstract java.util.prefs.FileSystemPreferences.Change.replay.

Performs no action, but the presence of this object in changeLog will force the node and its ancestors to be made permanent at the next sync.

java.util.prefs back to summary

private Class FileSystemPreferences.Put

extends Change
Class Inheritance

Represents a preference put.

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv String

Constructor Summary

AccessConstructor and Description
pack-priv
Put(String key, String value)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
replay()

Implements abstract java.util.prefs.FileSystemPreferences.Change.replay.

Reapplies the change to prefsCache.

Field Detail

keyback to summary
pack-priv String key
valueback to summary
pack-priv String value

Constructor Detail

Putback to summary
pack-priv Put(String key, String value)

Method Detail

replayback to summary
pack-priv void replay()

Implements abstract java.util.prefs.FileSystemPreferences.Change.replay.

Doc from java.util.prefs.FileSystemPreferences.Change.replay.

Reapplies the change to prefsCache.

java.util.prefs back to summary

private Class FileSystemPreferences.Remove

extends Change
Class Inheritance

Represents a preference remove.

Field Summary

Modifier and TypeField and Description
pack-priv String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
replay()

Implements abstract java.util.prefs.FileSystemPreferences.Change.replay.

Reapplies the change to prefsCache.

Field Detail

keyback to summary
pack-priv String key

Constructor Detail

Removeback to summary
pack-priv Remove(String key)

Method Detail

replayback to summary
pack-priv void replay()

Implements abstract java.util.prefs.FileSystemPreferences.Change.replay.

Doc from java.util.prefs.FileSystemPreferences.Change.replay.

Reapplies the change to prefsCache.