Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Creative commons Attribution-NonCommercial license. NO WARRANTY IS GIVEN OR IMPLIED, USE AT YOUR OWN RISK.
 package base.jee.task;
Remove expired tokens, tokens that have hit their maximum age, and expired throttle locks.
public class ExpiredTokensTask extends Task {
	private API api;
	public ExpiredTokensTask(API apithrows IOException {
		this. = api;
		// Tokens have a maximum life span of 30 days by default.
		if(api.getSettingsCache().get("session.max_age"null) == null) {
			api.getSettingsCache().set("session.max_age""" + (60*60*24*30));
		// Throttle locks are held by default for 5 minutes.
		if(api.getSettingsCache().get("throttle.auth.lockout"null) == null) {
			api.getSettingsCache().set("throttle.auth.lockout""" + (60*5));
	public void run() throws InterruptedException {
		try {
catch(IOException e) {
New to GrepCode? Check out our FAQ X