<commit_before>package com.voodoodyne.gstrap.gae.taskqueue;

import com.google.appengine.api.taskqueue.DeferredTask;
import com.google.inject.Injector;
import lombok.extern.slf4j.Slf4j;

import javax.inject.Inject;

/**
 * A deferred task that performs Guice injection on itself before executing.
 * Note that this class needs guice configuration for requestStaticInjection(GuicyDeferredTask.class);
 * All injected fields should be transient! Otherwise they will get serialized and that's probably bad.
 */
@Slf4j
abstract public class GuicyDeferredTask implements DeferredTask
{
	private static final long serialVersionUID = -9079779277109762232L;

	@Inject protected static Injector injector;
	
	/** Perform guice injection and then continue */
	@Override
	public final void run() {
		try {
			log.debug("Running task " + this);
	    	injector.injectMembers(this);
	    	this.run2();
		} catch (RuntimeException ex) {
			log.error("Error running task " + this, ex);
			throw ex;
		}
	}
	
	/** Implement this instead of run(), executed after guice injection */
	abstract protected void run2();

	/**
	 * If you just call Queues.add(), this will be the queue used. You can of course
	 * explicitly add tasks to any queue.
	 */
	abstract public QueueHelper defaultQueue();

	/** Add to the default queue */
	public void add() {
		defaultQueue().add(this);
	}
}
<commit_msg>Add extra task add() method with countdown<commit_after>package com.voodoodyne.gstrap.gae.taskqueue;

import com.google.appengine.api.taskqueue.DeferredTask;
import com.google.inject.Injector;
import lombok.extern.slf4j.Slf4j;

import javax.inject.Inject;

/**
 * A deferred task that performs Guice injection on itself before executing.
 * Note that this class needs guice configuration for requestStaticInjection(GuicyDeferredTask.class);
 * All injected fields should be transient! Otherwise they will get serialized and that's probably bad.
 */
@Slf4j
abstract public class GuicyDeferredTask implements DeferredTask
{
	private static final long serialVersionUID = -9079779277109762232L;

	@Inject protected static Injector injector;
	
	/** Perform guice injection and then continue */
	@Override
	public final void run() {
		try {
			log.debug("Running task " + this);
	    	injector.injectMembers(this);
	    	this.run2();
		} catch (RuntimeException ex) {
			log.error("Error running task " + this, ex);
			throw ex;
		}
	}
	
	/** Implement this instead of run(), executed after guice injection */
	abstract protected void run2();

	/**
	 * If you just call Queues.add(), this will be the queue used. You can of course
	 * explicitly add tasks to any queue.
	 */
	abstract public QueueHelper defaultQueue();

	/** Add to the default queue */
	public void add() {
		defaultQueue().add(this);
	}

	/**
	 * Convenience method
	 */
	public void add(final long countdownMillis) {
		defaultQueue().withCountdownMillis(countdownMillis).add(this);
	}
}

{'fraction_non_alphanumeric': 0.09678522571819426, 'fraction_numerical': 0.016415868673050615, 'mean_word_length': 4.131578947368421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2565492', 'n_tokens_mistral': 928, 'n_tokens_neox': 852, 'n_words': 288}