diff --git a/resolver/src/main/java/io/netty/resolver/HostsFileEntriesProvider.java b/resolver/src/main/java/io/netty/resolver/HostsFileEntriesProvider.java index 8f0edb1fc6..aaf29208e0 100644 --- a/resolver/src/main/java/io/netty/resolver/HostsFileEntriesProvider.java +++ b/resolver/src/main/java/io/netty/resolver/HostsFileEntriesProvider.java @@ -120,7 +120,7 @@ public final class HostsFileEntriesProvider { * @return a new {@link HostsFileEntriesProvider.Parser} */ public static Parser parser() { - return new ParserImpl(); + return ParserImpl.INSTANCE; } static final HostsFileEntriesProvider EMPTY = @@ -164,6 +164,12 @@ public final class HostsFileEntriesProvider { private static final InternalLogger logger = InternalLoggerFactory.getInstance(Parser.class); + static final ParserImpl INSTANCE = new ParserImpl(); + + private ParserImpl() { + // singleton + } + @Override public HostsFileEntriesProvider parse() throws IOException { return parse(locateHostsFile(), Charset.defaultCharset());