java.lang.Object
org.snmp4j.agent.mo.lock.DefaultMOLockStrategy
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isLockNeeded
(ManagedObject<?> managedObjectLookedUp, MOQuery query) Check if the server access to the provided managed object needs a lock.
-
Constructor Details
-
DefaultMOLockStrategy
public DefaultMOLockStrategy()
-
-
Method Details
-
isLockNeeded
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.
-