Documentation TaskDoc JavaDoc Packages
Remote call result of annotated methods will be cached and further calls will be not issued to the remote endpoint.

Methods can be annotated with this class to tell the RMI runtime to cache the result of the calls to it. It is generally useful if the result of a method call has no side effects and will be the same if called multiple times.

Only the first call will be issued over the connection and further calls will receive the result of the first call. If the first one is still pending, the further calls will wait for it to finish.

The annotated methods do not require to have no parameters, but note that the result is not cached based on the parameters.
If a method is called with a parameter value of A and later with the value B, the second call with value B will receive the result of the call with A.

The result is only cached if the call succeeds and throws no exceptions. If an annotated method throws an exception, later calls to the method will be issued to the remote endpoint.