Class DefaultMOLockStrategy

  • All Implemented Interfaces:
    MOLockStrategy


    public class DefaultMOLockStrategy
    extends Object
    implements MOLockStrategy
    The DefaultMOLockStrategy implements a simple default locking strategy that requires a lock if a write access on a ManagedObject is intended or if the managed object accessed is an instance of UpdatableManagedObject. A managed object server that uses this lock strategy ensures that two concurrently received SET requests will not modify the same managed object at the same time with probably undefined result. In addition, managed objects that need to be updated regularly are protected against access while
    Since:
    2.4.0
    Author:
    Frank Fock
    • Constructor Detail

      • DefaultMOLockStrategy

        public DefaultMOLockStrategy​()
    • Method Detail

      • isLockNeeded

        public boolean isLockNeeded​(ManagedObject<?> managedObjectLookedUp,
                                    MOQuery query)
        Description copied from interface: MOLockStrategy
        Check if the server access to the provided managed object needs a lock.
        Specified by:
        isLockNeeded in interface MOLockStrategy
        Parameters:
        managedObjectLookedUp - the ManagedObject instance that is looked up and potentially accessed.
        query - the query on which behalf the lookup took place. It also signals with MOQuery.isWriteAccessQuery() whether a write access is intended or not.
        Returns:
        true if a lock is required to access the provided managed object, false otherwise.