LICENSE4J
Home rarr Documents rarr Licensing Library rarr License Status and Errors

License Status and Errors

The method License.getInstance().getStatus() is designed to obtain the current status of a license, which is represented by the Status class. Within this class, the isValid() method provides a boolean response that indicates whether the license status is valid. In the event that isValid() returns false, the system assigns an error code and an accompanying error message. This information is crucial as it offers detailed insights into the specific reasons for the invalid license status, thereby assisting users in diagnosing the underlying issues.

To obtain the error code and the corresponding error message, you can use the methods License.getInstance().getStatus().getCode() and License.getInstance().getStatus().getMessage(), respectively.

You can add a listener for license status changes, which will trigger notifications when the license status code changes. This is especially useful if the license validation process runs in a separate thread or if you have a long-running application. With this listener, you will be informed when the license status changes (for example, if it expires or if you disable the license). The licensing library starts a timer task after a successful license. For node-locked licenses it tries to validate license daily, for floating licenses it tries to validate the license each 10 minutes.

License.getInstance().setStatusChangeListener((status) -> {
    // do anything depending on status
});


When log level is set to error or higher, following logs are also send with logging framework.

Error Codes and Messages




Home rarr Documents rarr License Library rarr License Status and Errors