001/* 002 * Syncany, www.syncany.org 003 * Copyright (C) 2011-2016 Philipp C. Heckel <philipp.heckel@gmail.com> 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU General Public License as published by 007 * the Free Software Foundation, either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018package org.syncany.plugins.transfer.features; 019 020import org.syncany.plugins.transfer.TransferManager; 021 022import java.lang.annotation.ElementType; 023import java.lang.annotation.Retention; 024import java.lang.annotation.RetentionPolicy; 025import java.lang.annotation.Target; 026 027/** 028 * Feature annotation to make a transfer manager more reliable by making 029 * its core methods retriable. 030 * 031 * <p>This annotation is only recognized if used on a {@link TransferManager}. If 032 * applied, it wraps the original transfer manager in a {@link RetriableFeatureTransferManager}. 033 * 034 * <p>The options that can be defined in this feature annotation are how often a method 035 * will be retried, and how long the sleep interval between these retries is. 036 * 037 * @author Christian Roth (christian.roth@port17.de) 038 */ 039@Feature(required = true) 040@Target(ElementType.TYPE) 041@Retention(RetentionPolicy.RUNTIME) 042public @interface Retriable { 043 /** 044 * Defines the number of retries each method in a transfer method will 045 * be retried if it fails. 046 */ 047 int numberRetries() default 3; 048 049 /** 050 * Defines the number of milliseconds to wait between each 051 * retry attempts. 052 */ 053 int sleepInterval() default 3000; 054}