commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <>
Subject [jira] Commented: (LANG-582) Provide an implementation of the ThreadFactory interface
Date Sat, 30 Jan 2010 15:02:34 GMT


Oliver Heger commented on LANG-582:

I am not sure about the API if more configuration options are added.

On one hand I would like to avoid set methods so that all member fields can be made *final*,
and the class is immutable. On the other hand this gets messy with the various constructors.

An option could be using a _builder_. Then the creation of a {{ThreadFactoryImpl}} instance
could look as follows:

ThreadFactory factory = new ThreadFactoryImpl.Builder()
    .namePattern("my thread %d")

Would this be an option to go? I think, this is not the typical style used within [lang],
but for the use case it is appropriate.

> Provide an implementation of the ThreadFactory interface
> --------------------------------------------------------
>                 Key: LANG-582
>                 URL:
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.concurrent.*
>            Reporter: Oliver Heger
>            Priority: Minor
>             Fix For: 3.0
>         Attachments: lang-threadfactoryimpl.patch
> The Executor framework in Java 1.5 uses the {{ThreadFactory}} interface for creating
new threads on demand. Currently there is no base implementation of this interface. So if
an application needs to configure threads used by an {{ExecutorService}}, it has to create
a custom implementation.
> This is a proposal to add a default {{ThreadFactory}} implementation which allows an
application to configure some options of the threads to be created. Especially the names of
newly created threads and their daemon status can be configured. Maybe the configuration options
can be extended, e.g. for specifying a priority or an uncaught exception handler.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message