Wie man in AspectJ eine Ausnahme erneut auslöst um zu raten

Ich habe einige Methoden, die eine Ausnahme auslösen, und ich möchte mit AspectJ herum raten, die Ausführungszeit zu berechnen, und wenn eine Ausnahme ausgelöst wird, mich im Fehlerprotokoll anzumelden und den Ablauf fortzusetzen, indem die Ausnahme erneut ausgelöst wird.

Ich habe versucht, dies zu erreichen, indem ich folgte, aber Eclipse sagt "Unhandled Exception Type".

Code-gegen wen aspectj verwendet werden soll: -

<code>public interface Iface {
    public void reload() throws TException;

    public TUser getUserFromUserId(int userId, String serverId) throws ResumeNotFoundException, TException;

    public TUser getUserFromUsername(String username, String serverId) throws  ResumeNotFoundException, TException;

    public TResume getPartialActiveProfileFromUserId(int userId, int sectionsBitField, String serverId) throws ResumeNotFoundException, UserNotFoundException;

    public TResume getPartialActiveProfileFromUsername(String username, int sectionsBitField, String serverId) throws ResumeNotFoundException, UserNotFoundException, TException;
}
</code>

Code aspektj: -

<code>public aspect AspectServerLog {

public static final Logger ERR_LOG = LoggerFactory.getLogger("error");

Object around() : call (* com.abc.Iface.* (..)) {
    Object ret;
    Throwable ex = null;

    StopWatch watch = new Slf4JStopWatch();

    try {
    ret = proceed();
    }catch (UserNotFoundException e) {
    ex = e ;
     throw e ;
    } catch (ResumeNotFoundException e) {
    ex = e ;
    throw e ;
    } catch (Throwable e) {
    ex = e ;
    throw new RuntimeException(e);
    }finally{

    watch.stop(thisJoinPoint.toShortString());

    if(ex!=null){
        StringBuilder mesg = new StringBuilder("Exception in ");
        mesg.append(thisJoinPoint.toShortString()).append('(');
        for(Object o : thisJoinPoint.getArgs()) {
        mesg.append(o).append(',');
        }
        mesg.append(')');

        ERR_LOG.error(mesg.toString(), ex);
        numEx++;
    }

   }
return ret;
}
}
</code>

Bitte helfen Sie, warum dieser AspektJ nicht funktioniert.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage