Class InitializationLockHandler

java.lang.Object
de.hybris.platform.core.system.InitializationLockHandler
All Implemented Interfaces:
Serializable

public class InitializationLockHandler extends Object implements Serializable
Global initialization locking handler.

By now locking happens using one table inside the master tenant database containing one row that holds the current global initialization locking status.

This has some consequences:

  • only one instance if able to acquire that lock
  • only one tenant at a time may be initialized
See Also:
  • Constructor Details

  • Method Details

    • getLockInfo

      public InitializationLockInfo getLockInfo()
      Gives detailed init lock information.
    • isLocked

      public boolean isLocked()
      Tells whether init lock is being taken or not.
    • performLocked

      public boolean performLocked(Tenant forTenant, Callable<Boolean> operation, String message) throws Exception
      Allows to performs some operation while holding the init lock. After successful acquiring of the lock the operation is being performed and finally the lock is being released.
      Returns:
      false if lock could not be acquired and operation was not performed, true if lock had been acquired and operation had been performed.
      Throws:
      Exception - from given operation Callable
      See Also:
    • lock

      public boolean lock(Tenant forTenant, String message)
      Tries to acquires global lock. After this call no other cluster node will be able to acquire it until unlock(Tenant) had been called.

      Given message will be set as the purpose of lock it might be initialization/update of the platform.

      Please note that a lock can only be acquired once, so also no other thread on the same cluster node will be able to acquire it again!

      Returns:
      true if global lock had been taken, false otherwise
    • unlock

      public void unlock(Tenant forTenant)
      Releases acquired lock previously fetched via lock(Tenant, String). Only the cluster node acquiring it is able to do that!