Class ReadWriteTask<T>


  • public abstract class ReadWriteTask<T>
    extends Object
    Use this class to help you concurrently access book model safely. Usage: implement your model-accessing logic in invoke() method.
    Since:
    3.5.0
    Author:
    dennis
    • Constructor Detail

      • ReadWriteTask

        public ReadWriteTask()
    • Method Detail

      • invoke

        public abstract T invoke()
        The method will be invoked after acquiring a read-write lock and release the lock after invocation. So implement your model-accessing logic in this method.
        Returns:
        depends on your logic
      • doInWriteLock

        public T doInWriteLock​(ReadWriteLock lock)
        Call invoke() after acquiring a write lock, and then release it.
      • doInReadLock

        public T doInReadLock​(ReadWriteLock lock)
        Call invoke() after acquiring a read lock, and then release it.