PLATFORMS SOLUTIONS BLOGS CONTACT

Threading Adapter



This adapter allows you to implement advanced thread synchronization and locking mechanism with multiple databases and IoT devices.




Configuration Settings



Name Description Default
Boolean _isDefault Make this the default configuration. Defaults to true if configName is already the default.
String resourceGroup The name of the resource group that holds threading objects
Int32 defaultTimeout The default timeout for threading objects 60
String defaultSleep The default sleep duration in seconds OR a CRON schedule defining a rally point in the future

Handlers



ListLocks Lists active global lock in a given group. details 

Arguments

Name Description Default
name The name of the lock to filter by

SQL Call

exec Threading.ListLocks 


Http Call

/bsc/threading/listlocks

Output Columns

String nameThe name of the active lock
String ownerOwner of the lock
Boolean expiredTrue/1 if the lock has expired
Double expiresInNumber of seconds remaining before the lock expires
DateTime lockAcquiredOnThe UTC date and time when the lock was acquired
Double lockedForThe number of seconds the lock has been acquired
String tagCustom tag used to store system/device-specific information
Lock Create a global lock. details 

Arguments

Name Description Default
name R The name of the lock to create (use #guid() to generate a random name)
owner Owner of the lock (use #guid() to generate a random owner); only the owner can unlock; leave empty if anyone can unlock
expiresInSec The expiration window of the lock (default: uses the default timeout configuration setting)
tag Custom tag used to store system/device-specific information

SQL Call

exec Threading.Lock 'mylock1', 60
INSERT INTO Threading.Locks (name,expiresInSec) VALUES ('mylock1', 60)


Http Call

/bsc/threading/lock

Output Columns

String nameThe name of the lock to create
String ownerOwner of the lock
SlideTTLLock Slides the timeout window of a global lock by the specified number of seconds. details 

Arguments

Name Description Default
name R The name of the lock to update
owner The owner of the lock
slideBySec The number of seconds the expiration window should be expanded by

SQL Call

exec Threading.UpdateLock 'mylock1', 60
UPDATE Threading.Locks SET slideBySec = 60 WHERE name='mylock1'


Http Call

/bsc/threading/slidettllock

Output Columns

This call does not return data.

Unlock Releases a global lock. details 

Arguments

Name Description Default
name R The name of the lock to release
owner The owner of the lock
silenceErrors Silence errors if the lock has already been released or is not found False

SQL Call

exec Threading.Unlock 'mylock1', 1
DELETE FROM Threading.Locks WHERE name='lock1' AND silenceErrors = 1


Http Call

/bsc/threading/unlock

Output Columns

This call does not return data.

UpdateTimeout Updates the default Lock Timeout programmatically. details 

Arguments

Name Description Default
lockTimeout R The positive default lock timeout in seconds

SQL Call

exec Threading.UpdateTimeout '90' 


Http Call

/bsc/threading/updatetimeout

Output Columns

This call does not return data.

CalculateRally Calculates the number of milliseconds to wait until the next rally point. details 

Arguments

Name Description Default
duration Optional CRON expression indicating a rally point in the future (ex (top of the next 5 min increment): 0 */5 * ? * * ); if missing, uses the defaultSleep configuration setting if provided as a CRON expression

SQL Call

exec Threading.CalculateRally '0 */5 * ? * *'


Http Call

/bsc/threading/calculaterally

Output Columns

Double clientWaitTimeMsThe number of milliseconds to wait client-side
DateTime fromDateThe UTC datetime from which the clientWaitTimeMs has been calculated
Double fromEpochThe epoch time (in milliseconds) from which the clientWaitTimeMs has been calculated
ListSleep Gets the list of systems/devices currently sleeping. details 

Arguments


SQL Call

exec Threading.ListSleep 
SELECT * FROM Threading.Sleep


Http Call

/bsc/threading/listsleep

Output Columns

String ownerOwner of the sleep
Double durationNumber of seconds requested for the sleep operation
Double expiresInNumber of seconds remaining before the sleep expires
DateTime sleepAcquiredOnThe UTC date and time when the sleep was initiated
Double sleptForThe number of seconds the sleep operation has been running
String tagCustom tag used to store system/device-specific information
Sleep Sleeps the caller for N seconds. details 

Arguments

Name Description Default
duration The positive sleep duration in seconds OR a CRON expression indicating a rally point in the future (ex (top of the next 5 min increment): 0 */5 * ? * * )
owner The owner of the sleep request
tag Custom tag used to store system/device-specific information

SQL Call

exec Threading.Sleep 
exec Threading.Sleep '0.5'


Http Call

/bsc/threading/sleep

Output Columns

Boolean cancelledTrue/1 if the operation was cancelled
Double durationThe actual sleep duration in seconds
UpdateSleepDuration Updates the Sleep Duration programmatically. details 

Arguments

Name Description Default
duration R The positive sleep duration in seconds OR a CRON expression indicating a rally point in the future (ex (top of the next 5 min increment): 0 */5 * ? * * )

SQL Call

exec Threading.UpdateSleepDuration '90' 
exec Threading.UpdateSleepDuration '0 */5 * ? * *'


Http Call

/bsc/threading/updatesleepduration

Output Columns

This call does not return data.

Wakeup Wakes up sleeping processes. details 

Arguments


SQL Call

exec Threading.Wakeup 


Http Call

/bsc/threading/wakeup

Output Columns

This call does not return data.








601 21st St Suite 300
Vero Beach, FL 32960
United States

(561) 921-8669
info@enzounified.com
terms of service
privacy policy

PLATFORM

ENZO SERVER
ENZO DATAZEN

SOLUTIONS

SOLUTIONS OVERVIEW
INTEGRATION
SaaS
CLOUD ANALYTICS

RESOURCES

DOWNLOAD
BLOGS & VIDEOS
IN THE NEWS
ENZO ADAPTERS
ONLINE DOCUMENTATION
TCO CALCULATOR

COMPANY

LEADERSHIP TEAM
PARTNERS


© 2023 - Enzo Unified