@Test public void testRetryInit() throws LayerException, GeomajasException, InterruptedException { Assert.assertFalse(layerWithBadUrl.isUsable()); Envelope maxBounds = new Envelope(18000.0, 259500.250, 152999.75, 244500.0); try { layerWithBadUrl.paint(geoService.getCrs("EPSG:31370"), maxBounds, 1.0 / 1024.0); Assert.fail("Unusable layer should throw exception on painting"); } catch (Exception e) { } layerWithBadUrl.setBaseTmsUrl("classpath:/org/geomajas/layer/tms/tileMapCapa2.xml"); Assert.assertFalse(layerWithBadUrl.isUsable()); Thread.sleep(1000); layerWithBadUrl.paint(geoService.getCrs("EPSG:31370"), maxBounds, 1.0 / 1024.0); Assert.assertTrue(layerWithBadUrl.isUsable()); }
private void retryInit() throws GeomajasException { long now = System.currentTimeMillis(); if (now > lastInitRetry + cooldownTimeBetweenInitializationRetries) { lastInitRetry = now; try { log.debug("Retrying to (re-)initialize layer {}", getId()); postConstruct(); } catch (Exception e) { log.warn("Failed initializing layer: ", e.getMessage()); } } if (!usable) { throw new GeomajasException(ExceptionCode.LAYER_CONFIGURATION_PROBLEM); } }
TmsLayer implements RasterLayer, ProxyLayerSupport { private void retryInit() throws GeomajasException { long now = System.currentTimeMillis(); if (now > lastInitRetry + cooldownTimeBetweenInitializationRetries) { lastInitRetry = now; try { log.debug("Retrying to (re-)initialize layer {}", getId()); postConstruct(); } catch (Exception e) { log.warn("Failed initializing layer: ", e.getMessage()); } } if (!usable) { throw new GeomajasException(ExceptionCode.LAYER_CONFIGURATION_PROBLEM); } } }
TmsLayer implements RasterLayer, ProxyLayerSupport { private void retryInit() throws GeomajasException { long now = System.currentTimeMillis(); if (now > lastInitRetry + cooldownTimeBetweenInitializationRetries) { lastInitRetry = now; try { log.debug("Retrying to (re-)initialize layer {}", getId()); postConstruct(); } catch (Exception e) { log.warn("Failed initializing layer: ", e.getMessage()); } } if (!usable) { throw new GeomajasException(ExceptionCode.LAYER_CONFIGURATION_PROBLEM); } }  }
TmsLayer implements RasterLayer, ProxyLayerSupport { private void retryInit() throws GeomajasException { long now = System.currentTimeMillis(); if (now > lastInitRetry + cooldownTimeBetweenInitializationRetries) { lastInitRetry = now; try { log.debug("Retrying to (re-)initialize layer {}", getId()); postConstruct(); } catch (Exception e) { log.warn("Failed initializing layer: ", e.getMessage()); } } if (!usable) { throw new GeomajasException(ExceptionCode.LAYER_CONFIGURATION_PROBLEM); } }  @Override RasterLayerInfo getLayerInfo(); @Override CoordinateReferenceSystem getCrs(); @Override String getId(); @Api void setCooldownTimeBetweenInitializationRetries(long cooldownTimeBetweenInitializationRetries); @Override List<RasterTile> paint(CoordinateReferenceSystem boundsCrs, Envelope bounds, double scale); void setLayerInfo(RasterLayerInfo layerInfo); void setId(String id); String getBaseTmsUrl(); @Api void setBaseTmsUrl(String baseTmsUrl); String getExtension(); @Api void setExtension(String extension); String getVersion(); void setVersion(String version); LayerAuthentication getAuthentication(); @Api void setAuthentication(LayerAuthentication authentication); @Api void setUseProxy(boolean useProxy); @Api void setUseCache(boolean useCache); @Override ProxyAuthentication getProxyAuthentication(); @Api boolean isUseCache(); TileMap getTileMap(); }
TmsLayer implements RasterLayer, ProxyLayerSupport { private void retryInit() throws GeomajasException { long now = System.currentTimeMillis(); if (now > lastInitRetry + cooldownTimeBetweenInitializationRetries) { lastInitRetry = now; try { log.debug("Retrying to (re-)initialize layer {}", getId()); postConstruct(); } catch (Exception e) { log.warn("Failed initializing layer: ", e.getMessage()); } } if (!usable) { throw new GeomajasException(ExceptionCode.LAYER_CONFIGURATION_PROBLEM); } }  @Override RasterLayerInfo getLayerInfo(); @Override CoordinateReferenceSystem getCrs(); @Override String getId(); @Api void setCooldownTimeBetweenInitializationRetries(long cooldownTimeBetweenInitializationRetries); @Override List<RasterTile> paint(CoordinateReferenceSystem boundsCrs, Envelope bounds, double scale); void setLayerInfo(RasterLayerInfo layerInfo); void setId(String id); String getBaseTmsUrl(); @Api void setBaseTmsUrl(String baseTmsUrl); String getExtension(); @Api void setExtension(String extension); String getVersion(); void setVersion(String version); LayerAuthentication getAuthentication(); @Api void setAuthentication(LayerAuthentication authentication); @Api void setUseProxy(boolean useProxy); @Api void setUseCache(boolean useCache); @Override ProxyAuthentication getProxyAuthentication(); @Api boolean isUseCache(); TileMap getTileMap();  }