@Test public void testHeartbeat_nullClient() { Agent agent = new Agent(); Assert.assertNull( agent.getMessagingClient()); HeartbeatTask task = new HeartbeatTask( agent ); task.run(); }
@Override public void run() { if( Utils.isEmptyOrWhitespaces( this.agent.getApplicationName()) || Utils.isEmptyOrWhitespaces( this.agent.getScopedInstancePath()) || this.agent.resetInProgress.get()) return; try { MsgNotifHeartbeat heartBeat = new MsgNotifHeartbeat( this.agent.getApplicationName(), this.agent.getScopedInstancePath(), this.agent.getIpAddress()); heartBeat.setModelRequired( this.agent.needsModel()); this.logger.finer( "Model is required by the agent: " + heartBeat.isModelRequired()); IAgentClient messagingClient = this.agent.getMessagingClient(); if( messagingClient != null && messagingClient.isConnected()) messagingClient.sendMessageToTheDm( heartBeat ); } catch( Exception e ) { this.logger.severe( e.getMessage()); Utils.logException( this.logger, e ); } }
HeartbeatTask extends TimerTask { @Override public void run() { if( Utils.isEmptyOrWhitespaces( this.agent.getApplicationName()) || Utils.isEmptyOrWhitespaces( this.agent.getScopedInstancePath()) || this.agent.resetInProgress.get()) return; try { MsgNotifHeartbeat heartBeat = new MsgNotifHeartbeat( this.agent.getApplicationName(), this.agent.getScopedInstancePath(), this.agent.getIpAddress()); heartBeat.setModelRequired( this.agent.needsModel()); this.logger.finer( "Model is required by the agent: " + heartBeat.isModelRequired()); IAgentClient messagingClient = this.agent.getMessagingClient(); if( messagingClient != null && messagingClient.isConnected()) messagingClient.sendMessageToTheDm( heartBeat ); } catch( Exception e ) { this.logger.severe( e.getMessage()); Utils.logException( this.logger, e ); } } }
HeartbeatTask extends TimerTask { @Override public void run() { if( Utils.isEmptyOrWhitespaces( this.agent.getApplicationName()) || Utils.isEmptyOrWhitespaces( this.agent.getScopedInstancePath()) || this.agent.resetInProgress.get()) return; try { MsgNotifHeartbeat heartBeat = new MsgNotifHeartbeat( this.agent.getApplicationName(), this.agent.getScopedInstancePath(), this.agent.getIpAddress()); heartBeat.setModelRequired( this.agent.needsModel()); this.logger.finer( "Model is required by the agent: " + heartBeat.isModelRequired()); IAgentClient messagingClient = this.agent.getMessagingClient(); if( messagingClient != null && messagingClient.isConnected()) messagingClient.sendMessageToTheDm( heartBeat ); } catch( Exception e ) { this.logger.severe( e.getMessage()); Utils.logException( this.logger, e ); } } HeartbeatTask( Agent agent ); }
HeartbeatTask extends TimerTask { @Override public void run() { if( Utils.isEmptyOrWhitespaces( this.agent.getApplicationName()) || Utils.isEmptyOrWhitespaces( this.agent.getScopedInstancePath()) || this.agent.resetInProgress.get()) return; try { MsgNotifHeartbeat heartBeat = new MsgNotifHeartbeat( this.agent.getApplicationName(), this.agent.getScopedInstancePath(), this.agent.getIpAddress()); heartBeat.setModelRequired( this.agent.needsModel()); this.logger.finer( "Model is required by the agent: " + heartBeat.isModelRequired()); IAgentClient messagingClient = this.agent.getMessagingClient(); if( messagingClient != null && messagingClient.isConnected()) messagingClient.sendMessageToTheDm( heartBeat ); } catch( Exception e ) { this.logger.severe( e.getMessage()); Utils.logException( this.logger, e ); } } HeartbeatTask( Agent agent ); @Override void run(); }
HeartbeatTask extends TimerTask { @Override public void run() { if( Utils.isEmptyOrWhitespaces( this.agent.getApplicationName()) || Utils.isEmptyOrWhitespaces( this.agent.getScopedInstancePath()) || this.agent.resetInProgress.get()) return; try { MsgNotifHeartbeat heartBeat = new MsgNotifHeartbeat( this.agent.getApplicationName(), this.agent.getScopedInstancePath(), this.agent.getIpAddress()); heartBeat.setModelRequired( this.agent.needsModel()); this.logger.finer( "Model is required by the agent: " + heartBeat.isModelRequired()); IAgentClient messagingClient = this.agent.getMessagingClient(); if( messagingClient != null && messagingClient.isConnected()) messagingClient.sendMessageToTheDm( heartBeat ); } catch( Exception e ) { this.logger.severe( e.getMessage()); Utils.logException( this.logger, e ); } } HeartbeatTask( Agent agent ); @Override void run();  }