/** * Determines the fetch attributes from the current node. * * @return fetch attributes to use. * @since 0.7 */ private FetchAttributes getFetchAttributes() { final FetchAttributes attributes = new FetchAttributes(); final String fetchHint = (String) getAttribute(Goto.ATTRIBUTE_FETCHHINT); if (fetchHint != null) { attributes.setFetchHint(fetchHint); } final String fetchTimeout = (String) getAttribute(Goto.ATTRIBUTE_FETCHTIMEOUT); if (fetchTimeout != null) { final TimeParser parser = new TimeParser(fetchTimeout); final long seconds = parser.parse(); attributes.setFetchTimeout(seconds); } final String maxage = (String) getAttribute(Goto.ATTRIBUTE_MAXAGE); if (maxage != null) { final TimeParser parser = new TimeParser(maxage); final long seconds = parser.parse(); attributes.setMaxage(seconds); } final String maxstale = (String) getAttribute(Goto.ATTRIBUTE_MAXSTALE); if (maxstale != null) { final TimeParser parser = new TimeParser(maxstale); final long seconds = parser.parse(); attributes.setMaxstale(seconds); } return attributes; }
/** * Retrieves the maxstale attribute as msec. * * @return number of milliseconds, <code>-1</code> if the value can not be converted to a number. * @since 0.6 */ public long getMaxstaleAsMsec() { final String timeout = getMaxage(); final TimeParser parser = new TimeParser(timeout); return parser.parse(); }
/** * Retrieves the fetchtimeout attribute as msec. * * @return number of milliseconds, <code>-1</code> if the value can not be converted to a number. * @since 0.6 */ public long getFetchTimeoutAsMsec() { final String timeout = getFetchtimeout(); final TimeParser parser = new TimeParser(timeout); return parser.parse(); }