Allow InterceptHandler to specify the messages they can intercept. This allows us to improve the performance of the broker interceptor, and will make log traces more clear.

- Add methods to return an unique identifier and the supported message types at the InterceptHandler interface.
- Include a default implementation of the new methods in the AbstractInterceptHandler. By default, all the interceptors will be able to handle any message (same as before).
- Comment verifyNoMoreInteractions() call from the BrokerInterceptorTest.testAddAndRemoveInterceptHandler(). The removeInterceptHandler() method of the broker interceptor
  polls the InterceptHandler, so an interaction will always exist after the call to onSubscribe().
This commit is contained in:
Luis Barrios
2017-01-10 17:06:13 +01:00
parent 1d75a25aa3
commit 46fcdc0894
15 changed files with 132 additions and 48 deletions
@@ -246,11 +246,11 @@ public class Server {
* @param interceptHandler the handler to add.
* @return true id operation was successful.
* */
public boolean addInterceptHandler(InterceptHandler interceptHandler) {
public void addInterceptHandler(InterceptHandler interceptHandler) {
if (!m_initialized) {
throw new IllegalStateException("Can't register interceptors on a server that is not yet started");
}
return m_processor.addInterceptHandler(interceptHandler);
m_processor.addInterceptHandler(interceptHandler);
}
/**
@@ -258,11 +258,11 @@ public class Server {
* @param interceptHandler the handler to remove.
* @return true id operation was successful.
* */
public boolean removeInterceptHandler(InterceptHandler interceptHandler) {
public void removeInterceptHandler(InterceptHandler interceptHandler) {
if (!m_initialized) {
throw new IllegalStateException("Can't deregister interceptors from a server that is not yet started");
}
return m_processor.removeInterceptHandler(interceptHandler);
m_processor.removeInterceptHandler(interceptHandler);
}
}