Synchronize Blocks

From PresenceWiki
Revision as of 18:13, 7 February 2012 by Mattpryor (Talk | contribs)

Jump to: navigation, search

Synchronize blocks (available in version 3.7 and onwards) are useful for situations where parts of different Tasks must not run simultaneously. A Synchronize Block consists of a Start Synch Block node and an End Synch Block node. Both nodes have a lock key, which is guaranteed to only be held by one Synchronize Block at a time. This is illustrated below:

http://www.international-presence.com/wikidocs/images/synch_illustration.png


Synchronize Blocks are managed by a service that runs as part of the Presence database server. When a Start Synch Block node is encountered, it sends a message to the service requesting an exclusive lock based on the key provided (this can be dynamic and based on your data). If no other Tasks have managed to obtain this lock, it will be returned immediately. If another Task (or Thread within the same Task) currently has that lock, it will wait until that lock is released before continuing. When the End Synch Block node executes it will release the lock so that any waiting Tasks can continue.


Managing Synchronize Locks

To view a list of currently held locks, in the Presence Task Administrator select Server > Manage Synchronize Locks from the top menu:

http://www.international-presence.com/wikidocs/images/manage_synch_locks.png

The following columns are displayed in the table. Click on a column header to sort the locks by that criteria.

Server Name

This is the hostname of the Presence server that owns the lock.

Task

This is the name of the Task that owns the lock.

Identifier

This is the parsed text key associated with this lock.

Time obtained

Displays the time and date at which the lock was obtained in the format "HH:mm:ss.SSS dd MMM yyyy".

Note that this operation is only available for users that have "Administrator" rights in Presence.

The "Clear All" and "Clear Selected" buttons allow you to prematurely clear the lock(s), freeing any Tasks which are waiting for them. This is useful if a Task is stuck during its normal operation, for example if it is waiting for a remote service to return.