Hi...
I was working with the Preferences class, and I was wondering about the
importPreferences method. Specifically, after you do an
importPreferences, do the elements loaded get kept in the runtime space
and used for later prefs.node() calls and the like?
Or are they persisted to the backing store right away and all pref
fetching operations operate from the backing store?
The sun doc page on it says "This method is an exception to the general
rule that the results of concurrently executing multiple methods in
this class yields results equivalent to some serial execution. The
method behaves as if implemented on top of the other public methods in
this class, notably node(String) and put(String, String)." which
doesn't seem clear to me. What do they mean by "on top of."
I would expect that node() and put()s followed by gets would be working
from in-memory copies, as those methods don't say when they get flushed
to the backing store. The fact that flush() exists implies that
there's potentially some kind of disconnect between the two. I'd also
imagine that once fetched, re-fetches come from memory instead of the
backing store.
But importPreferences() is such a wholesale operation, I wasn't sure
what would happen there.
Thanks
-Mark
Manish Pandit - 29 Sep 2006 04:33 GMT
Hi,
You can look at the source as a part of src.zip that came with your
JDK. Based on my understanding of the code, I did not see the imported
prefs being flushed. The method reads the XML, parses it out, and does
a 'put' with no calls to flush() whatsoever. So I guess you've to
explicitly call flush after the import. And yes - the prefs are
available in memory after import.
-cheers,
Manish