Java Advanced Usage

Detecting Virtual Machines

In case your License is using the Prevent virtual machine feature, the Java SDK will try to detect a Virtual Machine (VM) by comparing common VM signatures in hardware components of a node (computer).

If any of the mentioned components match a VM component signature and the feature is active, the License activation will fail!

circle-info

If you come across a Virtual Machine that's not properly detected, please submit a ticketarrow-up-right with information about the VM used so we can add it to the detector.

Virtual Machines Currently Detected Using the Java SDK

The detection process compares the hardware signatures of the current node (computer) against a list of the following known VM signatures:

  • bhyve

  • Docker Container

  • FreeBSD Jail

  • KVM

  • LXC

  • Lguest

  • Linux-VServer

  • Microsoft Hyper-V

  • OpenVZ

  • Parallels

  • Project ACRN

  • QEMU

  • QNX Hypervisor

  • VMware

  • Windows Virtual PC

  • Xen/Oracle

  • Virtual Iron

  • VirtualBox

Multiple Licenses on Same Device in LicenseClient

By default, the LicenseManager is used as a singleton - but if there is a need for multiple LicenseManagers, each with its own configuration - you can use the LicenseManagerFactory to create additional managers or use the singleton like before.

Custom License Storage in License Client

By default the license is stored on the local disk - encrypted when storing. The location of the license can be changed via the Configuration object. A custom LicenseRepository can also be implemented, see sample below:

Implementing Your Own LicenseSpring using LicenseSpring Core

This is possible to do, where you get to reuse most of the DTOs and authorization that was built. Feel free to contact us, if you require help of implementing your own SDK, with the boilerplate and authorization layers already finished.

Forward Proxy

All Java SDK modules support a forward proxy. Set proxyPort and proxyHost in the relevant configuration.\n+\n+If you’re choosing between modules, see Java Modules.\n+\n+For on-prem floating, see Floating Server V1.

There is also support for Basic Auth, by setting the proxyUser and proxyPass fields in any of the configurations.

Here is an example setup for the License Client module:

Disable SSL

circle-info

disableSsl() still uses SSL traffic; it just trusts all certificates.

In rare cases, some clients using a forward proxy cannot verify the public certificate of LicenseSpring servers. For these cases, there is an option in the License Client, Floating Client and Management SDK called disableSsl.

Here is an example setup for the License Client module:

Shutdown Scheduled Executors

License Client (LicenseManager), Floating Client (FloatingLicenseService) and Proxy Floating Client (ProxyFloatingService) have the method shutdownScheduler(), which calls shutdownNow() for their scheduled executors. The executors are used in making periodic checks (if it's enabled) and in some cases will leave threads running indefinitely - when no shutdown signal is received.

Offline Mode Toggle

LicenseManager can dynamically toggle offline/online mode with setOfflineMode(boolean).

For detecting if the user has access to internet: The connection type is "com.licensespring.model.exceptions.infrastructure.ConnectionException", with the message: "http://api.licensespring.com/: nodename nor servname provided, or not known" or message "timeout" - depending if the internet was available at some point during app running ("timeout" message if internet was available at some point and later disabled)

Custom Service URL

License Client and Floating client can have alternate serviceUrls (when base domain is not http://licensespring.com/) — to override, use the serviceURL and serviceUrlCertPath configuration params. The certificate needs to be a .pem file (on disk or a resource).

Last updated

Was this helpful?