Test-KFProcessLock

Syntax

Test-KFProcessLock
  [-Handle] <handle>
  [-ThrowErrors[:$true]]

Support

>= kenaflow 2.0.3

Return

Boolean.

$true => <handle> is valid. The lock exists and "you" own it.

$false => <handle> is invalid or does not exist or "you" do not own it.

Description

This cmdlet can be used to test the existence of an custom lock.

Please read this article for further details: Locking.

Parameters

[-Handle] <handle>

This is a lock handle gathered with Lock-KFProcess.

[-ThrowErrors[:$true]]

This is a default parameter for all kenaflow cmdlets. If set to $true (default!) the engine will pass exception within the cmdlet to the script for further handling.

Example

$lock = Lock-KFProcess -Key "TestLockKey" -MaxWaitInSeconds 10
if( $lock -ne $null ) {
	Test-KFProcessLock -Handle $lock
	Unlock-KFProcess $lock
} else {
	Write-KFLog "Cannot get a handle for the given key."
}