- All Implemented Interfaces:
MOServer
- Version:
- 3.1.0
- Author:
- Frank Fock
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addContext
(org.snmp4j.smi.OctetString context) Adds the supplied context to the server.void
Adds a context listener to the server.void
addLookupListener
(MOServerLookupListener listener, ManagedObject<?> mo) Adds a managed object lookup listener for the supplied managed object to this managed object server.protected void
checkForUpdate
(UpdatableManagedObject<?> mo, MOQuery query) ChecksupdateStrategy
whether the queried managed object needs to be updated.protected void
fireContextChanged
(ContextEvent event) protected void
fireLookupEvent
(ManagedObject<?> mo, MOServerLookupEvent event) protected void
fireQueryEvent
(ManagedObject<?> mo, MOServerLookupEvent event) Returns a readonly set of activeLockRequest
s or an empty set ifisDeadlockPreventionEnabled()
isfalse
.org.snmp4j.smi.OctetString[]
Returns the contexts known by the server.Return the locking strategy for this server.getManagedObject
(org.snmp4j.smi.OID key, org.snmp4j.smi.OctetString context) Returns theManagedObject
with the specifiedOID
as ID returned byRegisteredManagedObject.getID()
or the lower bound (regardless whether the ManagedObject's scope includes it or not) when registered in the supplied context.getManagedObject
(org.snmp4j.smi.OID key, org.snmp4j.smi.OctetString context, boolean fireLookupEvents) Returns theManagedObject
with the specifiedOID
as ID returned byRegisteredManagedObject.getID()
or the lower bound (regardless whether the ManagedObject's scope includes it or not) when registered in the supplied context.org.snmp4j.smi.OctetString[]
getRegisteredContexts
(ManagedObject<?> managedObject) Returns the contexts for which the suppliedManagedObject
has been registered.getRegisteredScopes
(ManagedObject<?> managedObject) Returns the scopesMOScope
orMOContextScope
for which the suppliedManagedObject
has been registered in a map indexed by context.Gets the update strategy forUpdatableManagedObject
s.static org.snmp4j.smi.Variable
Returns the value of a particular MIB object instance using theManagedObjectValueAccess
interface.Returns a readonly map of waitingLockRequest
s and their locks or an empty set ifisDeadlockPreventionEnabled()
isfalse
.boolean
isContextSupported
(org.snmp4j.smi.OctetString context) Checks whether the supplied context is supported (registered) by this server.boolean
Returnstrue
if thelookup(MOQuery, LockRequest, MOServerLookupEvent, Class)
method uses deadlock prevention using a super thread, if a deadlock situation is detected (i.e., waitingLockRequest
s equal activeLockRequest
s.iterator()
Return a read-onlyIterator
over the content of this server.iterator
(Comparator<MOScope> comparator, MOFilter moFilter) Return anIterator
on the registeredManagedObject
s of this server in order defined by the given comparator and filtered.boolean
lock
(Object owner, ManagedObject<?> managedObject) Locks a ManagedObject by the supplied owner.boolean
lock
(Object owner, ManagedObject<?> managedObject, long timeoutMillis) Locks a ManagedObject by the supplied owner.boolean
lock
(Object owner, ManagedObject<?> managedObject, long timeoutMillis, LockRequest lockRequest) Lookup the first (lexicographically ordered) managed object that matches the supplied query.<MO extends ManagedObject<?>>
MOlookup
(MOQuery query, LockRequest lockRequest, MOServerLookupEvent lookupEvent, Class<MO> managedObjectType) Lookup the first (lexicographically ordered) managed object that matches the supplied query and implements the givenManagedObject
class.void
register
(ManagedObject<?> mo, org.snmp4j.smi.OctetString context) Registers a managed object for the specified context.static void
registerChangeListener
(MOServer server, MOChangeListener listener, MOFilter moFilter) Register a singleMOChangeListener
with all objects matching the given filter in the specifiedMOServer
.static <R extends MOTableRow,
T extends MOTable<R, ? extends MOColumn, ? extends MOTableModel<R>>>
voidregisterTableRowListener
(MOServer server, MOTableRowListener<R> listener) Register a singleMOTableRowListener
with all tables in the specifiedMOServer
.void
removeContext
(org.snmp4j.smi.OctetString context) Removes a context from the server.void
Removes a previously added context listener.boolean
removeLookupListener
(MOServerLookupListener listener, ManagedObject<?> mo) Removes a managed object lookup listener for the specified managed object.void
Resets the lock list and all active and waiting locks.setDeadlockPreventionEnabled
(boolean deadlockPreventionEnabled) Enable or disable the super-thread based deadlock prevention for thelookup(MOQuery, LockRequest, MOServerLookupEvent, Class)
method.void
setLockStrategy
(MOLockStrategy lockStrategy) Sets the lock strategy for this server.setUpdateStrategy
(UpdateStrategy updateStrategy) Sets the update strategy forUpdatableManagedObject
s.static boolean
setValue
(MOServer server, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding newValueAndKey) Sets the value of a particular MIB object instance using theManagedObjectValueAccess
interface.toString()
boolean
unlock
(Object owner, ManagedObject<?> managedObject) Unlocks a ManagedObject that has been locked by the specified owner.protected boolean
unlock
(Object owner, ManagedObject<?> managedObject, boolean forceUnlock) boolean
unlockNow
(Object owner, ManagedObject<?> managedObject) Unlocks a ManagedObject that has been locked by the specified owner.unregister
(ManagedObject<?> mo, org.snmp4j.smi.OctetString context) Removes the registration of the supplied managed object for the specified context.static void
unregisterChangeListener
(MOServer server, MOChangeListener listener, MOFilter moFilter) Unregister a singleMOChangeListener
from all objects matching the given filter in the specifiedMOServer
.static <R extends MOTableRow,
T extends MOTable<R, ? extends MOColumn, ? extends MOTableModel<R>>>
voidunregisterTableRowListener
(MOServer server, MOTableRowListener<R> listener) Unregister a singleMOTableRowListener
with all tables in the specifiedMOServer
.boolean
waitForUnlockedState
(long waitTimeoutMillis) Wait until this server has not active and pending locks anymore.
-
Constructor Details
-
DefaultMOServer
public DefaultMOServer()
-
-
Method Details
-
lookup
Description copied from interface:MOServer
Lookup the first (lexicographically ordered) managed object that matches the supplied query. No locking will be performed, regardless of the setMOLockStrategy
. -
lookup
public <MO extends ManagedObject<?>> MO lookup(MOQuery query, LockRequest lockRequest, MOServerLookupEvent lookupEvent, Class<MO> managedObjectType) Lookup the first (lexicographically ordered) managed object that matches the supplied query and implements the givenManagedObject
class. Locking will be performed according to the setMOLockStrategy
before the lookup listener is fired. CAUTION: To make sure that the acquired lock is released after the using of the managed object has been finished, theunlock(Object, ManagedObject)
method must be called then.- Specified by:
lookup
in interfaceMOServer
- Type Parameters:
MO
- theManagedObject
type to lookup.- Parameters:
query
- aMOQuery
instance.lockRequest
- theLockRequest
that holds the lock owner and the timeout for acquiring a lock and returns whether a lock has been acquired or not on behalf of this lookup operation.lookupEvent
- provides additional information about the intended use and optionally a callback to be informed about the completion of the use, including a reference to its result.managedObjectType
- theManagedObject
type filter. Only objects of this type will be looked up and returned.- Returns:
- the
ManagedObject
that matches the query andnull
if no such object exists. - Since:
- 3.1
-
getLockStrategy
Return the locking strategy for this server. The strategy defines if a lock is acquired before a looked upManagedObject
is returned (and before the corresponding lookup event is being fired) or not.- Returns:
- the managed object locking strategy instance used by this server. If
null
, no locking is performed at all (which is only recommended for static content servers). - Since:
- 2.4.0
-
setLockStrategy
Sets the lock strategy for this server. The strategy defines if a lock is acquired before a looked upManagedObject
is returned (and before the corresponding lookup event is being fired) or not. By default, only write access needs a lock.- Parameters:
lockStrategy
- aMOLockStrategy
instance ornull
to suppress any locking.- Since:
- 2.4.0
-
checkForUpdate
ChecksupdateStrategy
whether the queried managed object needs to be updated. This method is called on behalf oflookup(MOQuery query)
afterfireQueryEvent(org.snmp4j.agent.ManagedObject<?>, org.snmp4j.agent.MOServerLookupEvent)
and beforefireLookupEvent(org.snmp4j.agent.ManagedObject<?>, org.snmp4j.agent.MOServerLookupEvent)
is being called.- Parameters:
mo
- an UpdatableManagedObject instance.query
- the query that is interested in content ofmo
.- Since:
- 1.2
-
getManagedObject
public ManagedObject<?> getManagedObject(org.snmp4j.smi.OID key, org.snmp4j.smi.OctetString context, boolean fireLookupEvents) Returns theManagedObject
with the specifiedOID
as ID returned byRegisteredManagedObject.getID()
or the lower bound (regardless whether the ManagedObject's scope includes it or not) when registered in the supplied context.Note: The query used to look up the managed object will indicate intended read-only access for the
MOServerLookupEvent
s fired on behalf of this method.- Parameters:
key
- the OID identifying the key (lower bound) of theManagedObject
.context
- the optional context to look in. Anull
value searches in all contexts.fireLookupEvents
- iftrue
lookup and query events will be fired as if the managed objects has been looked up bylookup(MOQuery)
. In addition, if the looked up managed object is anUpdatableManagedObject
it will be locked if the lock strategy of this server requires it. The lock is active until the look-up events have been fired completely. The lock operation waits without timeout for the lock to become available. Otherwise, no events will be fired at all.- Returns:
- the
ManagedObject
instance ornull
if such an instance does not exist. - Since:
- 2.3
-
getManagedObject
public ManagedObject<?> getManagedObject(org.snmp4j.smi.OID key, org.snmp4j.smi.OctetString context) Returns theManagedObject
with the specifiedOID
as ID returned byRegisteredManagedObject.getID()
or the lower bound (regardless whether the ManagedObject's scope includes it or not) when registered in the supplied context.Note: The query used to look up the managed object will indicate intended read-only access for the
MOServerLookupEvent
s fired on behalf of this method.- Parameters:
key
- the OID identifying the key (lower bound) of theManagedObject
.context
- the optional context to look in. Anull
value searches in all contexts.- Returns:
- the
ManagedObject
instance ornull
if such an instance does not exist. - Since:
- 1.1
-
getValue
public static org.snmp4j.smi.Variable getValue(MOServer server, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID key) Returns the value of a particular MIB object instance using theManagedObjectValueAccess
interface. If aManagedObject
does not support this interface, its value cannot be returned andnull
will be returned instead. Note: This method does not perform any locking based on theMOLockStrategy
.- Parameters:
server
- theMOServer
where to lookup the value.context
- the optional context to look in. Anull
value searches in all contexts.key
- the OID identifying the variable instance to return.- Returns:
- the
Variable
associated withOID
andcontext
inserver
ornull
if no such variable exists. - Since:
- 1.4
-
setValue
public static boolean setValue(MOServer server, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding newValueAndKey) Sets the value of a particular MIB object instance using theManagedObjectValueAccess
interface. If aManagedObject
does not support this interface, its value cannot be set andfalse
will be returned. Note: This method does not perform any locking based on theMOLockStrategy
.- Parameters:
server
- theMOServer
where to lookup the value.context
- the optional context to look in. Anull
value searches in all contexts.newValueAndKey
- the OID identifying the variable instance to set and its new value.- Returns:
- the
true
if the value has been set successfully,false
otherwise. - Since:
- 1.4
-
fireLookupEvent
-
fireQueryEvent
-
getContexts
public org.snmp4j.smi.OctetString[] getContexts()Description copied from interface:MOServer
Returns the contexts known by the server.- Specified by:
getContexts
in interfaceMOServer
- Returns:
- an array of context names.
-
isContextSupported
public boolean isContextSupported(org.snmp4j.smi.OctetString context) Description copied from interface:MOServer
Checks whether the supplied context is supported (registered) by this server.- Specified by:
isContextSupported
in interfaceMOServer
- Parameters:
context
- a context name.- Returns:
true
if the context is support (thus has previously added byMOServer.addContext(org.snmp4j.smi.OctetString)
) andfalse
otherwise.
-
getRegistry
-
getUpdateStrategy
Gets the update strategy forUpdatableManagedObject
s. If the strategy isnull
no updates will be performed on behalf of calls tolookup(org.snmp4j.agent.MOQuery)
.- Returns:
- the current UpdateStrategy instance or
null
if no strategy is active. - Since:
- 1.2
- See Also:
-
setUpdateStrategy
Sets the update strategy forUpdatableManagedObject
s. If the strategy isnull
no updates will be performed on behalf of calls tolookup(MOQuery)
.- Parameters:
updateStrategy
- the new UpdateStrategy instance ornull
if no updates should be performed.- Returns:
- this object for fluently connecting config settings.
- Since:
- 1.2
- See Also:
-
register
public void register(ManagedObject<?> mo, org.snmp4j.smi.OctetString context) throws DuplicateRegistrationException Description copied from interface:MOServer
Registers a managed object for the specified context. A managed object can be registered for more than one context.- Specified by:
register
in interfaceMOServer
- Parameters:
mo
- aManagedObject
instance.context
- the context name for which to register themo
ornull
if the managed oject is to be registered for all contexts (including the default context).- Throws:
DuplicateRegistrationException
- if the registration conflicts (i.e. overlaps) with an already existing registration.
-
unregister
Description copied from interface:MOServer
Removes the registration of the supplied managed object for the specified context.- Specified by:
unregister
in interfaceMOServer
- Parameters:
mo
- aManagedObject
instance.context
- the context name for which to unregister themo
ornull
if the managed object is to be unregistered for all contexts (including the default context). In the latter case however, explicit registrations for a particular context will not be removed!- Returns:
- the removed
ManagedObject
instance ornull
if the removal failed.
-
addContext
public void addContext(org.snmp4j.smi.OctetString context) Description copied from interface:MOServer
Adds the supplied context to the server. The server however may silently ignore the request if local constraints do not allow to add the context (although this should be an exception case only).- Specified by:
addContext
in interfaceMOServer
- Parameters:
context
- anOctetString
representing the context name to add.
-
removeContext
public void removeContext(org.snmp4j.smi.OctetString context) Description copied from interface:MOServer
Removes a context from the server. Removing a context does not remove any managed objects from the server's registry.- Specified by:
removeContext
in interfaceMOServer
- Parameters:
context
- nOctetString
representing the context name to remove.
-
lock
Description copied from interface:MOServer
Locks a ManagedObject by the supplied owner. Once a ManagedObject is locked, a lookup attempt will block until it is unlocked or a predefined timeout occurs. -
lock
Description copied from interface:MOServer
Locks a ManagedObject by the supplied owner. Once a ManagedObject is locked, a lookup attempt from another owner will block until it is unlocked or a predefined timeout occurs. The same owner can lock again recursively but has to unlock with the same number of calls toMOServer.unlock(Object, ManagedObject)
to actually release the lock. To release a lock for an owner immediately without unlocking recursively, callMOServer.unlockNow(Object, ManagedObject)
.- Specified by:
lock
in interfaceMOServer
- Parameters:
owner
- an Object.managedObject
- the ManagedObject to lock.timeoutMillis
- the number of 1/1000 seconds to wait for the lock. 0 or less disables the timeout and waits forever until the lock is released by the current owner.- Returns:
true
if the lock could be acquired,false
otherwise, i.e. if an InterruptedException or timeout has occurred.
-
resetLocks
public void resetLocks()Resets the lock list and all active and waiting locks. This might cause threads /LockRequest
(= transactions) waiting for locks to continue without still having locked the locks they already acquired. To cleanly reset the locks, first set thesetLockStrategy(MOLockStrategy)
to(managedObjectLookedUp, query) -> false
and then wait forgetActiveLockRequests()
become zero. -
waitForUnlockedState
public boolean waitForUnlockedState(long waitTimeoutMillis) Wait until this server has not active and pending locks anymore.- Specified by:
waitForUnlockedState
in interfaceMOServer
- Parameters:
waitTimeoutMillis
- the maximum time in milliseconds to wait for this server to become lock free.- Returns:
true
if server has no active and waiting locks anymore,false
otherwise.- Since:
- 3.7.0
-
getWaitingLockRequests
Returns a readonly map of waitingLockRequest
s and their locks or an empty set ifisDeadlockPreventionEnabled()
isfalse
.- Returns:
- the lock requests (i.e., transactions) that wait for a lock.
- Since:
- 3.7.0
-
getActiveLockRequests
Returns a readonly set of activeLockRequest
s or an empty set ifisDeadlockPreventionEnabled()
isfalse
.- Returns:
- the lock requests (i.e., transactions) that hold at least one lock.
- Since:
- 3.7.0
-
lock
public boolean lock(Object owner, ManagedObject<?> managedObject, long timeoutMillis, LockRequest lockRequest) -
unlockNow
Description copied from interface:MOServer
Unlocks a ManagedObject that has been locked by the specified owner. If the ManagedObject is currently locked by another owner this method returns silently. If the specified owner is identical with the current lock holder for the specified managed object, then the lock is removed regardless how many recursive lock.Note: In debug log mode a message is locked if the lock owner does not match the current lock owner.
- Specified by:
unlockNow
in interfaceMOServer
- Parameters:
owner
- an Object that is owner of a lock and whose locks should be removed completely now.managedObject
- the ManagedObject to forcibly unlock. IfmanagedObject
isnull
then this call has no effect.- Returns:
true
if the lock has been found and completely released successfully,false
otherwise.
-
unlock
Description copied from interface:MOServer
Unlocks a ManagedObject that has been locked by the specified owner. If the ManagedObject is currently locked by another owner this method returns silently.Note: In debug log mode a message is locked if the lock owner does not match the current lock owner.
-
unlock
-
iterator
Description copied from interface:MOServer
Return a read-onlyIterator
over the content of this server. The iterator is thread safe and can be used while the server is being modified. The remove operation of the iterator is not supported.- Specified by:
iterator
in interfaceMOServer
- Returns:
- the
Iterator
on the Map.Entry instances managed by this server. EachEntry
consists of anMOScope
key instance and a correspondingManagedObject
value instance. If theManagedObject
has been registered for a specific context, then aMOContextScope
is returned as key, otherwise the managed objects ownMOScope
is returned.
-
iterator
public Iterator<Map.Entry<MOScope,ManagedObject<?>>> iterator(Comparator<MOScope> comparator, MOFilter moFilter) Description copied from interface:MOServer
Return anIterator
on the registeredManagedObject
s of this server in order defined by the given comparator and filtered.- Specified by:
iterator
in interfaceMOServer
- Parameters:
comparator
- the comparator that defines the order of the managed objects to be returned.moFilter
- if notnull
, only those managed objects are returned by this iterator that pass the specified filter.- Returns:
- the iterator a copy of the registry.
-
addLookupListener
Description copied from interface:MOServer
Adds a managed object lookup listener for the supplied managed object to this managed object server. AMOServerLookupListener
is called before the managed object is returned byMOServer.lookup(MOQuery query)
.- Specified by:
addLookupListener
in interfaceMOServer
- Parameters:
listener
- aMOServerLookupListener
instance, for example a managed object that needs to update its state whenever it has been looked upmo
- theManagedObject
that triggers theMOServerLookupEvent
to be fired when it has been looked up.
-
removeLookupListener
Description copied from interface:MOServer
Removes a managed object lookup listener for the specified managed object.- Specified by:
removeLookupListener
in interfaceMOServer
- Parameters:
listener
- aMOServerLookupListener
instance.mo
- theManagedObject
that triggered theMOServerLookupEvent
to be fired when it has been looked up.- Returns:
true
if the listener could be removed orfalse
if such a listener is not registered.
-
addContextListener
Description copied from interface:MOServer
Adds a context listener to the server. The listener will be informed about context insertion and removal.- Specified by:
addContextListener
in interfaceMOServer
- Parameters:
l
- aContextListener
instance to be informed about context changes.
-
removeContextListener
Description copied from interface:MOServer
Removes a previously added context listener.- Specified by:
removeContextListener
in interfaceMOServer
- Parameters:
l
- aContextListener
instance.
-
fireContextChanged
-
toString
-
getRegisteredContexts
Description copied from interface:MOServer
Returns the contexts for which the suppliedManagedObject
has been registered.- Specified by:
getRegisteredContexts
in interfaceMOServer
- Parameters:
managedObject
- aManagedObject
instance.- Returns:
- an array of context strings, for which
managedObject
has been registered. If themanagedObject
has been registered for all contexts, anull
element is included in the array.
-
getRegisteredScopes
Description copied from interface:MOServer
Returns the scopesMOScope
orMOContextScope
for which the suppliedManagedObject
has been registered in a map indexed by context.- Specified by:
getRegisteredScopes
in interfaceMOServer
- Parameters:
managedObject
- aManagedObject
instance.- Returns:
- a possibly empty map of context to
MOScope
entries. A registration to the default ("one-registration-for-all-contexts")null
context is returned with anull
context key value.
-
registerTableRowListener
public static <R extends MOTableRow,T extends MOTable<R, void registerTableRowListener? extends MOColumn, ? extends MOTableModel<R>>> (MOServer server, MOTableRowListener<R> listener) Register a singleMOTableRowListener
with all tables in the specifiedMOServer
. This overall registration can be used, for example, to apply table size limits to all tables in an agent. SeeMOTableSizeLimit
for details.Note: The server must not change its registration content while this method is being called, otherwise a
ConcurrentModificationException
might be thrown.- Type Parameters:
R
- theMOTableRow
type supported by the table row listener to register.T
- theMOTable
type supported by the table row listener to register.- Parameters:
server
- aMOServer
instance.listener
- theMOTableRowListener
instance to register.- Since:
- 1.4
-
unregisterTableRowListener
public static <R extends MOTableRow,T extends MOTable<R, void unregisterTableRowListener? extends MOColumn, ? extends MOTableModel<R>>> (MOServer server, MOTableRowListener<R> listener) Unregister a singleMOTableRowListener
with all tables in the specifiedMOServer
. This overall unregistration can be used, for example, to remove table size limits from all tables in an agent. SeeMOTableSizeLimit
for details.Note: The server must not change its registration content while this method is being called, otherwise a
ConcurrentModificationException
might be thrown.- Type Parameters:
R
- theMOTableRow
type supported by the table row listener to register.T
- theMOTable
type supported by the table row listener to register.- Parameters:
server
- aMOServer
instance.listener
- theMOTableRowListener
instance to unregister.- Since:
- 1.4
-
registerChangeListener
public static void registerChangeListener(MOServer server, MOChangeListener listener, MOFilter moFilter) Register a singleMOChangeListener
with all objects matching the given filter in the specifiedMOServer
. This overall registration can be used, for example, to listen for object changes.Note: The server must not change its registration content while this method is being called, otherwise a
ConcurrentModificationException
might be thrown.- Parameters:
server
- aMOServer
instance.listener
- theMOTableRowListener
instance to register.moFilter
- an optional filter to select objects which should register the provided listener.- Since:
- 3.0
-
unregisterChangeListener
public static void unregisterChangeListener(MOServer server, MOChangeListener listener, MOFilter moFilter) Unregister a singleMOChangeListener
from all objects matching the given filter in the specifiedMOServer
.Note: The server must not change its registration content while this method is being called, otherwise a
ConcurrentModificationException
might be thrown.- Parameters:
server
- aMOServer
instance.listener
- theMOTableRowListener
instance to unregister.moFilter
- an optional filter to select objects which should no longer register the provided listener.- Since:
- 3.0
-
isDeadlockPreventionEnabled
public boolean isDeadlockPreventionEnabled()Returnstrue
if thelookup(MOQuery, LockRequest, MOServerLookupEvent, Class)
method uses deadlock prevention using a super thread, if a deadlock situation is detected (i.e., waitingLockRequest
s equal activeLockRequest
s. Using the super thread could reduce parallelism unnecessarily to one and detecting (possible) deadlock situations creates additional overhead. For most use cases, settingCommandProcessor.setLockNonNextRequestsSortedByVbOid(boolean)
totrue
is sufficient to prevent deadlocks, if API calls tolookup(MOQuery, LockRequest, MOServerLookupEvent, Class)
are not locking more than oneManagedObject
at once for a singleLockRequest
.- Returns:
true
if super-thread based deadlock prevention is enabled orfalse
otherwise (default).- Since:
- 3.7.0
-
setDeadlockPreventionEnabled
Enable or disable the super-thread based deadlock prevention for thelookup(MOQuery, LockRequest, MOServerLookupEvent, Class)
method. If enabled and a deadlock situation is detected (i.e., the number of waitingLockRequest
s equals activeLockRequest
s, a super-thread will be used to run the latest lookup while all other lookups are blocked until this one is unlocked (finished). Using the super thread could reduce parallelism unnecessarily to one and detecting (possible) deadlock situations creates additional overhead. For most use cases, settingCommandProcessor.setLockNonNextRequestsSortedByVbOid(boolean)
totrue
is sufficient to prevent deadlocks, if API calls tolookup(MOQuery, LockRequest, MOServerLookupEvent, Class)
are not locking more than oneManagedObject
at once for a singleLockRequest
.- Parameters:
deadlockPreventionEnabled
-true
to enable super-thread based deadlock prevention. Deadlock prevention is disabled by default.- Returns:
- this object instance for fluently connecting config settings.
- Since:
- 3.7.0
-