You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by "Mariia Mykhailova (JIRA)" <ji...@apache.org> on 2015/10/15 20:02:05 UTC
[jira] [Resolved] (REEF-849) Improve NetworkConnectionServiceTest
[ https://issues.apache.org/jira/browse/REEF-849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mariia Mykhailova resolved REEF-849.
------------------------------------
Resolution: Fixed
Fix Version/s: 0.14
Resolved via [PR 567|https://github.com/apache/incubator-reef/pull/567]
> Improve NetworkConnectionServiceTest
> ------------------------------------
>
> Key: REEF-849
> URL: https://issues.apache.org/jira/browse/REEF-849
> Project: REEF
> Issue Type: Improvement
> Components: REEF-IO
> Affects Versions: 0.13
> Reporter: Dongjoon Hyun
> Assignee: Dongjoon Hyun
> Priority: Trivial
> Fix For: 0.14
>
>
> NetworkConnectionServiceTest has the same issue in REEF-812. We need to improve inefficient code like the following.
> {code}
> - // build the message
> - final StringBuilder msb = new StringBuilder();
> - for (int i = 0; i < size; i++) {
> - msb.append("1");
> - }
> - final String message = msb.toString();
> -
> + final String message = StringUtils.repeat('1', size);
> {code}
> Also, it would be better execute `open()` once per each connection.
> {code}
> + conn.open();
> for (int i = 0; i < numMessages; i++) {
> ...
> - conn.open();
> - conn.write(sb.toString());
> + conn.write(message);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)