Roman Kennke wrote:
What advantage do you expect from using java.util.concurrent.lock?
With this package, it is possible to obtain either write (exclusive) or read (shared) lock on the structure. The read lock can be granted to many threads at once, as long as the write lock is not granted. The methods that just read the component data (like getAlignmentX or getLocationOnScreen) could only ask for the read lock and work in parallel. Write lock can also be downgraded to the read lock as soon as the write access is no longer needed. While it is still uncommon to have many CPU's on desktop computer, many recent systems have two (SMP).

There are also fair locks, granting the lock for the thread that has been waiting for the longest time - in GUI these may also be applicable. I will not pretend being a great master of that package here, but I have used it several times and since then know that it does increase the performance.

Audrius.


Reply via email to