/** * Computes the number of milliseconds between the next valid date and the one after. * * @param cron the CRON String * @return the number of milliseconds between the next valid date and the one after, * with an invalid interval between */ public static long cronInterval(String cron) { return cronInterval(cron, new Date()); }
/** * Set the value of the request timeout, i.e. the number of seconds before cutting the connection - default to * 60 seconds * * @param timeout * the timeout value, e.g. "30s", "1min" * @return the WSRequest for chaining */ public WSRequest timeout(String timeout) { this.timeout = Time.parseDuration(timeout); return this; }
/** * Compute the number of milliseconds between the next valid date and the * one after * * @param cron * The CRON String * @return the number of milliseconds between the next valid date and the * one after, with an invalid interval between */ public static long cronInterval(String cron) { return cronInterval(cron, new Date()); }
public Timeout(String token, String delay) { this(token, Time.parseDuration(delay) * 1000); }
/** * Computes the number of milliseconds between the next valid date and the one after. * * @param cron the CRON String * @return the number of milliseconds between the next valid date and the one after, * with an invalid interval between */ public static long cronInterval(String cron) { return cronInterval(cron, new Date()); }
public Timeout(String delay) { this(Time.parseDuration(delay) * 1000); }
/** * Computes the number of milliseconds between the next valid date and the one after. * * @param cron the CRON String * @return the number of milliseconds between the next valid date and the one after, * with an invalid interval between */ public static long cronInterval(String cron) { return cronInterval(cron, new Date()); }
/** * Set a new cookie that will expire in (current) + duration * * @param name * the cookie name * @param value * The cookie value * @param duration * the cookie duration (Ex: 3d) */ public void setCookie(String name, String value, String duration) { setCookie(name, value, null, "/", Time.parseDuration(duration), false); }
/** * Computes the number of milliseconds between the next valid date and the one after. * * @param cron the CRON String * @return the number of milliseconds between the next valid date and the one after, * with an invalid interval between */ public static long cronInterval(String cron) { return cronInterval(cron, new Date()); }
protected static void await(String timeout, F.Action0 callback) { await(1000 * Time.parseDuration(timeout), callback); }
/** * Computes the number of milliseconds between the next valid date and the one after. * * @param cron the CRON String * @return the number of milliseconds between the next valid date and the one after, * with an invalid interval between */ public static long cronInterval(String cron) { return cronInterval(cron, new Date()); }
/** * Add a cache-control header * * @param duration * Ex: 3h */ public void cacheFor(String duration) { int maxAge = Time.parseDuration(duration); setHeader("Cache-Control", "max-age=" + maxAge); }
/** * Start this job in several seconds * * @param delay * time in seconds * @return the job completion */ public Promise<V> in(String delay) { return in(Time.parseDuration(delay)); }
/** * Run this job every n seconds * * @param delay * time in seconds */ public void every(String delay) { every(Time.parseDuration(delay)); }
protected static void await(String timeout) { await(1000 * Time.parseDuration(timeout)); }
/** * Suspend the current request for a specified amount of time. * * <p> * <b>Important:</b> The method will not resume on the line after you call this. The method will be called again as * if there was a new HTTP request. * * @param timeout * Period of time to wait, e.g. "1h" means 1 hour. * @deprecated */ @Deprecated protected static void suspend(String timeout) { suspend(1000 * Time.parseDuration(timeout)); }
/** * Add an element only if it doesn't exist and store it indefinitely. * @param key Element key * @param value Element value */ public static void add(String key, Object value) { checkSerializable(value); cacheImpl.add(key, value, Time.parseDuration(null)); }
/** * Add an element only if it doesn't exist. * @param key Element key * @param value Element value * @param expiration Ex: 10s, 3mn, 8h */ public static void add(String key, Object value, String expiration) { checkSerializable(value); cacheImpl.add(key, value, Time.parseDuration(expiration)); }
/** * Add an element only if it doesn't exist, and return only when * the element is effectively cached. * @param key Element key * @param value Element value * @param expiration Ex: 10s, 3mn, 8h * @return If the element an eventually been cached */ public static boolean safeAdd(String key, Object value, String expiration) { checkSerializable(value); return cacheImpl.safeAdd(key, value, Time.parseDuration(expiration)); }
/** * Set an element. * @param key Element key * @param value Element value * @param expiration Ex: 10s, 3mn, 8h */ public static void set(String key, Object value, String expiration) { checkSerializable(value); cacheImpl.set(key, value, Time.parseDuration(expiration)); }