Tokenizer is immutable and thread safe, so reuse it.

This commit is contained in:
Gary Gregory 2024-06-10 18:27:21 -04:00
parent 225edf5ea8
commit 4c42c70a51
2 changed files with 4 additions and 4 deletions

View File

@ -45,10 +45,10 @@ final class DistinguishedNameParser {
private static final Tokenizer.Delimiter EQUAL_OR_COMMA_OR_PLUS = Tokenizer.delimiters('=', ',', '+');
private static final Tokenizer.Delimiter COMMA_OR_PLUS = Tokenizer.delimiters(',', '+');
private final Tokenizer tokenParser;
private final Tokenizer tokenParser = new InternalTokenParser();
DistinguishedNameParser() {
this.tokenParser = new InternalTokenParser();
private DistinguishedNameParser() {
// empty
}
private String parseToken(final CharArrayBuffer buf, final Tokenizer.Cursor cursor, final Tokenizer.Delimiter delimiters) {

View File

@ -46,7 +46,7 @@ public class TestDistinguishedNameParser {
@BeforeEach
public void setup() {
impl = new DistinguishedNameParser();
impl = DistinguishedNameParser.INSTANCE;
}
@Test