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
posted
0
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.