Documentation
¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runnable ¶
type Runnable interface {
// Executes Runnable code
Run() error
// Gracefully stops Runnable code
Stop() error
// Forces to interrupt the thread
Kill() error
// Pause the execution if suits code purposes
Pause() error
// Resume the execution if suits code purposes
Resume() error
// Verify if component is running if suits code purposes
IsRunning() bool
// Verify if component is pause
IsPaused() bool
// Verify if code execution is consumed successfulyy or not
IsComplete() bool
// Retrieve unique Id of the component instance
UUID() string
// Returns the code execution duration until the request
UpTime() time.Duration
}
Defines a single running unit of operational code
type ThreadErrorHandler ¶
type ThreadPool ¶
type ThreadPool interface {
// Add new Runnable component in the ThreadPool
Schedule(r Runnable) error
// Start execution of ThreadPool
Start() error
// Stop gracefully execution of ThreadPool
Stop() error
// Pause temporarly execution of ThreadPool
Pause() error
// Resume paused execution of ThreadPool
Resume() error
//Reset state if ThreadPool is stopped and complete
Reset() error
// Verify is ThreadPool is running
IsStarted() bool
// Verify if all allocated threads are complete
IsComplete() bool
// Verify if ThreadPool is paused
IsPaused() bool
// Stop main thread waiting for ThreadPool completion
WaitFor() error
// Set Runnable errors listener, used to report errors occured
// during ThreadPool operational time, executing scheduled
// Runnable code
SetErrorHandler(h ThreadErrorHandler)
// Prints state of running processes and number of elements in the Queue
State() string
// Sets the logger
SetLogger(l log.Logger)
}
Defined Operational interface of a Thread Pool Manager
func NewThreadPool ¶
func NewThreadPool(maxThreads int64, parallel bool) ThreadPool
Click to show internal directories.
Click to hide internal directories.