Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Scheduled(fixedDelayString = "${checkInterval}", initialDelayString = "${checkDelay}")
- private final void monitorHealth() {
- if(!isReady) {
- return;
- }
- try (QueryCursor<Entry<Integer, FabricInfo>> cursor = fabricInfoCache.query(SQL_QUERY)) {
- // Do nothing except reset the query time out counter..
- if(retryCount != 0) {
- retryCount = 0;
- LOGGER.warn("Client health check query executed without getting timed out before the configured maximum number of timeout retries was reached. Reseting retryCount to zero.");
- }
- } catch (Exception e) {
- if(e.getCause() instanceof QueryCancelledException) {
- retryCount++;
- LOGGER.warn("Client health check query timed out for the {} time.", retryCount);
- if(retryCount > QUERY_MAX_RETRIES_VALUE) {
- // Query timed out the maximum number of times..
- LOGGER.error("Client health check query timed out repeatedly for the maximum number of times configured : {}. Initating a disconnect-reconnect.", retryCount);
- reconnectAction();
- }
- } else {
- if (e.getCause() instanceof IgniteClientDisconnectedException) {
- LOGGER.error("Client health check query failed due to client node getting disconnected from cluster. Initating a disconnect-reconnect.", e.getCause());
- } else {
- // Treat other failures like CacheStoppedException, etc same as IgniteClientDisconnectedException...
- LOGGER.error("Client health check query failed. Initating a disconnect-reconnect.", e.getCause());
- }
- reconnectAction();
- }
- }
- }
Add Comment
Please, Sign In to add comment