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

    https://github.com/apache/brooklyn-server/pull/681#discussion_r116661692
  
    --- Diff: 
software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
 ---
    @@ -237,7 +240,7 @@ private static synchronized WinRmClientContext 
createWinrmContext(ManagementCont
             // TODO Use getScratchpad()
             BrooklynProperties props = 
((ManagementContextInternal)mgmt).getBrooklynProperties();
             WinRmClientContext instance = props.getConfig(CONTEXT);
    -        if (instance == null) {
    +        if (instance == null || 
Boolean.TRUE.equals(props.getConfig(USE_UNIQUE_CONTEXT))) {
    --- End diff --
    
    This will cause buildup of connection pools & threads for them (pool per 
`executePs` call).
    Instead I suggest that we don't pass the `context` at all to 
`WinRmTool.Builder`. When no `context` is passed externally, `WinRmClient` will 
create one and destroy it when done with the request.
    The flag doesn't seem too useful since it causes incorrect behaviour when 
activated - suggest doing the changes unconditionally.
    
    Longer term would be great if we implement caching like in 
`SshMachineLocation` as @aledsage suggests, but with the addition of a 
`release` step so we can terminate the `context` when no longer needed.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to