- java.lang.Object
-
- org.snmp4j.agent.mo.lock.DefaultMOLockStrategy
-
- All Implemented Interfaces:
MOLockStrategy
public class DefaultMOLockStrategy extends java.lang.Object implements MOLockStrategy
TheDefaultMOLockStrategy
implements a simple default locking strategy that requires a lock if a write access on aManagedObject
is intended or if the managed object accessed is an instance ofUpdatableManagedObject
. 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 Summary
Constructors Constructor Description DefaultMOLockStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isLockNeeded(ManagedObject managedObjectLookedUp, MOQuery query)
Check if the server access to the provided managed object needs a lock.
-
-
-
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 interfaceMOLockStrategy
- 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 withMOQuery.isWriteAccessQuery()
whether a write access is intended or not.- Returns:
true
if a lock is required to access the provided managed object,false
otherwise.
-
-