public Object invoke()

in src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorInvocationHandler.java [140:190]


    public Object invoke(Object proxy, Method method, Object [] args)
        throws Throwable
    {
        Object result;

        // create the interceptor context for current method call

        AvalonInterceptorContext context = new AvalonInterceptorContextImpl(
            this.getServiceName(),
            this.getServiceShorthand(),
            this.getServiceDelegate(),
            method,
            args
            );

        // if no transaction id is currently define we create a new one

        boolean hasCreatedTransaction = this.createTransactionId(context);

        try
        {
            context.incrementInvocationDepth();
            this.onEntry(context);
            result = method.invoke( this.getServiceDelegate(), args );
            this.onExit(context,result);
            return result;
        }
        catch (InvocationTargetException e)
        {
            this.onError(context,e.getTargetException());
            throw e.getTargetException();
        }
        catch (Throwable t)
        {
            this.onError(context,t);
            throw t;
        }
        finally
        {
            // decrement the service invocation depth

            context.decrementInvocationDepth();

            // reset the transaction id if we have created it before

            if( hasCreatedTransaction )
            {
                context.clearTransactionId();
            }
        }
    }