Class TsFileLock


  • public class TsFileLock
    extends java.lang.Object
    TsFileLock is a special read-write lock that can be locked by one thread but unlocked by another thread.

    When the query thread crashes, the locks it used can no longer be unlocked by itself and another thread must do the unlock for it. Unfortunately, normal Java ReentrantLock can only be unlocked by the thread which locked it, so we have to use a different implementation. It is also interesting to use a third-party implementation and if you do find a better one, please submit an issue on our website.

    WARNING: as the lock holder is not recorded, the caller must assure that lock() and unlock() match, i.e., if you only call lock() once then do not call unlock() more than once and vice versa.

    • Constructor Detail

      • TsFileLock

        public TsFileLock()
    • Method Detail

      • readLock

        public void readLock()
      • readUnlock

        public void readUnlock()
      • writeLock

        public void writeLock()
      • writeUnlock

        public void writeUnlock()
      • tryWriteLock

        public boolean tryWriteLock()
      • tryReadLock

        public boolean tryReadLock()