Class DBSemaphore

    • Constructor Detail

      • DBSemaphore

        public DBSemaphore​(java.lang.String tablePrefix,
                           java.lang.String schedName,
                           java.lang.String defaultSQL,
                           java.lang.String defaultInsertSQL)
    • Method Detail

      • getLog

        protected org.slf4j.Logger getLog()
      • executeSQL

        protected abstract void executeSQL​(java.sql.Connection conn,
                                           java.lang.String lockName,
                                           java.lang.String theExpandedSQL,
                                           java.lang.String theExpandedInsertSQL)
                                    throws LockException
        Execute the SQL that will lock the proper database row.
        Throws:
        LockException
      • obtainLock

        public boolean obtainLock​(java.sql.Connection conn,
                                  java.lang.String lockName)
                           throws LockException
        Grants a lock on the identified resource to the calling thread (blocking until it is available).
        Specified by:
        obtainLock in interface Semaphore
        Parameters:
        conn - Database connection used to establish lock. Can be null if Semaphore.requiresConnection() returns false.
        Returns:
        true if the lock was obtained.
        Throws:
        LockException
      • releaseLock

        public void releaseLock​(java.lang.String lockName)
        Release the lock on the identified resource if it is held by the calling thread.
        Specified by:
        releaseLock in interface Semaphore
      • isLockOwner

        public boolean isLockOwner​(java.lang.String lockName)
        Determine whether the calling thread owns a lock on the identified resource.
      • getSQL

        protected java.lang.String getSQL()
      • setSQL

        protected void setSQL​(java.lang.String sql)
      • setInsertSQL

        protected void setInsertSQL​(java.lang.String insertSql)
      • getSchedulerNameLiteral

        protected java.lang.String getSchedulerNameLiteral()
      • getSchedName

        public java.lang.String getSchedName()
      • getTablePrefix

        protected java.lang.String getTablePrefix()