Package org.cip4.jdflib.util.thread
Class WaitTimeout<a>
java.lang.Object
org.cip4.jdflib.util.thread.WaitTimeout<a>
- Type Parameters:
a- the returned object data type
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
ThreadUtil.WaitTimeout
abstract class to run uninteruptable stuff in an interruptable thread
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal aintprotected abstract ahandle()this is the handle routine that may take longer
it should return the expected object when completedfinal afinal voidrun()voidsetBaseName(String baseName) protected voidsetup()called prior to starting thread, overwrite to initialize in the constructorfinal voidstart()start the threadtoString()
-
Field Details
-
baseName
-
-
Constructor Details
-
WaitTimeout
public WaitTimeout(int millis) - Parameters:
millis- wait timeout in milliseconds
-
-
Method Details
-
handle
this is the handle routine that may take longer
it should return the expected object when completed- Returns:
- the object that this whole class is about
-
setup
protected void setup()called prior to starting thread, overwrite to initialize in the constructor -
getBaseName
- Returns:
- the baseName
-
setBaseName
- Parameters:
baseName- the baseName to set
-
getWaitMillis
public int getWaitMillis()- Returns:
- the waitMillis
-
start
public final void start()start the thread -
run
public final void run() -
getWaitedObject
- Returns:
- the object that you waited for, null if the timeout is reached
-
peekWaitedObject
- Returns:
- the object that you waited for, if it has been calculated
-
toString
-