Package jenkins.util
Class TreeStringBuilder
- java.lang.Object
-
- jenkins.util.TreeStringBuilder
-
public class TreeStringBuilder extends Object
BuildsTreeStrings that share common prefixes. Callintern(String)and you get theTreeStringthat represents the same string, but as you interns more strings that share the same prefixes, thoseTreeStrings that you get back start to share data.Because the internal state of
TreeStrings get mutated as new strings are interned (to exploit new-found common prefixes),TreeStrings returned fromintern(String)aren't thread-safe untilTreeStringBuilderis disposed. That is, you have to make sure other threads don't see thoseTreeStrings until you are done interning strings.- Since:
- 1.473
- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description TreeStringBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddedup()Further reduces the memory footprint by finding the same labels across multipleTreeStrings.TreeStringintern(String s)Interns a string.TreeStringintern(TreeString s)Interns aTreeStringcreated elsewhere.
-
-
-
Method Detail
-
intern
public TreeString intern(String s)
Interns a string.
-
intern
public TreeString intern(TreeString s)
Interns aTreeStringcreated elsewhere.
-
dedup
public void dedup()
Further reduces the memory footprint by finding the same labels across multipleTreeStrings.
-
-