jsr369-experts@servlet-spec.java.net

[jsr369-experts] SERVLET_SPEC-142: ACTION: Use Java SE 8 default methods for listeners

From: Edward Burns <edward.burns_at_oracle.com>
Date: Mon, 5 Oct 2015 15:22:36 -0700

>>>>> On Fri, 02 Oct 2015 16:57:44 -0700, Shing Wai Chan <shing.wai.chan_at_oracle.com> said:

SWC> In servlet users email alias, there is a discussion of default methods
SWC> for listeners.
SWC> The jira issue is SERVLET_SPEC-142: Use Java SE 8 default methods for
SWC> listeners.

SWC> Here are my investigations:
SWC> 1. We can add no-op default methods to all of the methods in
SWC> javax.servlet:
SWC> ServletContextAttributeListener, ServletContextListener,
SWC> ServletRequestAttributeListener, ServletRequestListener
SWC> javax.servlet.http:
SWC> HttpSessionActivationListener, HttpSessionAttributeListener,
SWC> HttpSessionBindingListener, HttpSessionListener

This is a great suggestion. +1.

SWC> 2. We will "not" add no-op default method to
SWC> javax.servlet.http.HttpSessionIdListener
SWC> as there is only "one" method there.

Good point.

SWC> 3. We do not add no-op default methods to javax.servlet.WriteListener,
SWC> ReadListener
SWC> as all those methods are important.
SWC> Developers need to take a look whether they need to override them.
SWC> In fact, similar interface in JDK 8,
SWC> java.nio.channels.CompletionHandler, does not have default methods.

It is indeed best to force those to be carefully considered.

SWC> 4. For javax.servlet.AsyncListener, we don't want default #onComplete as
SWC> we may need to clean up resources there.
SWC> Similarly, in #onError and #onTimeout.
SWC> Should we leave AsyncListener without default methods for now?

Yes, that's fine.

ACTION: We're trying to close down and take a snapshot of the work in
progress for in an EDR for JavaOne, so please weigh in on this
by 17:00 PDT Tuesday 6 October 2015. Silence is consent on this one.

Thanks,

Ed

-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| 23 Business days til JavaOne 2015
| 38 Business days til DOAG 2015