Class Reference
SYS.Lock
Server:irisdocs1
Instance:IRISLATEST
User:UnknownUser
 
-
  [%SYS] >  [SYS] >  [Lock]
Private  Storage

abstract class SYS.Lock extends %SYSTEM.Help

Interface to remove locks and query and adjust lock table parameters.
Use %SYS.LockQuery to query the contents of the lock table.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
10


Summary

Methods
DeleteAllLocks DeleteOneLock GetLockSpaceInfo GetMaxLockTableSize
GetNodeInfo Help SetMaxLockTableSize


Methods

• classmethod DeleteAllLocks(id As %String = "") as %Status
Remove all locks from lock table.
This returns number of locks been removed from lock table.
The argument 'id' specified the category of lock entries to be deleted. See the 'Filter Specification' at the top of %SYS.LockQuery.
Example:
	// Delete all locks in lock table.
	Set rc=##Class(SYS.Lock).DeleteAllLocks()
	 
	// Delete locks owned by process 2004.
	Set rc=##Class(SYS.Lock).DeleteAllLocks(2004)
	 
	// Delete locks owned by remote client system named 'SystemA'.
	Set rc=##Class(SYS.Lock).DeleteAllLocks("CSystemA")
	 
	// Delete locks owned by remote client systems.
	Set rc=##Class(SYS.Lock).DeleteAllLocks("N")
	 
	// Delete locks owned by remote DDP clients.
	Set rc=##Class(SYS.Lock).DeleteAllLocks("NDDP")
• classmethod DeleteOneLock(LockRef As %String, id As %String = "", LockRefType As %Integer = 0) as %Integer
Delete One Lock item in the lock table.
This returns 1 if the lock delete operation succeeds, otherwise returns 0.
  • 'LockRef' - could be a lock reference string or a DelKey depends on the 'LockRefType' parameter.
  • 'id' - the owner of the lock entry to be deleted. See the 'Filter Specification' at the top of %SYS.LockQuery for the 'id'.
  • 'LockRefType' - 0: the 'LockRef' is lock reference string, this is the default value. 1: the 'LockRef' is the DelKey for deleting the lock entry.
The 'DelKey' is usually used when the lock's 'DelKey' value is retrieved from a query.

Example:
	// Delete ^|"^^c:\intersystemsdb\mgr\user"|a(1) lock.
	Set rc=##Class(SYS.Lock).DeleteOneLock("^|""^^c:\intersystemsdb\mgr\user""|a(1)")
	 
	// Delete ^|"^^c:\intersystemdb\mgr\user"|a(1) lock owned by process 2004.
	Set rc=##Class(SYS.Lock).DeleteOneLock("^|""^^c:\intersystemsdb\mgr\user""|a(1)",2004)
	 
	// Look through the lock table and remove all locks
	// to the directory with System File Number equal 2.
	Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
	Do Rset.Execute("")
	While Rset.Next() {
	    If Rset.Data("Sfn")=2 {
	        s rc=##Class(SYS.Lock).DeleteOneLock(Rset.Data("DelKey"),"",1)
	    }
	}
• classmethod GetLockSpaceInfo() as %String
Get lock space information.
This method returns three numbers and they are separated by ',' in the following format:

"AvailableSpace,UsableSpace,UsedSpace"

The amounts are number of bytes.
AvailableSpace: Available memory for lock, it is total configured lock memory minus UsedSpace.
UsableSpace: Estimated size of memory could be used; some of the AvailableSpace is reserved for each process. They include two LRB, one LHB and one lock reference string. They could not be used by other processes until the job released it to the free pool. So the UsableSpace is less than the AvailableSpace.
UsedSpace: Currently used memory space by lock.
• classmethod GetMaxLockTableSize() as %Integer
Get the maximum number of bytes been configured for lock system to use.
The value returned is in number of bytes.
• classmethod GetNodeInfo() as %String
Get node information.
This method returns the node information of current system.
This returns the following information who are separated by $C(0) in sequence.

1) Node Name - node name of the current system.
2) Joined Cluster - 1: this system is a cluster member, 0: otherwise.
3) Cluster Master - 1: this system is a cluster master node, 0: otherwise.
4) Cluster Master Node Name - The Node Name of the cluster master node.

• classmethod SetMaxLockTableSize(NewSize As %Integer) as %Integer
Set new maximum number of bytes for lock system to use.
The 'NewSize' is in bytes, it will be round up to 64 KB.


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.