Guest User

Untitled

a guest
Jul 16th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. @Scheduled(fixedDelayString = "${checkInterval}", initialDelayString = "${checkDelay}")
  2. private final void monitorHealth() {
  3. if(!isReady) {
  4. return;
  5. }
  6. try (QueryCursor<Entry<Integer, FabricInfo>> cursor = fabricInfoCache.query(SQL_QUERY)) {
  7. // Do nothing except reset the query time out counter..
  8. if(retryCount != 0) {
  9. retryCount = 0;
  10. 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.");
  11. }
  12. } catch (Exception e) {
  13. if(e.getCause() instanceof QueryCancelledException) {
  14. retryCount++;
  15. LOGGER.warn("Client health check query timed out for the {} time.", retryCount);
  16.  
  17. if(retryCount > QUERY_MAX_RETRIES_VALUE) {
  18. // Query timed out the maximum number of times..
  19. LOGGER.error("Client health check query timed out repeatedly for the maximum number of times configured : {}. Initating a disconnect-reconnect.", retryCount);
  20. reconnectAction();
  21. }
  22. } else {
  23. if (e.getCause() instanceof IgniteClientDisconnectedException) {
  24. LOGGER.error("Client health check query failed due to client node getting disconnected from cluster. Initating a disconnect-reconnect.", e.getCause());
  25. } else {
  26. // Treat other failures like CacheStoppedException, etc same as IgniteClientDisconnectedException...
  27. LOGGER.error("Client health check query failed. Initating a disconnect-reconnect.", e.getCause());
  28. }
  29. reconnectAction();
  30. }
  31. }
  32. }
Add Comment
Please, Sign In to add comment