Uploaded image for project: 'REEF (Retired)'
  1. REEF (Retired)
  2. REEF-849

Improve NetworkConnectionServiceTest

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 0.13
    • 0.14
    • REEF-IO
    • None

    Description

      NetworkConnectionServiceTest has the same issue in REEF-812. We need to improve inefficient code like the following.

      -            // 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);
      

      Also, it would be better execute `open()` once per each connection.

      +  conn.open();
      for (int i = 0; i < numMessages; i++) {
        ...
      -  conn.open();
      -  conn.write(sb.toString());
      +  conn.write(message);
      }
      

      Attachments

        Issue Links

          Activity

            People

              dongjoon Dongjoon Hyun
              dongjoon Dongjoon Hyun
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: