Documentation ¶
Index ¶
- Variables
- func WithErrorHandler(handler ExceptionHandler) _PoolExecutorOption
- func WithExecuteTimeout(ts time.Duration) _PoolExecutorOption
- func WithMaxBlockingTasks(max int) _PoolExecutorOption
- func WithMaxConcurrent(concurrent int) _PoolExecutorOption
- func WithRejectionHandler(handler RejectionHandler) _PoolExecutorOption
- type Callable
- type CallableFunc
- type CallerRunsRejectionPolicy
- type CancelFunc
- type CatchFunction
- type DiscardErrorHandler
- type DiscardRejectionPolicy
- type ErrInvalidState
- type ErrPanic
- type ErrorHandlerFunc
- type ExceptionHandler
- type Executor
- type ExecutorService
- type Future
- type FutureTask
- func (f *FutureTask[T]) Cancel() bool
- func (f *FutureTask[T]) Canceled() bool
- func (f *FutureTask[T]) Catch(catchFunc CatchFunction) Future[T]
- func (f *FutureTask[T]) Completed() bool
- func (f *FutureTask[T]) CompletedError() bool
- func (f *FutureTask[T]) Get(ctx context.Context) (T, error)
- func (f *FutureTask[T]) Run(ctx context.Context)
- func (f *FutureTask[T]) Then(thenFunc ThenFunction[T]) Future[T]
- type NoopErrorHandler
- type NoopRejectionPolicy
- type PoolExecutor
- type PoolScheduleExecutor
- type RejectionHandler
- type Runnable
- type RunnableFunc
- type ScheduledExecutor
- type ThenFunction
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRejectedExecution = errors.New("rejected execution") ErrClosed = errors.New("closed") )
View Source
var (
ErrFutureCanceled = errors.New("future canceled")
)
Functions ¶
func WithErrorHandler ¶
func WithErrorHandler(handler ExceptionHandler) _PoolExecutorOption
func WithExecuteTimeout ¶
func WithMaxBlockingTasks ¶
func WithMaxBlockingTasks(max int) _PoolExecutorOption
func WithMaxConcurrent ¶
func WithMaxConcurrent(concurrent int) _PoolExecutorOption
func WithRejectionHandler ¶
func WithRejectionHandler(handler RejectionHandler) _PoolExecutorOption
Types ¶
type CallableFunc ¶
type CallerRunsRejectionPolicy ¶
type CallerRunsRejectionPolicy struct { }
func (CallerRunsRejectionPolicy) RejectExecution ¶
func (d CallerRunsRejectionPolicy) RejectExecution(runnable Runnable, e Executor) error
type CancelFunc ¶ added in v0.0.4
type CancelFunc = func()
type CatchFunction ¶
type CatchFunction func(err error)
type DiscardErrorHandler ¶
type DiscardErrorHandler struct { }
func (DiscardErrorHandler) CatchException ¶
func (d DiscardErrorHandler) CatchException(runnable Runnable, e error)
type DiscardRejectionPolicy ¶
type DiscardRejectionPolicy struct { }
func (DiscardRejectionPolicy) RejectExecution ¶
func (d DiscardRejectionPolicy) RejectExecution(runnable Runnable, e Executor) error
type ErrInvalidState ¶
type ErrInvalidState struct {
// contains filtered or unexported fields
}
func (ErrInvalidState) Error ¶
func (e ErrInvalidState) Error() string
type ErrorHandlerFunc ¶
func (ErrorHandlerFunc) CatchException ¶
func (f ErrorHandlerFunc) CatchException(runnable Runnable, e error)
type ExceptionHandler ¶
type Executor ¶
func NewPoolExecutor ¶
func NewPoolExecutor(opts ..._PoolExecutorOption) Executor
type ExecutorService ¶
func NewPoolExecutorService ¶
func NewPoolExecutorService[T any](opts ..._PoolExecutorOption) ExecutorService[T]
type FutureTask ¶
type FutureTask[T any] struct { // contains filtered or unexported fields }
func NewFutureTask ¶
func NewFutureTask[T any](callable Callable[T]) *FutureTask[T]
func (*FutureTask[T]) Cancel ¶
func (f *FutureTask[T]) Cancel() bool
func (*FutureTask[T]) Canceled ¶
func (f *FutureTask[T]) Canceled() bool
func (*FutureTask[T]) Catch ¶
func (f *FutureTask[T]) Catch(catchFunc CatchFunction) Future[T]
func (*FutureTask[T]) Completed ¶
func (f *FutureTask[T]) Completed() bool
func (*FutureTask[T]) CompletedError ¶
func (f *FutureTask[T]) CompletedError() bool
func (*FutureTask[T]) Then ¶
func (f *FutureTask[T]) Then(thenFunc ThenFunction[T]) Future[T]
type NoopErrorHandler ¶
type NoopErrorHandler struct { }
func (NoopErrorHandler) CatchException ¶
func (d NoopErrorHandler) CatchException(runnable Runnable, e error)
type NoopRejectionPolicy ¶
type NoopRejectionPolicy struct { }
func (NoopRejectionPolicy) RejectExecution ¶
func (d NoopRejectionPolicy) RejectExecution(runnable Runnable, e Executor) error
type PoolExecutor ¶
type PoolExecutor[T any] struct { // contains filtered or unexported fields }
func (*PoolExecutor[T]) Execute ¶
func (p *PoolExecutor[T]) Execute(r Runnable) error
type PoolScheduleExecutor ¶ added in v0.0.4
type PoolScheduleExecutor struct { *PoolExecutor[any] // contains filtered or unexported fields }
func (*PoolScheduleExecutor) Schedule ¶ added in v0.0.4
func (p *PoolScheduleExecutor) Schedule(r Runnable, delay time.Duration) (CancelFunc, error)
func (*PoolScheduleExecutor) ScheduleAtFixRate ¶ added in v0.0.4
func (p *PoolScheduleExecutor) ScheduleAtFixRate(r Runnable, period time.Duration) (CancelFunc, error)
type RejectionHandler ¶
type RunnableFunc ¶
func (RunnableFunc) Run ¶
func (r RunnableFunc) Run(ctx context.Context)
type ScheduledExecutor ¶ added in v0.0.4
type ScheduledExecutor interface { Executor Schedule(r Runnable, delay time.Duration) (CancelFunc, error) ScheduleAtFixRate(r Runnable, period time.Duration) (CancelFunc, error) }
func NewPoolScheduleExecutor ¶ added in v0.0.4
func NewPoolScheduleExecutor(opts ..._PoolExecutorOption) ScheduledExecutor
type ThenFunction ¶
type ThenFunction[T any] func(val T)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.