SDKs
...
Java SDK
Java Modules
Proxy Floating
8min
the proxyfloatingservice is intended to be used with the on premise floating server docid\ uzgcwydxkcluyusc1lcsg and is part of the floating client docid 85ozdmi ceei i5t6ldh7 module initializing the proxy floating client module at the minimum there are three parameters you will need to initialize the sdk apikey , your company api key sharedkey , company specific encryption key, used when signing requests productcode , an alphanumeric code identifying a specific product the productcode is tied to a specific product the license applies to and is defined while creating the product optional configuration parameters for initializing the floating client sdk addshutdownhook indicates if you want the sdk to automatically release any currently active licenses on the device before you shut down the runtime process default is true enableperiodicregister enables periodic calls to register method to prolong the license usage it will be prolonged every time the license has passed half of its floating timeout time usage time is set through the licensespring platform with the floatingtimeout parameter in the product configuration proxyregistersubscriber subscriber on periodic register, default implementation is ignoreregistereventsubscriber , but you can add your own implementation to handle the onsuccess and onerror of the periodic register this, of course, isn't a parameter you need to worry about if you chose not to enable periodic checks requestlogging request logging for debug purposes, default is no request logging appversion manually set the version of the application that's using the sdk enableretrying enables the retry option on failed api call to the server the call can be repeated for up to 4 times default is false identityprovider set a custom identityprovider which generates unique keys for a particular device default implementation is based on once per process more details on our java hardware (device) ids docid\ kinndeo4bghcv3azyvchm requesttimeout set the timeout of requests make to api (in seconds), default is 10 seconds // configuration with only required parameters // note building a licensespringconfiguration without required parameters will throw a configurationexception try { proxyconfiguration configuration = proxyconfiguration builder() host("localhost") port(8080) product("pc") build(); } catch (configurationexception e) { log error(e getcause() getmessage()); } // configuration with more parameters try { proxyconfiguration configuration = proxyconfiguration builder() host("localhost") port(8080) product("pc") addshutdownhook(false) enableperiodiccheck(false) enableretrying(true) requesttimeout(60l) build(); } catch (configurationexception e) { log error(e getcause() getmessage()); } proxyfloatingservice after setting up the sdk configuration, there are a number of methods and objects available to the app developer to make the proxyfloatingservice , initialize it by passing the proxyconfiguration object you set up earlier proxyfloatingservice service = new proxyfloatingservice(configuration); now you can use the methods that the proxyfloatingservice provides register() registers the user by making a proxyrequest which contains the product code from the proxyconfiguration and the device id which is provided by the identityprovider each registration lasts for the time specified in the licensespring platform (floating timeout) in order to prolong the usage of the product, this method needs to be called periodically (this is automatically called in the background if the property enableperiodicregister in the proxyconfiguration was set to true) returns the licensedata object which contains information about the license try { licensedata licensedata = service register(); system out println("you have " + licensedata getfloatingtimeout() + " more minutes "); } catch (licensespringexception e) { log error(e getcause() getmessage()); } unregister() unregisters the user, which by definition, frees up one user slot on the server returns true if the action was successful try { if (service unregister()) { system out println("you have been successfully unregistered from product " + configuration getproduct()); } } catch (licensespringexception e) { log error(e getcause() getmessage()); } getlicense() fetches the license information from the server for the product specified in the proxyconfiguration object try { if (service unregister()) { system out println("you have been successfully unregistered from product " + configuration getproduct()); } } catch (licensespringexception e) { log error(e getcause() getmessage()); } getsettings() retrievers the server settings the returned settings object contains registrationexpiryminutes , and an array of server addresses try { settings settings = service getsettings(); system out println("there are " + settings getservers() length + "in your proxy network "); system out println("the registration expiry time for product " + configuration getproduct() + " is " + settings getregistrationexpiryminutes() + " minutes"); } catch (licensespringexception e) { log error(e getcause() getmessage()); }try { if (service unregister()) { system out println("you have been successfully unregistered from product " + configuration getproduct()); } } catch (licensespringexception e) { log error(e getcause() getmessage()); } pingserver() pings the local proxy server try { service pingserver(); system out println("the proxy server is up and running )"); } catch (licensespringexception e) { system out println("there is something wrong with your local server, this application cannot connect to it "); system out println("please check why " + e getcause() getmessage()); }