10Duke Scale SDK for Java
Loading...
Searching...
No Matches
tenduke.scale.client.DefaultHeartbeatFailureHandler Class Reference

Detailed Description

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.

Inheritance diagram for tenduke.scale.client.DefaultHeartbeatFailureHandler:
tenduke.scale.api.HeartbeatFailureHandler

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.
Parameters
heartbeatArgumentsThe original arguments used for the heartbeat request, containing information like lease ID and other context.
failedResultThe JWT token result from the failed heartbeat operation, which may contain error information in its claims.
Returns
true if the token should be invalidated (deleted), false otherwise.

 

Member Function Documentation

◆ shouldInvalidateToken()

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.

Parameters
heartbeatArgumentsThe original arguments used for the heartbeat request, containing information like lease ID and other context.
failedResultThe JWT token result from the failed heartbeat operation, which may contain error information in its claims.
Returns
true if the token should be invalidated (deleted), false otherwise.

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.

Parameters
heartbeatArgumentsThe original arguments used for the heartbeat request
failedResultThe JWT token result from the failed heartbeat operation.
Returns
true if the error code indicates the token should be invalidated, false otherwise

Implements tenduke.scale.api.HeartbeatFailureHandler.


The documentation for this class was generated from the following file: