@Test @Ignore("service loader does return same instance") public void newInstanceReturned() { Engine engine0 = EngineHelper.findByFileExtension(".js", false); Engine engine1 = EngineHelper.findByFileExtension(".js", false); assertThat(engine0, not(sameInstance(engine1))); }
static public Engine findByFileExtension(String fileExtension, boolean invalidateCache) { if (invalidateCache) { ENGINE_LOADER.reload(); } Iterator<Engine> iterator = ENGINE_LOADER.iterator(); while (iterator.hasNext()) { Engine engine = iterator.next(); List<String> exts = engine.getFileExtensions(); for (String ext : exts) { if (ext.equals(fileExtension)) { return engine; } } } return null; }
EngineHelper { static public Engine findByFileExtension(String fileExtension, boolean invalidateCache) { if (invalidateCache) { ENGINE_LOADER.reload(); } Iterator<Engine> iterator = ENGINE_LOADER.iterator(); while (iterator.hasNext()) { Engine engine = iterator.next(); List<String> exts = engine.getFileExtensions(); for (String ext : exts) { if (ext.equals(fileExtension)) { return engine; } } } return null; } }
EngineHelper { static public Engine findByFileExtension(String fileExtension, boolean invalidateCache) { if (invalidateCache) { ENGINE_LOADER.reload(); } Iterator<Engine> iterator = ENGINE_LOADER.iterator(); while (iterator.hasNext()) { Engine engine = iterator.next(); List<String> exts = engine.getFileExtensions(); for (String ext : exts) { if (ext.equals(fileExtension)) { return engine; } } } return null; }  }
EngineHelper { static public Engine findByFileExtension(String fileExtension, boolean invalidateCache) { if (invalidateCache) { ENGINE_LOADER.reload(); } Iterator<Engine> iterator = ENGINE_LOADER.iterator(); while (iterator.hasNext()) { Engine engine = iterator.next(); List<String> exts = engine.getFileExtensions(); for (String ext : exts) { if (ext.equals(fileExtension)) { return engine; } } } return null; }  static Engine findByFileExtension(String fileExtension, boolean invalidateCache); }
EngineHelper { static public Engine findByFileExtension(String fileExtension, boolean invalidateCache) { if (invalidateCache) { ENGINE_LOADER.reload(); } Iterator<Engine> iterator = ENGINE_LOADER.iterator(); while (iterator.hasNext()) { Engine engine = iterator.next(); List<String> exts = engine.getFileExtensions(); for (String ext : exts) { if (ext.equals(fileExtension)) { return engine; } } } return null; }  static Engine findByFileExtension(String fileExtension, boolean invalidateCache);  }