[
https://issues.apache.org/jira/browse/HDFS-14258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16766357#comment-16766357
]
Íñigo Goiri commented on HDFS-14258:
------------------------------------
{quote}
I am sorry. I do not understand this comment. Are you referring to Simulate
grabbing 2 threads ?? If so, this is the appropriate comment format.
{quote}
I'm referring to {{TestDataNodeReconfiguration#234}} and
{{TestDataNodeReconfiguration#249}} for example.
{quote}
I think it is more clear calling Math.abs than to introduce a magic number and
assuming that everyone understands basic math I'm not sure what about this you
do not like.
{quote}
I would personally go for:
{code}
final int delta = this.maxThreads - newMaxThreads;
LOG.debug("Change concurrent thread count to {} from {}", newMaxThreads,
this.maxThreads);
if (delta == 0) {
return true;
}
if (delta < 0) {
LOG.debug("Adding thread capacity: {}", -1*delta);
this.semaphore.release(-1*delta);
this.maxThreads = newMaxThreads;
return true;
}
...
boolean acquired = this.semaphore.tryAcquire(-1 * delta, duration,
TimeUnit.SECONDS);
{code}
> Introduce Java Concurrent Package To DataXceiverServer Class
> ------------------------------------------------------------
>
> Key: HDFS-14258
> URL: https://issues.apache.org/jira/browse/HDFS-14258
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: datanode
> Affects Versions: 3.2.0
> Reporter: BELUGA BEHR
> Assignee: BELUGA BEHR
> Priority: Minor
> Attachments: HDFS-14258.1.patch, HDFS-14258.2.patch,
> HDFS-14258.3.patch, HDFS-14258.4.patch, HDFS-14258.5.patch,
> HDFS-14258.6.patch, HDFS-14258.7.patch
>
>
> * Use Java concurrent package to replace current facilities in
> {{DataXceiverServer}}.
> * A little bit of extra clean up
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]