public <T> void onPostExecute(Callable<T> task) { try { Iterator<DistributedTaskLifecycle> i = loader.iterator(); while (i.hasNext()) { DistributedTaskLifecycle cl = i.next(); cl.onPostExecute(task); } } catch (ServiceConfigurationError serviceError) { log.errorReadingProperties( new IOException( "Could not properly load and instantiate DistributedTaskLifecycle service ", serviceError)); } }
/** * Reads the contents of a named sub element within a given element, and attempts to parse the contents as a Java * properties file. * <p/> * E.g., if you have a {@link Element} which represents the following XML snippet: * <p/> * <pre> * <props> * my.attrib.1 = blah * my.attrib.2 = blahblah * </props> * <pre> * <p/> * The following results could be expected: * <p/> * <pre> * Properties p = readPropertiesContents(element, "props"); * p.getProperty("my.attrib.1"); // blah * p.getProperty("my.attrib.2"); // blahblah * </pre> * None of the parameters should be null - otherwise the method may throw a NullPointerException. * * @param element - element to search through. * @param elementName - name of the element to find within the element passed in * @return a {@link Properties} object, never null. * @throws IOException if unable to parse the contents of the element */ public static Properties readPropertiesContents(Element element, String elementName) { String stringContents = readStringContents(element, elementName); if (stringContents == null) return new Properties(); stringContents = escapeBackslashes(stringContents); ByteArrayInputStream is; Properties properties; try { is = new ByteArrayInputStream(stringContents.trim().getBytes("ISO8859_1")); properties = new Properties(); properties.load(is); is.close(); } catch (IOException e) { log.errorReadingProperties(e); throw new CacheConfigurationException( "Exception occured while reading properties from XML document", e); } return properties; }