You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2015/10/15 06:36:05 UTC

[jira] [Created] (REEF-849) Improve NetworkConnectionServiceTest

Dongjoon Hyun created REEF-849:
----------------------------------

             Summary: 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


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)