software.nealk.concurrent.tasks.NonRetrievableTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nealk-sdk-concurrent-lib Show documentation
Show all versions of nealk-sdk-concurrent-lib Show documentation
An easy-to-consume concurrency library allowing for "Tasks" to execute business logic in a thread safe manner. This library helps users achieve multi-threading in their applications without worrying about synchronization and blocking for race conditions.
The newest version!
package software.nealk.concurrent.tasks;
import software.nealk.concurrent.Task;
public abstract class NonRetrievableTask implements Task{
@Override
public final synchronized void run() {
// TODO Auto-generated method stub
System.out.println("Thread "
+ Thread.currentThread().getId()
+ " is running....");
this.execute();
}
protected abstract void execute();
@Override
public final T getVal() throws InterruptedException {
throw new UnsupportedOperationException();
}
}