POEx::WorkerPool::Role::WorkerPool - A role that provides common semantics for WorkerPools
version 1.101610
is: ro, isa: ArrayRef[ClassName], required: 1
In order for the serializer on the other side of the process boundary to rebless jobs on the other side, it needs to make sure that the classes are loaded.
This attribute is used to indicate which classes need to be loaded.
is: ro, isa: HashRef
options is the same options that would be passed to Sessions. Setting trace to 1 will allow tracing for the Workers.
POEx::WorkerPool->new(options => { trace => 1 });
is: ro, isa: enum([qw|round_robin fill_up|]), default: round_robin
This attribute specifies the queue type for the WorkerPool and changes how workers are pulled from the pool
is: ro, isa: Int, default: 5
This determines how many workers the Pool will spin up
is: rw, isa: ScalarRef
This stores the current index into workers. Dereference to manipulate the Int value.
is: ro, isa: ArrayRef[Worker]
This attribute holds all of the workers in the pool
This attribute let's the workers know how many jobs their queue can hold
returns Int
This is a convenience method for incrementing the index and wrapping around when it exceeds max_workers
returns (DoesWorker)
This returns the next worker in the pool as determined by the queue_type attribute.
For round_robin, it will return the next immediate worker if isn't active. fill_up will continue to return the same worker until its job queue is full.
If it is unable to return a suitable worker (all of the workers are currently active or all of their job queues are full, etc), it will throw a POEx::WorkerPool::Error::NoAvailableWorkers exception.
(DoesJob $job) returns (SessionAlias)
This method grabs the next available worker, enqueues the job, starts the worker's queue processing and returns the worker's pubsub alias that can be used to subscribe to various events that the worker fires.
This method will halt any active workers in the worker pool and force them to release resouces and clean up.
Nicholas R. Perez <nperez@cpan.org>
This software is copyright (c) 2010 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install POEx::WorkerPool, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POEx::WorkerPool
CPAN shell
perl -MCPAN -e shell install POEx::WorkerPool
For more information on module installation, please visit the detailed CPAN module installation guide.