RFR: 8265123: Add static factory methods to com.sun.net.httpserver.Filter

Roger Riggs rriggs at openjdk.java.net
Wed Apr 14 17:51:37 UTC 2021


On Tue, 13 Apr 2021 15:39:17 GMT, Julia Boes <jboes at openjdk.org> wrote:

> Add two static factory methods to com.sun.net.httpserver that facilitate the creation of pre- and post-processing Filters: 
> 
> `public static Filter beforeResponse(String description, Consumer<HttpExchange> filterImpl) {}`
> `public static Filter afterResponse(String description, Consumer<HttpExchange> filterImpl) {}`

test/jdk/com/sun/net/httpserver/FilterTest.java line 63:

> 61:             ch.setLevel(Level.ALL);
> 62:             logger.addHandler(ch);
> 63:         }

Is there a concern that the Logger will be GC'd before it will be used?
Since the reference is not stored anywhere, it can be GC'd immediately.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3468


More information about the net-dev mailing list