[ library(flexlm) | Reference Manual | Alphabetic Index ]

licence_heartbeat(+Feature, +Minutes, -Reconnects, -FailedReconnects)

Refresh a checked out FlexLM licence
Feature
String or atom
Minutes
Integer
Reconnects
Returns count of reconnects within last Minutes minutes
FailedReconnects
Returns 0 if ok, otherwise count of failed reconnects

Description

This maps directly to lp_heartbeat() of the FlexLM simple API.

An application should call licence_heartbeat/4 occasionally (e.g. every few minutes) in order to make sure that the licence server is still running. When everything is ok, zero is returned in the last argument, otherwise the number of failed connection attempts.

The second and third argument allow to check whether the licence server has been shut down and restarted. If that happens, the heartbeat call will reconnect to the server. If many such reconnects happen in a short amount of time, this is suspicious and may indicate an attempt to illegally obtain more licences.

If a feature had been checked out multiply, a heartbeat is performed for every checked out licence, and the reconnection counts are added up.

Fail Conditions

Fails if the given feature has not been checked out

Examples

	...,
    	( sepia_kernel:licence_heartbeat(swapper, 10, R, 0) ->
	    ( R > 3 ->
		writeln(error, "Licence server suspicious"),
		abort
	    ;
		true
	    )
	;
	    writeln(error, "Licence server not responding"),
	    abort
	),
	...
    

See Also

licence_checkout / 6, licence_checkin / 1, licence_held / 1