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:
java.lang.Runnable
- Direct Known Subclasses:
ThreadUtil.WaitTimeout
public abstract class WaitTimeout<a> extends java.lang.Object implements java.lang.Runnableabstract class to run uninteruptable stuff in an interruptable thread
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringbaseName
-
Constructor Summary
Constructors Constructor Description WaitTimeout(int millis)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBaseName()agetWaitedObject()intgetWaitMillis()protected abstract ahandle()this is the handle routine that may take longer
it should return the expected object when completedapeekWaitedObject()voidrun()voidsetBaseName(java.lang.String baseName)protected voidsetup()called prior to starting thread, overwrite to initialize in the constructorvoidstart()start the threadjava.lang.StringtoString()
-
-
-
Method Detail
-
handle
protected abstract a 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
public java.lang.String getBaseName()
- Returns:
- the baseName
-
setBaseName
public void setBaseName(java.lang.String baseName)
- 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()
- Specified by:
runin interfacejava.lang.Runnable- See Also:
Runnable.run()
-
getWaitedObject
public final a getWaitedObject()
- Returns:
- the object that you waited for, null if the timeout is reached
-
peekWaitedObject
public final a peekWaitedObject()
- Returns:
- the object that you waited for, if it has been calculated
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
-