BBjNamespace::setLock

Description

In BBj 3.0 and higher, this method locks a specified variable within the BBjNamespace.

Syntax

Return Value

Method

void

setLock(string name, long timeoutMillis)

Parameters

Variable

Description

name

Specifies the name of the object to be locked.

timeoutMillis

Number of milliseconds to wait for lock.

Return Value

None.

Remarks

The setLock method will result in an error LOCKED if the requested object is already locked by a different BBjNamespace and remains locked longer than timeoutMillis.

Example

api! = BBjAPI()
NS! = BBjAPI().getNamespace("basis.eng.test","testLocks",1)
NS!.setLock("testCounter", 500)
x = NS!.getValue("testCounter",err = notDefined)
NS!.setValue("testCounter", x + 1)
NS!.removeLock("testCounter")
escape
end

notDefined:
    NS!.setValue("testCounter", 22)
retry

See Also

BBjAPI

BBjNamespace

Object Variables

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.