func (rs *PoolService) AvailableWorkers() int {
	return rs.workerPool.getPoolSize() - rs.workerPool.getActiveWorkers()
}
AvailableWorkers returns available workers out of total workers
package gohive
import (
	"fmt"
	"github.com/pkg/errors"
	"os"
)
const DefaultPoolSize = 10
var ErrInvalidPoolSize = errors.New("Invalid pool size: pool size must be a positive number")
var ErrInvalidPoolState = errors.New("Pool is closed: cannot assign task to a closed pool")
var ErrNilFunction = errors.New("Cannot submit Nil function()")
type PoolService struct {
	workerPool *pool
	taskQueue *TaskQueue
	poolSize int
}
func NewDefaultSizePool() *PoolService {
	poolService := &PoolService{
		taskQueue: NewTaskQueue(),
		poolSize:  DefaultPoolSize,
	}
	pool := newPool(DefaultPoolSize, poolService)
	poolService.workerPool = pool
	return poolService
}
func NewFixedSizePool(nGoRoutines int) *PoolService {
	if nGoRoutines <= 0 {
		panic(ErrInvalidPoolSize)
	}
	poolService := &PoolService{
		taskQueue: NewTaskQueue(),
		poolSize:  nGoRoutines,
	}
	pool := newPool(nGoRoutines, poolService)
	poolService.workerPool = pool
	return poolService
}
func (rs *PoolService) Submit(fun func()) error {
	if fun == nil {
		return ErrNilFunction
	}
	if rs.workerPool.status == CLOSED {
		return ErrInvalidPoolState
	}
	newTask := Task{executable: fun}
	if rs.workerPool.isWorkerAvailable() {
		rs.workerPool.assignTask(newTask)
	} else {
		rs.taskQueue.EnqueueTask(newTask)
	}
	return nil
}
func (rs *PoolService) notify() {
	if rs.taskQueue.IsNotEmpty() {
		task, err := rs.taskQueue.DequeueTask()
		if err != nil {
			fmt.Fprintf(os.Stderr, "Error Dequeueing Task")
			return
		}
		rs.workerPool.assignTask(task)
	}
}
func (rs *PoolService) ActiveWorkers() int {
	return rs.workerPool.getActiveWorkers()
}
func (rs *PoolService) PoolSize() int {
	return rs.workerPool.getPoolSize()
}