Class DenormalisedLockService

  • All Implemented Interfaces:
    org.springframework.beans.factory.DisposableBean

    public class DenormalisedLockService
    extends Object
    implements org.springframework.beans.factory.DisposableBean
    Allows to acquire DB locks. Could be useful to prevent parallel execution.
    Since:
    7.11.0
    • Constructor Detail

      • DenormalisedLockService

        public DenormalisedLockService​(com.atlassian.event.api.EventPublisher eventPublisher,
                                       org.hibernate.SessionFactory sessionFactory,
                                       org.springframework.transaction.PlatformTransactionManager transactionManager)
    • Method Detail

      • init

        @PostConstruct
        public void init()
      • acquireLockForTransaction

        public void acquireLockForTransaction​(DenormalisedLockService.LockName lockName)
        Acquires the lock. Must be called from an existing transaction. Released automatically when the transaction finishes
        Parameters:
        lockName - the name of the lock
      • onApplicationStarted

        @EventListener
        public void onApplicationStarted​(com.atlassian.config.lifecycle.events.ApplicationStartedEvent applicationStartedEvent)
      • destroy

        public void destroy()
                     throws Exception
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        Throws:
        Exception