Skip to content

Instantly share code, notes, and snippets.

@davide-romanini
Last active December 13, 2015 23:59
Show Gist options
  • Save davide-romanini/4995884 to your computer and use it in GitHub Desktop.
Save davide-romanini/4995884 to your computer and use it in GitHub Desktop.
Throttle.java
package throttle;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Throttle {
/**
* Total number of "hits" allowed in periodMillis
*/
int count();
/**
* Period of time considered
*/
long periodMillis();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment