class TimeoutRetryPolicy implements RetryPolicy {

	/**
	 * Default value for timeout (milliseconds).
	 */
	public static final long DEFAULT_TIMEOUT = 1000;

	private long timeout;

	/**
	 * Create a new instance with the timeout set to {@link #DEFAULT_TIMEOUT}.
	 */
	public TimeoutRetryPolicy() {
		this(DEFAULT_TIMEOUT);
	}

	/**
	 * Create a new instance with a configurable timeout.
	 * @param timeout timeout in milliseconds
	 * @since 2.0.2
	 */
	public TimeoutRetryPolicy(long timeout) {
		this.timeout = timeout;
	}

	/**
	 * Setter for timeout in milliseconds. Default is {@link #DEFAULT_TIMEOUT}.
	 * @param timeout how long to wait until a timeout
	 */
	public void setTimeout(long timeout) {
		this.timeout = timeout;
	}

	/**
	 * The value of the timeout.
	 * @return the timeout in milliseconds
	 */
	public long getTimeout() {
		return timeout;
	}

	/**
	 * Only permits a retry if the timeout has not expired. Does not check the exception
	 * at all.
	 *
	 * @see org.springframework.retry.RetryPolicy#canRetry(org.springframework.retry.RetryContext)
	 */
	public boolean canRetry(RetryContext context) {
		return ((TimeoutRetryContext) context).isAlive();
	}

	public void close(RetryContext context) {
	}

	public RetryContext open(RetryContext parent) {
		return new TimeoutRetryContext(parent, timeout);
	}

	public void registerThrowable(RetryContext context, Throwable throwable) {<FILL_FUNCTION_BODY>}

	private static class TimeoutRetryContext extends RetryContextSupport {

		private final long timeout;

		private final long start;

		public TimeoutRetryContext(RetryContext parent, long timeout) {
			super(parent);
			this.start = System.currentTimeMillis();
			this.timeout = timeout;
		}

		public boolean isAlive() {
			return (System.currentTimeMillis() - start) <= timeout;
		}

	}

}

		((RetryContextSupport) context).registerThrowable(throwable);
		// otherwise no-op - we only time out, otherwise retry everything...
	
<no_super_class>