Recently learning Struts2, the filters and interceptors are different, the underlying principle of the filter is based on the callback method, and the interceptor is based on reflection, and then recursion
For the callback function, this blog is very good 51657840
The feeling has a popular explanation:
Using the client and the server as a metaphor, such as client A and Server B,
A to B message, sent, b processing the message to return to a, but it takes a while, and a don't want to, a want to go on doing other things, b processing good news sent over, so need to open a new thread in a,
In this thread A sends a message to B, B receives the message, finishes processing and returns to a, and a can continue to do other things.
In the sense of invoking a method:
There are methods in a SendMessage, call the process method of B, the parameters required to have two, one is to process the message, one is a reference (generally set to a interface, so long as a implementation of this interface can be passed), otherwise b processing the message, do not know to whom Ah, That's right. After the message is processed, B is definitely calling a (the reference to a in the two parameters received by B at this point) to receive the result, and a also gets the result, so that the asynchronous callback is implemented. The Accept method is the callback method.
,,
Java callback function