Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1465#discussion_r58927425
  
    --- Diff: 
core/src/com/cloud/agent/resource/virtualnetwork/facade/AbstractConfigItemFacade.java
 ---
    @@ -104,13 +109,25 @@ public static AbstractConfigItemFacade 
getInstance(final Class<? extends Network
             return instance;
         }
     
    +
    +    private static String appendUuidToJsonFiles(final String filename) {
    +        String remoteFileName = new String(filename);
    --- End diff --
    
    Why are is a ``new String(filename)`` being done?  This avoids the constant 
pool, and is extremely expensive.  Consider the following usage of 
``StringBuilder`` to avoid unnecessary pressure on the ``String`` constant pool 
due to the ``new`` call and string concatenation:
    
    ```
    final StringBuilder remoteFileName = new StringBuilder(filename);
    if (filename.endWith("json")) {
        remoteFileName.append(".");
        remoteFileName.append(UUID.randomUUID()); // implicit call to toString
    }
    return remoteFileName.toString();
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to