Closed karlvr closed 11 years ago
To use this in a webapp you should have a class like follows:
@WebListener
public class Tracking implements ServletContextListener {
@Override
public void contextDestroyed(ServletContextEvent evt) {
KeenClient.client().shutdown(20000);
}
@Override
public void contextInitialized(ServletContextEvent evt) {
}
}
A couple things:
1.) Can you fix the formatting / tabs of the shutdown() method? Looks a bit wonky. 2.) Don't swallow the InterruptedException. Either throw it or wrap it in a new exception. Or, at the very very least, log it. 3.) Can we get a unit test for this?
There's some updates for you. To get good testing going suggested that KeenClient would need to recover from a shutdown. So I've implemented that. That has resulted in some more invasive changes than I like to make to other people's code. It is a result of the static nature of EXECUTOR_SERVICE.
Merged.
Fixes issue #3.