Setting Up Concurrency with Floating Cloud

Published on: August 15, 2022
Table of Contents:

LicenseSpring allows the application developers to issue licenses with concurrent usage, where LicenseSpring acts as the floating license server. This tutorial provides a basic introduction to utilizing the floating cloud, including registering and deregistering a floating cloud license, timeouts, and license borrowing.

For this tutorial, we will be creating an application that checks for an available floating license, uses any available floating license, and maintains control of the license until the user decides to close the program. This guide will mention and provide code snippets from the code, as well as link the source code for the application.

For an introduction to floating licenses see here.

For our C++ console program that demonstrates how to use floating licenses, click here.

Here are the main points we will discuss in this tutorial:

  • Register and Deregister
  • Timeout
  • License Borrowing

Register and Deregister


Unlike floating server, for a floating cloud license, you will need to activate the floating license on each device that intends to use that license. Thus, when configuring your floating cloud license, it is highly recommended to set "Max activations" equal to or greater than the "Max simultaneous license users" field, as each registered user, will needs to be activated. Once activated, registering from the SDK is very simple, you can either use the dedicated register method, or run an online check. Both will register you to the floating cloud license.

1 2 auto license = licenseManager->getCurrentLicense(); license->registerFloatingLicense(); //Or you can use license->check();

Using the register method will allow you to see how many different license users are concurrently using the floating license at any time.


Since there are a limited number of registration spots, it is important to return those registration spots when they're not being used. You will need to deregister a license, so that another user can register their license on their device.

Similar to registering a floating license, there are also multiple ways to deregister/release a license.

You can manually deregister a device from a floating license within your code.

1 2 3 4 //The parameter used in our deregister method, determines whether this method will throw //exceptions or not. Turning it off (false) is useful, in case we deregister, but we //weren't originally registered, so nothing will happen. license->releaseFloatingLicense( false );

Or you can use the auto-release feature. This feature will make it so that whenever your license object is destroyed, then the floating license is automatically released from the device. This is useful, as on application close or crash, the license will be destroyed, and will be automatically released. By default, this is already turned on within the SDK.

1 2 3 4 5 6 7 //You can use the parameter to manually turn on/off the auto release feature. license->setAutoRelease( true ): //If you're not sure whether auto release is currently set within your code you can use: if( license->isAutoReleaseSet() ) { //do something }

Finally, the last solution is to let the floating license timeout.


The floating timeout (set in minutes) dictates how long the floating license can stay on a device before it requires re-registering. If a device does not register within that time interval, it times out, and its floating license will be returned to the pool for others to use. This helps guarantee all users are (somewhat) concurrently using the license.

To tell if a license has been timed out or deregistered, you can use the expiration field in the local license file. For a floating license, being expired can mean 3 things. You are using a time-limited license and it has run out, you are using a trial license and it has run out, or you are currently deregistered/timed out. This final feature is exclusive to floating licenses, and can be used to check if a license is currently registered or not. Note: this also applies to floating server licenses.

You can use any previous methods to register a floating license to re-register that same license. For some programs this can work, but it requires manually running checks/register API calls from within the code. For example, if the developer programs each feature within their code to run an online check, and if a user doesn't use any features within a certain amount of time, they will be timed out and their license will be returned to the pool. However, there is another more useful method that can be used to set up a background thread that will run continuously on an interval and run online checks.

1 void setupLicenseWatchdog( LicenseWatchdogCallback callback, uint32_t timeout = 0 )

This will create a background thread that will periodically perform online checks (which will reset your floating timeout interval). The parameter timeout dictates when online checks will be done (in minutes).

For a floating license with a floating timeout of “x” minutes, when a floating license is re-registered, their timeout clock will be reset to 0, and they will have another “x” minutes to use that license or re-register again.

License Borrowing

An efficient solution to checking out a license for longer than the default floating timeout is license borrowing. Standard floating licenses need to be checked/renewed within the floating timeout interval. License borrowing allows you to create a license that will show up on the floating server as "used", but the actual borrower can use that license offline until their borrowing period is over. This borrowing can be set to much longer periods than a license’s normal floating timeout period which makes it particularly useful for offline floating licensing. For example, say an employee needs to work on a project requiring a floating license from home but will not have access to their license server due to security constraints. They can borrow a license for 24 hours, which will allow them to use the license without connecting to the server for those 24 hours.

Here's how to borrow using the SDK:

1 2 3 4 5 license->borrow( hours, days ); //You can also set the date on which your borrowed license will be expired. //Borrow end date time in format "%Y-%m-%dT%H:%M:%SZ", for example "2022-05-28T15:30:00Z std::string expirydate; license->borrow( expirydate );

Like registered licenses, borrowed licenses can be deregistered the same way to return the registration spot into the license pool.

To learn more about license borrowing see: License borrowing - Documentation (


In this tutorial, we went through the basics of a floating cloud license, including how to register/deregister/borrow a license. We also learned how the timeout period works, and how to counteract it. With this knowledge, you should be able to create the appropriate floating license you want for your project, and implement it into your code.


Q: What will happen if I try to register a device, but there are no more floating license registrations available?

In this case, you will get a simple LicenseSpring exception. You can catch this and give an appropriate response to the user, letting them know there are no more available spots.

Q: Is there a way to see, from the code, how many users are currently registered?

Yes for some SDKs (for example, Java does not have it). For others, like C++ and .NET you may come across an issue. To get the most updated information about who is currently registered, you will need to run an online check, however, running an online check will try and register you to the floating license. Therefore, you should only check the concurrent users, while registered. If you are checking to make sure you have space to register, you can just use the exception that gets thrown (mentioned above) to see if your registration was successful or not.

1 2 //How many current floating license users there are license->floatingInUseCount();

Q: What if I want to switch between a registered license and a borrowed license and vice-versa?

To register a borrowed license, you can register it normally, through the register method or running an online check. It will still be displayed as borrowed, but it will also be registered and work the same as a registered floating license, with the exception that it is also a borrowed license. If you do not want the license to be both a borrowed and registered license, you can release the borrowed license first and then register it normally.

To borrow a registered license, you just need to borrow it normally. There is one more thing to note however. If you were using the watchdog (background thread that runs continuous online license checks), you will most likely want to turn it off, as it will interfere with the offline nature of borrowing a license. This capability is not currently available for certain SDKs, such as C++ and C#, and will require the program to be restarted or the license object to be destroyed and remade to avoid continuously running online checks while borrowing a license.

1 2 //Turns off continuous online checks. licenseManager.shutdownScheduler();