Search in sources :

Example 1 with ContainerException

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();
    }
}
Also used : ContainerException(com.nokia.dempsy.container.ContainerException) StatsCollector(com.nokia.dempsy.monitoring.StatsCollector)

Aggregations

ContainerException (com.nokia.dempsy.container.ContainerException)1 StatsCollector (com.nokia.dempsy.monitoring.StatsCollector)1