I was going through a java tutorial on Spring Retry and there I read about RetryCallback, which is an interface.
In the same tutorial, I found this chunk of code:
retryTemplate.execute(new RetryCallback<Void, RuntimeException>() {
@Override
public Void doWithRetry(RetryContext arg0) {
myService.templateRetryService();
...
}
});
The way I see it, an anonymous object of RetryCallback is being instantiated. But then we just read it's an interface.
Could someone explain what's happening here?
Although not required, but just in case here's a link to the tutorial