|
10Duke Scale SDK for Java
|
Default implementation of HeartbeatFailureHandler that handles automatic token invalidation based on critical server error codes.
This handler identifies specific error codes that indicate a permanent client-side issue with the token and triggers its removal from local storage. The error codes are based on the 10Duke Scale API license consumption error responses documentation.
For more context on these error codes, please refer to: https://docs.scale.10duke.com.
Public Member Functions | |||||
| boolean | shouldInvalidateToken (final LicenseHeartbeatArguments heartbeatArguments, final JwtToken failedResult) | ||||
Determines whether a license token should be invalidated based on a failed heartbeat.This method is called when a heartbeat operation fails, providing both the original heartbeat arguments and the failed JWT result. The implementation should analyze the failure reason and return true if the token should be removed from local storage.
| |||||
| boolean tenduke.scale.client.DefaultHeartbeatFailureHandler.shouldInvalidateToken | ( | final LicenseHeartbeatArguments | heartbeatArguments, |
| final JwtToken | failedResult ) |
Determines whether a license token should be invalidated based on a failed heartbeat.This method is called when a heartbeat operation fails, providing both the original heartbeat arguments and the failed JWT result. The implementation should analyze the failure reason and return true if the token should be removed from local storage.
| heartbeatArguments | The original arguments used for the heartbeat request, containing information like lease ID and other context. |
| failedResult | The JWT token result from the failed heartbeat operation, which may contain error information in its claims. |
This implementation checks if the failed JWT result contains an error code that matches one of the critical error codes defined in CRITICAL_ERROR_CODES. If a match is found, the token is marked for invalidation.
| heartbeatArguments | The original arguments used for the heartbeat request |
| failedResult | The JWT token result from the failed heartbeat operation. |
Implements tenduke.scale.api.HeartbeatFailureHandler.