use of com.nokia.dempsy.container.ContainerException in project Dempsy by Dempsy.
the class LifecycleHelper method invoke.
/**
* Invokes the appropriate message handler of the passed instance. Caller is responsible for not passing <code>null</code> messages.
*
* @throws ContainerException
* @throws InvocationTargetException
* @throws IllegalAccessException
* @throws IllegalArgumentException
*/
public Object invoke(Object instance, Object message, StatsCollector statsCollector) throws ContainerException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> messageClass = message.getClass();
if (!isMessageSupported(message))
throw new ContainerException(mpClassName + ": no handler for messages of type: " + messageClass.getName());
StatsCollector.TimerContext tctx = null;
try {
tctx = statsCollector.handleMessageStarted();
return invocationMethods.invokeMethod(instance, message);
} finally {
if (tctx != null)
tctx.stop();
}
}
Aggregations