Source:
<code>public static void main(String[] args) { log.info("Going to start agent"); log.debug("Agent initialization started"); Properties props = System.getProperties(); for (Map.Entry<Object, Object> prop : props.entrySet()) { log.info("{}: '{}'", prop.getKey(), prop.getValue()); } log.info(""); Sigar sigar = new Sigar(); try { sigar.getMem(); } catch (SigarException e) { log.error("", e); } ApplicationContext context = new ClassPathXmlApplicationContext("spring/agent.config.xml"); String name = ((AgentConfig) context.getBean("agentConfig")).getName(); Agent agent = (Agent) context.getBean("agent"); agent.setNodeContext(Coordination.emptyContext(NodeId.agentNode(name))); agent.init(); AgentWorker agentWorker = (AgentWorker) context.getBean("agentWorker"); log.info("Agent initialized", agent.getNodeContext().getId()); try { do { agentWorker.getProfiler().stopPolling(); agent.stop(); agentLatch = new CountDownLatch(1); alive.set(false); do { try { RegistrationPack registrationPack = RegistrationPack.create(agent.getNodeContext().getId(), agentWorker.getQualifiers()); Ack ack = agent.getExchangeClient().registerNode(registrationPack); if (Ack.SUCCESS.equals(ack)) break; } catch (IOException e) { log.info("Agent can't do registration {}", agent.getNodeContext().getId(), e); log.info("Wait 10 seconds and try again"); } try { Thread.sleep(REGISTRATION_PERIOD); } catch (InterruptedException e) { <START> log.info("Agent sleep while registration interrupted: ", e); <END> } } while (true); log.info("Registration agent has been done", agent.getNodeContext().getId()); agent.start(); agentLatch.await(); } while (alive.get()); } catch (InterruptedException e) { } agentWorker.getProfiler().stopPolling(); agent.stop(); log.info("Agent finish work"); }</code><technical_language>swallow interrupts! <LINK_0></technical_language>

Target:
public static void main(String[] args) { log.info("Going to start agent"); log.debug("Agent initialization started"); Properties props = System.getProperties(); for (Map.Entry<Object, Object> prop : props.entrySet()) { log.info("{}: '{}'", prop.getKey(), prop.getValue()); } log.info(""); Sigar sigar = new Sigar(); try { sigar.getMem(); } catch (SigarException e) { log.error("", e); } ApplicationContext context = new ClassPathXmlApplicationContext("spring/agent.config.xml"); String name = ((AgentConfig) context.getBean("agentConfig")).getName(); Agent agent = (Agent) context.getBean("agent"); agent.setNodeContext(Coordination.emptyContext(NodeId.agentNode(name))); agent.init(); AgentWorker agentWorker = (AgentWorker) context.getBean("agentWorker"); log.info("Agent initialized", agent.getNodeContext().getId()); try { do { agentWorker.getProfiler().stopPolling(); agent.stop(); agentLatch = new CountDownLatch(1); alive.set(false); do { try { RegistrationPack registrationPack = RegistrationPack.create(agent.getNodeContext().getId(), agentWorker.getQualifiers()); Ack ack = agent.getExchangeClient().registerNode(registrationPack); if (Ack.SUCCESS.equals(ack)) break; } catch (IOException e) { log.info("Agent can't do registration {}", agent.getNodeContext().getId(), e); } log.info("Wait 10 seconds and try register again"); Thread.sleep(REGISTRATION_PERIOD); } while (true); log.info("Registration agent has been done", agent.getNodeContext().getId()); agent.start(); agentLatch.await(); } while (alive.get()); } catch (InterruptedException e) { } agentWorker.getProfiler().stopPolling(); agent.stop(); log.info("Agent finish work"); }