Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bean Wiring. (First bean invoked)
- <bean id="narPingTool" class="com.nuance.ndm.ou.util.NARPingTool"/>
- package com.nuance.ndm.ou.util;
- public class NARPingTool {
- protected final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog( getClass() );
- private boolean PAUSE_LOAD = true;
- private static final long DEFAULT_SLEEP_TIME = 5000;
- private static final int MAX_ATTEMPTS = 5;
- public NARPingTool() {
- logger.info( "Starting up NARPingTool..." );
- int count = 0;
- while( PAUSE_LOAD ) {
- if( count <= MAX_ATTEMPTS ) {
- logger.info( "Sleeping...." + DEFAULT_SLEEP_TIME + " - Iterastion [" + count + "]");
- try {
- checkNARserverForReponse();
- Thread.sleep( DEFAULT_SLEEP_TIME );
- count++;
- } catch ( InterruptedException e ) {
- logger.error( "Thread was interrupted... - " + e.getLocalizedMessage());
- }
- logger.info( "Waking...." );
- } else {
- PAUSE_LOAD = false;
- }
- }
- logger.info( "Done." );
- }
- private boolean checkNARserverForReponse() {
- // pseudo code only.
- boolean started = false;
- if( started ) {
- return true;
- } else {
- return false;
- }
- }
- }
Add Comment
Please, Sign In to add comment