Back to project page HapiPodcastJ.
The source code is released under:
GNU General Public License
If you think the Android project HapiPodcastJ listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package info.xuluan.podcast.utils; //from www . j a v a 2 s. co m import java.util.concurrent.locks.ReentrantReadWriteLock; public class LockHandler { private ReentrantReadWriteLock lock; private Boolean status; public LockHandler() { lock = new ReentrantReadWriteLock(); status = false; } public boolean getStatus() { return status; } public boolean locked() { lock.readLock().lock(); if (status) { lock.readLock().unlock(); return false; } lock.readLock().unlock(); lock.writeLock().lock(); status = true; lock.writeLock().unlock(); return true; } public void release() { lock.writeLock().lock(); status = false; lock.writeLock().unlock(); } }