Guest User

Untitled

a guest
Jun 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. // Bean Wiring. (First bean invoked)
  2. <bean id="narPingTool" class="com.nuance.ndm.ou.util.NARPingTool"/>
  3.  
  4.  
  5. package com.nuance.ndm.ou.util;
  6.  
  7. public class NARPingTool {
  8.  
  9. protected final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog( getClass() );
  10.  
  11. private boolean PAUSE_LOAD = true;
  12.  
  13. private static final long DEFAULT_SLEEP_TIME = 5000;
  14. private static final int MAX_ATTEMPTS = 5;
  15.  
  16. public NARPingTool() {
  17. logger.info( "Starting up NARPingTool..." );
  18. int count = 0;
  19. while( PAUSE_LOAD ) {
  20. if( count <= MAX_ATTEMPTS ) {
  21. logger.info( "Sleeping...." + DEFAULT_SLEEP_TIME + " - Iterastion [" + count + "]");
  22. try {
  23. checkNARserverForReponse();
  24. Thread.sleep( DEFAULT_SLEEP_TIME );
  25. count++;
  26. } catch ( InterruptedException e ) {
  27. logger.error( "Thread was interrupted... - " + e.getLocalizedMessage());
  28. }
  29. logger.info( "Waking...." );
  30. } else {
  31. PAUSE_LOAD = false;
  32. }
  33. }
  34. logger.info( "Done." );
  35. }
  36.  
  37. private boolean checkNARserverForReponse() {
  38. // pseudo code only.
  39. boolean started = false;
  40. if( started ) {
  41. return true;
  42. } else {
  43. return false;
  44. }
  45. }
  46. }
Add Comment
Please, Sign In to add comment