ThreadManager

de.halcony.processes.threading.ThreadManager
class ThreadManager[T] extends LogSupport

Utility class to manage multiple threads processing jobs created via the ThreadManagerBuilder

Type parameters

T

the type of the jobs being processed by the managed threads

Attributes

Graph
Supertypes
trait LogSupport
trait LazyLogger
trait LoggingMethods
trait Serializable
class Object
trait Matchable
class Any
Show all

Members list

Type members

Types

type OnErrorT = (Option[T], Throwable) => Option[(Option[T], Throwable)]

Value members

Concrete methods

def addJob(job: T): Unit
def addJobs(jobs: Seq[T]): Unit
def destroy(): Unit

stop all running threads via interrupts

stop all running threads via interrupts

Attributes

def getErrors: Seq[(Option[T], Throwable)]
def getThreadJobs: Map[Int, Option[T]]
def isAlive: Boolean

check if there are still threads alive

check if there are still threads alive

Attributes

def remainingJobs(): Int
def resetErrors(): Seq[(Option[T], Throwable)]
def setLogLevel(level: LogLevel): Unit

set the log level for this class

set the log level for this class

Value parameters

level

the log level

Attributes

def start(): ThreadManager[T]

start the thread pool

start the thread pool

Attributes

Returns

the current ThreadManager

def stop(gracePeriodMs: Long): Boolean

stop all running jobs within a grace period

stop all running jobs within a grace period

Value parameters

gracePeriodMs

the grace period (default 100ms)

Attributes

Returns

whether all threads stopped

def waitFor(timeoutMs: Long): Boolean

wait for the jobs to finish within a timeout

wait for the jobs to finish within a timeout

Value parameters

timeoutMs

the time for the job queue to be finished within

Attributes

Inherited methods

inline protected def debug(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def debug(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def error(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def error(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def info(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def info(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def logAt(inline logLevel: LogLevel, inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def trace(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def trace(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def warn(inline message: Any, inline cause: Throwable): Unit

Attributes

Inherited from:
LoggingMethods
inline protected def warn(inline message: Any): Unit

Attributes

Inherited from:
LoggingMethods