mardi 23 décembre 2014

Java writeLock()


How to determine if writeLock section is already busy? I mean I have multi-thrad application and many users use the same object. But only one users has an access for writing.


Similiar code:



ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
readWriteLock.writeLock().lock();
...
...
...
readWriteLock.writeLock().unlock();
...


If write section is busy I must return null so how to determine if that section is already in use?





Aucun commentaire:

Enregistrer un commentaire