Modules, interceptors and loading order

As we know that the order that interceptors fire is important, what is the best way to ensure that all inteceptors are listed in the proper order in an application that uses modules (both 3rd party and bespoke) heavily when those modules declare interceptors and also custom interception points? There doesn’t seem to be a way to direct the order modules are loaded and/or configured? What’s the best way to granularly control this?

There is no way to do this that can be easily done. Basically because the modules can be unloaded at any time and their contributions removed.

If you really want to order everything, you would have to talk to the interceptor service to get each state you want, and reorder as you see fit.

@lmajano thank you. So it seems there are two areas of potential concern here:

  1. the order of interceptionPoints (e.g. if I want my custom interceptor point slotted to run at a particulat point);
    and
  2. the order various modules that implement the same interceptor point would run (e.g. whose preProcess interceptor runs first)

The first one seems easier as it’s an array stored in the interceptorService.

However, the second one seems unworkable because, as far as I can tell from dumping the interceptorService, that is stored in a plain (i.e. unordered) struct in metadataMap for each interceptionState, is that correct?

Assuming I was able to rearrange things through the interceptorService with a custom order, at what lifecycle point would it be ideal to invoke that functionality?

I stand corrected, it’s in a java linked hashmap under pool! OK, some promise here…