public void removeLocator(final Class<? extends AssetLocator> locatorType, String rootPath){ ArrayList<ImplThreadLocal<AssetLocator>> locatorsToRemove = new ArrayList<ImplThreadLocal<AssetLocator>>(); Iterator<ImplThreadLocal<AssetLocator>> it = locatorsList.iterator(); while (it.hasNext()){ ImplThreadLocal locator = it.next(); if (locator.getPath().equals(rootPath) && locator.getTypeClass().equals(locatorType)){ //it.remove(); // copy on write list doesn't support iterator remove, // must use temporary list locatorsToRemove.add(locator); } } locatorsList.removeAll(locatorsToRemove); }
public void removeLocator(final Class<?> locatorType, String rootPath){ synchronized (genericLocators){ Iterator<ImplThreadLocal> it = genericLocators.iterator(); while (it.hasNext()){ ImplThreadLocal locator = it.next(); if (locator.getPath().equals(rootPath) && locator.getTypeClass().equals(locatorType)){ it.remove(); } } } }
public void removeLocator(final Class<? extends AssetLocator> locatorType, String rootPath){ ArrayList<ImplThreadLocal<AssetLocator>> locatorsToRemove = new ArrayList<ImplThreadLocal<AssetLocator>>(); Iterator<ImplThreadLocal<AssetLocator>> it = locatorsList.iterator(); while (it.hasNext()){ ImplThreadLocal locator = it.next(); if (locator.getPath().equals(rootPath) && locator.getTypeClass().equals(locatorType)){ //it.remove(); // copy on write list doesn't support iterator remove, // must use temporary list locatorsToRemove.add(locator); } } locatorsList.removeAll(locatorsToRemove); }
/** * Attempts to locate the given resource name. * @param name The full name of the resource. * @return The AssetInfo containing resource information required for * access, or null if not found. */ public AssetInfo tryLocate(AssetKey key){ synchronized (genericLocators){ if (genericLocators.size() == 0) return null; for (ImplThreadLocal local : genericLocators){ AssetLocator locator = (AssetLocator) local.get(); if (local.getPath() != null){ locator.setRootPath((String) local.getPath()); } AssetInfo info = locator.locate(owner, key); if (info != null) return info; } } return null; }