org.apache.river.thread
packageorg.apache.river.thread
package contains various
thread-related utility classes and interfaces. These classes and interfaces
are not intended for general use, but are used internally by other parts of
the Apache River release. Some of these classes
and interfaces are exposed via the configuration mechanism.
org.apache.river.thread.WakeupManager
.
WakeupManager
instances are used to schedule tasks that need
to be run in the future. Many of the services and utilities in the starter
kit obtain the required WakeupManager
instances from their
configuration.
WakeupManager.ThreadDesc
Class Can Now Be More
Usefully Subclassed and Has Been Made More Accessible
WakeupManager.ThreadDesc
class are used by
WakeupManager
to create threads. A ThreadDesc
can be specified optionally when a WakeupManager
is created,
and/or when a task is scheduled that needs to be run in its own thread.
The
ThreadDesc.thread
method has been made public, which gives
subclasses of ThreadDesc
complete control over how threads are
created and allows subclasses of WakeupManager
to invoke
the ThreadDesc.thread
method.
Also, public getGroup
,
isDaemon
,
and getPriority
methods have been added to ThreadDesc
and the default
implementation of ThreadDesc.thread
has been changed to use
them. This work had been assigned issue numbers 5091282 and 6308590.
WakeupManager.Ticket
s Has Been Added to WakeupManager
WakeupManager
, the caller gets a WakeupManager.Ticket
object than can be used to remove the task if necessary. The protected
method, WakeupManager.newTicket
,
has been added so subclasses of WakeupManager
can create
Ticket
instances. This work had been assigned issue number
6264220.
WakeupManager
Only Keeps Internal Thread Running When
There Are Tasks Pending
WakeupManager
always had one running
(though often waiting) thread even if there were no pending tasks. This
version of WakeupManager
only creates its internal thread when
the first task is enqueued. It will let this thread end, after a
configurable timeout, if there are no tasks pending. This work had been
assigned issue number 6190278.