BBjEnterpriseNamespace::setLock

Description

In BBj 13.0 and higher, this method locks a specified variable within the BBjEnterpriseNamespace.

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 BBjEnterpriseNamespace and remains locked longer than timeoutMillis.

Example

rem 'host and authentication information

host$="server"
port = 2552
user$="user"
password$="password"
NS! = bbjapi().getBBjEnterpriseNamespace(host$,port,"test",user$,password$)
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

BBjEnterpriseNamespace

BBjNamespace

Object Variables

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