Package com.banuba.sdk.internal.threads
Class SimpleThread
- java.lang.Object
-
- java.lang.Thread
-
- com.banuba.sdk.internal.BaseWorkThread<SimpleThreadHandler>
-
- com.banuba.sdk.internal.threads.SimpleThread
-
- All Implemented Interfaces:
java.lang.Runnable
public class SimpleThread extends BaseWorkThread<SimpleThreadHandler>
General thread class for simple solutions
-
-
Constructor Summary
Constructors Constructor Description SimpleThread(java.lang.String threadName)
Create an instance of the SimpleThread
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SimpleThreadHandler
constructHandler()
void
runAndWaitForFinish(java.lang.Runnable runnable)
Add a task to the queue and wait when task will be completed<T> T
runAndWaitForResult(java.util.concurrent.Callable<T> callable)
Add a task to the queue and wait when task will be completedvoid
runAsync(java.lang.Runnable runnable)
Add a task to the queue and run the task asynchronously-
Methods inherited from class com.banuba.sdk.internal.BaseWorkThread
getHandler, postRunClear, preRunInit, releaseHandler, run, shutdown, startAndGetHandler
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
constructHandler
@NonNull protected SimpleThreadHandler constructHandler()
- Specified by:
constructHandler
in classBaseWorkThread<SimpleThreadHandler>
-
runAsync
public void runAsync(java.lang.Runnable runnable)
Add a task to the queue and run the task asynchronously
-
runAndWaitForResult
@Nullable public <T> T runAndWaitForResult(java.util.concurrent.Callable<T> callable)
Add a task to the queue and wait when task will be completed- Returns:
- result of the task
-
runAndWaitForFinish
public void runAndWaitForFinish(java.lang.Runnable runnable)
Add a task to the queue and wait when task will be completed
-
-