Floating Features
Similar to Floating Licenses, LicenseSpring supports Floating Features.
In this guide you can find an overview of the floating features functionality: registering and releasing floating features and setting up the Floating Features Watchdog.
Check if a feature is floating
As with floating licenses, you can check if a feature is floating using properties for cloud, as well as offline floating features. To start, use the following code to check if a license feature is floating:
foreach (ILicenseFeature licenseFeature in license.Features())
{
if(licenseFeature.IsFloating || licenseFeature.IsOfflineFloating)
{
// DO SOMETHING WITH A FLOATING FEATURE
}
}for(const auto& feature : license->features())
{
if(feature.isFloating() || feature.isOfflineFloating())
{
// do something with a floating feature
}
}## add getters
for feature in license.features():
feature_data = get_feature_data(feature)
if feature_data["is_floating"] or feature_data["is_floating_cloud"]LicenseData data = license.getData();
List<LicenseFeature> features = data.getProductFeatures();
for (LicenseFeature feature : features) {
if (feature.isFloating() || feature.isFloatingCloud()) {
// Do something with a floating feature...
}
}Floating slots
Developers will want to know the maximum number of users that can simultaneously use a floating feature and the current number of users using the feature. That can be done with:
uint maxUsers = licenseFeature.FloatingSlotsCount;
uint currentUsers = licenseFeature.FloatingSlotsInUse;int32_t maxUsers = feature.floatingUsers()
int32_t currentUsers = feature.floatingInUseCount();feature_lkprod1f1fc1 = license.get_feature_data("lkprod1f1fc1")
feature_lkprod1f1fc1["floating_timeout"] # if feature is floating type
feature_lkprod1f1fc1["floating_users"] # if feature is floating typeLong floatingTimeout = feature.getFloatingTimeout();
Long floatingUsers = feature.getFloatingUsers();let floatingTimeout = feature.floatingTimeout
let floatingUsers = feature.floatingInUseCountFloating timeout
You can get information on the floating feature timeout (in minutes) and the point in time until which a registered feature is valid (time of registration + floating feature timeout). After that time, LicenseSpring server will automatically release the feature - if it's not registered again.
uint floatingTimeout = license.FloatingTimeout;
DateTime floatingEndDateTime = license.FloatingEndDateTime;
DateTime floatingEndDateTimeUtc = license.FloatingEndDateTimeUtc;int32_t floatingTimeout = feature.floatingTimeout();
tm floatingEndDateTime = feature.floatingEndDateTime();
tm floatingEndDateTimeUtc = feature.floatingEndDateTimeUtc();feature_lkprod1f1fc1 = license.get_feature_data("lkprod1f1fc1")
feature_lkprod1f1fc1["floating_timeout"]
feature_lkprod1f1fc1["floating_end_date"]
feature_lkprod1f1fc1["floating_start_date"]Long floatingTimeout = feature.getFloatingTimeout();let floatingTimeout = license.floatingTimeout
let floatingEndDate = license.floatingEndDateRegistering and releasing floating features
Similar to floating licenses, floating features have to be periodically registered on the server for them to take up a floating slot.
Note that in the C++ SDK you need to pass the feature code instead of the feature object to License::registerFloatingFeature
Likewise, if you wish to release a feature before its timeout, you can do it like so:
In .NET SDK, ILicenseFeature data is not refreshed after registering and releasing the feature. In order to get updated values like FloatingSlotsInUse and FloatingEndDateTime you have to call ILicense.Features() method again.
The same applies to the C++ SDK. You have to call license->features() again to get updated feature values.
Floating feature borrowing
If the license user is planning to be offline for a longer period of time, they can borrow a floating feature instead. Borrowing a feature removes it from the feature watchdog.
For user-based licenses, the application must collect the user's password or initiate an SSO login via their Identity Provider:
Watchdog setup
Similar to a floating license watchdog, floating features have to initialize the watchdog in order to use its functionalities. See: Floating Licensing.
Once configured, floating features only need to be registered once. The watchdog ensures they remain active until they are manually released. Be sure to release them when the application shuts down to free up the slots.
You initialize the watchdog like so:
Setting up the watchdog will also start the thread. If you wish to stop automatically extending your floating features, you can stop the watchdog:
And once stopped, it can be restarted again:
The legacy License::setupLicenseWatchdog and License::setupFeatureWatchdog (and their LicenseHandler / C-interface counterparts) are marked [[deprecated]] since v8.2.0. They continue to work, but you'll get a compile-time deprecation warning until you migrate.
Last updated
Was this helpful?