All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.peterphi.std.threading.ParamRunnable Maven / Gradle / Ivy

There is a newer version: 10.1.5
Show newest version
package com.peterphi.std.threading;

/**
 * A class encapsulating the Runnable idea, mixed with Callable - instead of having a return type, this takes an argument to be
 * passed to the run method
* * @param T * the parameter type */ public abstract class ParamRunnable { protected boolean prepared = false; public Runnable prepare(T param) { if (!prepared) { prepared = true; return new ParamRunnableShell(this, param); } else { throw new IllegalStateException("Cannot prepare() an already-prepared ParamRunnable"); } } public abstract void run(T t); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy