From Lianjapedia
Jump to: navigation, search


Function to unlock all resources previously locked with LOCKRESOURCE()



See Also



The UNLOCKRESOURCEALL() function unlocks all resources previously locked with LOCKRESOURCE().

The LOCKRESOURCE() function is cluster aware and can safely be used across multiple running instances of either Lianja desktop Apps on a network or Lianja Cloud Server instances.

'Shared' locks provide the ability to have multiple readers whereas 'exclusive' locks only provide access to a named resource one process at a time. If the named resource is locked exclusive by another process then the requesting process will wait until the resource is available in a compatible lock mode.

The 'LianjaCloudServerRequestLoop' resource is a built-in resource used by the Lianja Cloud Server. When a request is made to the Lianja Cloud Server a 'shared' lock is placed on the 'LianjaCloudServerRequestLoop' resource and then released at the end of the request. An rsp script placing an 'exclusive' lock on 'LianjaCloudServerRequestLoop' can therefore temporarily block the processing of other Lianja Cloud Server requests, for example to carry out database upgrade operations. Once the required operations are complete, issuing UNLOCKRESOURCE(<cResource>) or UNLOCKRESOURCEALL() will release the lock.

The LOCKRESOURCE(), UNLOCKRESOURCE() and UNLOCKRESOURCEALL() functions can also be called from a JavaScript Server Page (.jssp) file using the Lianja.evaluate() method.

The 'resourcelocks' sub-directory of lianja must exist and be writable (default). If required, an alternative directory can be specified by creating and setting the DB_RESOURCELOCKSDIR environment variable.


<%@ Language=VFP %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
lockResource("LianjaCloudServerRequestLoop", "exclusive")
// Once the exclusive lock has been granted carry out required operations
// ...
// Then release the lock to unblock other requests
// Custom named resource:
lockResource("myresource", "exclusive")
// Resources can be unlocked individually by name:
// Or all previously locked resources can be unlocked: