SDKs
Java SDK
Java Advanced Usage
10min
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) in case any of the mentioned components match a vm component signature and the feature is active, the license activation will fail! if you come across a virtual machine that's not properly detected, please submit a ticket 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 it's own configuration you can use the licensemanagerfactory to create additional managers or use the singleton like before // creates a new licensemanager object, there can be multiple ones using this method licensemanager multiplelicences = licensemanagerfactory createlicensemanager(); // uses the singleton variant, only 1 manager can be initialized using this method licesnemanager singleton = licensemanagerfactory getlicensemanager(); 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 // another way to initialize the manager // is to pass it an additional field which is // your own implementation of the licenserepository interface public class mylicenserepository implements licenserepository { void save(license license) { // save the license } void delete() { // delete the license } license load() { 	 // load the license } // add any additional methods you need } try { 	licensemanager initialize(configuration, new mylicenserepository()); } catch (licensespringexception e) { log error(e getcause() getmessage()); } 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 the java license client docid\ uwqr7jqg01pcftet8iao0 , floating client docid 85ozdmi ceei i5t6ldh7 , proxy floating docid r7g0sf5yq0jyyawahn 9 and management sdk docid\ oqehm3fli2mj 0aq8u724 all have support for setting up a forward proxy just set the proxyport and proxyhost fields in any of the configurations to use a forward proxy for your application you can set just the proxyport field this will automatically use "localhost" as the proxyhost 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 licensespringconfiguration configuration = licensespringconfiguration builder() apikey("api key") productcode("product code") sharedkey("shared key") 	 proxyhost("192 168 0 254") proxyport(1337) proxyuser("sampleuser") 	 proxypass("samplepass") build(); disable ssl 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 the license client , floating client and management sdk called disablessl here is an example setup for the license client module licensespringconfiguration configuration = licensespringconfiguration builder() apikey("api key") productcode("product code") sharedkey("shared key") 	 disablessl(true) build(); 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 has the option to dinamically trigger offline/online mode with the method setofflinemode(boolean) mentioned here https //docs licensespring com/sdks/java/modules/license client#nzxdy https //docs licensespring com/sdks/java/modules/license client#nzxdy for detecting if the user has access to internet the connection type is "com licensespring model exceptions infrastructure connectionexception", with the message " 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/ 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)