Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

java.util.prefs.Preferences question

Thread view: 
Me - 28 Sep 2006 14:54 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.