File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes Synchronized access to System.properties Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Synchronized access to System.properties" Watch "Synchronized access to System.properties" New topic
Author

Synchronized access to System.properties

Femi Byte
Ranch Hand

Joined: Jul 09, 2004
Posts: 40

I need to write code where I'd like one thread to create a lock on a specific system property so that the thread can modify the value, allow an object it uses to access this value but prevent another thread from accessing this system property until the 1st thread returns. Is this possible, and if so, is it correct to do so?

Thanks in advance.
Alan Mehio
Ranch Hand

Joined: Apr 04, 2005
Posts: 70
allow an object it uses to access this value

Basically you want to prevent stale data i.e prevent the concurrent access to a system property value for write/read
The best think you can do is to synchronize or acquire the lock on the Object which access the system value

such as



Let me know your thoughts


Regards,
Alan Mehio
London, UK
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Synchronized access to System.properties
 
Similar Threads
Different behaviour in internationalization
Difference between -D and -X options while passing parameters to JVM.
setting user.dir system property in JBoss 5.1
System Property Setting and JVM
JVM encoding param to Tomcat Startup