コード例 #1
0
  private void releaseExecutorLock(String lockToken) {
    if (lockToken != null) {
      try {
        alfrescoJobExecutor.getJobLockService().releaseLock(lockToken, LOCK_QNAME);

        if (logger.isTraceEnabled()) {
          logger.trace(Thread.currentThread().getName() + " released lock token: " + lockToken);
        }
      } catch (LockAcquisitionException e) {
        if (logger.isTraceEnabled()) {
          logger.trace(
              "Failed to release Alfresco Job Executor lock - may no longer exist ("
                  + lockToken
                  + ")");
        }
        throw e;
      }
    }
  }
コード例 #2
0
  private String getExecutorLock() {
    String lockToken = null;

    if (alfrescoJobExecutor.getJobExecutorLockEnabled()) {
      try {
        lockToken =
            alfrescoJobExecutor.getJobLockService().getLock(LOCK_QNAME, jobLockTTL, 3000, 10);

        if (logger.isTraceEnabled()) {
          logger.trace(Thread.currentThread().getName() + " got lock token: " + lockToken);
        }
      } catch (LockAcquisitionException e) {
        if (logger.isTraceEnabled()) {
          logger.trace(
              "Failed to get Alfresco Job Executor lock - may already running in another thread");
        }
        throw e;
      }
    }

    return lockToken;
  }