public NetworkHealthCheck parseURIList(String addressList) { if (addressList != null) { String[] addresses = addressList.split(","); for (String address : addresses) { if (!address.trim().isEmpty()) { try { this.addURL(new URL(address.trim())); } catch (Exception e) { ActiveMQUtilLogger.LOGGER.failedToParseUrlList(e, addressList); } } } } return this; }
public NetworkHealthCheck parseURIList(String addressList) { if (addressList != null) { String[] addresses = addressList.split(","); for (String address : addresses) { if (!address.trim().isEmpty()) { try { this.addURL(new URL(address.trim())); } catch (Exception e) { ActiveMQUtilLogger.LOGGER.failedToParseUrlList(e, addressList); } } } } return this; }
public NetworkHealthCheck parseURIList(String addressList) { if (addressList != null) { String[] addresses = addressList.split(","); for (String address : addresses) { if (!address.trim().isEmpty()) { try { this.addURL(new URL(address.trim())); } catch (Exception e) { ActiveMQUtilLogger.LOGGER.failedToParseUrlList(e, addressList); } } } } return this; }
public NetworkHealthCheck parseURIList(String addressList) { if (addressList != null) { String[] addresses = addressList.split(","); for (String address : addresses) { if (!address.trim().isEmpty()) { try { this.addURL(new URL(address.trim())); } catch (Exception e) { ActiveMQUtilLogger.LOGGER.failedToParseUrlList(e, addressList); } } } } return this; }
public NetworkHealthCheck parseURIList(String addressList) { if (addressList != null) { String[] addresses = addressList.split(","); for (String address : addresses) { if (!address.trim().isEmpty()) { try { this.addURL(new URL(address.trim())); } catch (Exception e) { ActiveMQUtilLogger.LOGGER.failedToParseUrlList(e, addressList); } } } } return this; }
public NetworkHealthCheck parseURIList(String addressList) { if (addressList != null) { String[] addresses = addressList.split(","); for (String address : addresses) { if (!address.trim().isEmpty()) { try { this.addURL(new URL(address.trim())); } catch (Exception e) { ActiveMQUtilLogger.LOGGER.failedToParseUrlList(e, addressList); } } } } return this; }
public NetworkHealthCheck parseURIList(String addressList) { if (addressList != null) { String[] addresses = addressList.split(","); for (String address : addresses) { if (!address.trim().isEmpty()) { try { this.addURL(new URL(address.trim())); } catch (Exception e) { ActiveMQUtilLogger.LOGGER.failedToParseUrlList(e, addressList); } } } } return this; }
@Test public void testCheckUsingHTTP() throws Exception { startHTTPServer(); NetworkHealthCheck check = addCheck(new NetworkHealthCheck(null, 100, 1000)); Assert.assertTrue(check.check(new URL("http://localhost:8787"))); stopHTTPServer(); Assert.assertFalse(check.check(new URL("http://localhost:8787"))); check.addComponent(component); URL url = new URL("http://localhost:8787"); Assert.assertFalse(check.check(url)); startHTTPServer(); Assert.assertTrue(check.check(url)); check.addURL(url); Assert.assertFalse(latch.await(500, TimeUnit.MILLISECONDS)); Assert.assertTrue(component.isStarted()); // stopping the web server should stop the component stopHTTPServer(); Assert.assertTrue(latch.await(10, TimeUnit.SECONDS)); Assert.assertFalse(component.isStarted()); latch.setCount(1); startHTTPServer(); Assert.assertTrue(latch.await(10, TimeUnit.SECONDS)); Assert.assertTrue(component.isStarted()); }