How can I make external methods interruptable?

后端 未结 8 914
南旧
南旧 2021-02-05 02:32

The Problem

I\'m running multiple invocations of some external method via an ExecutorService. I would like to be able to interrupt these methods, but unfortunately the

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 03:26

    To my knowledge there are two ways of using aspect

    • AspecJ
    • Spring AOP

    AspectJ is a customized compiler which intercepts methods that is compiles (meaning it can't get "external methods". Spring AOP (by default) uses class proxying to intercept methods at runtime (so it can intercept "external methods". but the problem with Spring AOP is that it can't proxy already-proxied classes (which AspectJ can do because it does not proxy classes). I think AspectJ could help you in this case.

提交回复
热议问题